fix: fix kyvero whitelisting rules to use annotation, not label

This commit is contained in:
2025-06-22 08:21:11 +02:00
parent e884db402e
commit 561c620f98
2 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ metadata:
cert-manager.io/cluster-issuer: letsencrypt-production cert-manager.io/cluster-issuer: letsencrypt-production
nginx.ingress.kubernetes.io/backend-protocol: HTTP nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/ssl-redirect: "true"
atlantis.oceanbox.io/expose: internal oceanbox.io/expose: internal
labels: labels:
app.kubernetes.io/name: dapr-dashboard app.kubernetes.io/name: dapr-dashboard
name: dapr-dashboard name: dapr-dashboard
@@ -9,7 +9,7 @@ metadata:
policies.clusterConfig.kyverno.io/severity: medium policies.clusterConfig.kyverno.io/severity: medium
policies.clusterConfig.kyverno.io/subject: Ingress policies.clusterConfig.kyverno.io/subject: Ingress
policies.clusterConfig.kyverno.io/description: >- policies.clusterConfig.kyverno.io/description: >-
Ingresses with the label "internal=true" should be whitelisted. Ingresses with the annotation "oceanbox.io/expose=internal" should be whitelisted.
If no whitelist exists, add the default values, otherwise append If no whitelist exists, add the default values, otherwise append
whitelist to the already existing ones whitelist to the already existing ones
spec: spec:
@@ -22,9 +22,8 @@ spec:
resources: resources:
kinds: kinds:
- Ingress - Ingress
selector: annotations:
matchLabels: oceanbox.io/expose: internal
internal: "true"
mutate: mutate:
patchStrategicMerge: patchStrategicMerge:
metadata: metadata:
@@ -36,9 +35,8 @@ spec:
resources: resources:
kinds: kinds:
- Ingress - Ingress
selector: annotations:
matchLabels: oceanbox.io/expose: internal
internal: "true"
preconditions: preconditions:
any: any:
- key: "{{`{{request.object.metadata.annotations.\"nginx.ingress.kubernetes.io/whitelist-source-range\"}}`}}" - key: "{{`{{request.object.metadata.annotations.\"nginx.ingress.kubernetes.io/whitelist-source-range\"}}`}}"
@@ -57,9 +55,8 @@ spec:
resources: resources:
kinds: kinds:
- Ingress - Ingress
selector: annotations:
matchLabels: oceanbox.io/expose: internal
internal: "true"
preconditions: preconditions:
any: any:
- key: "{{`{{request.object.metadata.annotations.\"nginx.ingress.kubernetes.io/whitelist-source-range\"}}`}}" - key: "{{`{{request.object.metadata.annotations.\"nginx.ingress.kubernetes.io/whitelist-source-range\"}}`}}"