1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-31 03:45:17 +00:00
kyverno/test/conformance/kuttl/issues/5136/01-manifests.yaml
Charles-Edouard Brétéché b71c0004d0
fix: account for error rules in mutation webhook (#5264)
* fix: account for error rules in mutation webhook

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* add test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-08 12:36:13 +01:00

29 lines
848 B
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: propagate-cost-labels-from-namespace
spec:
failurePolicy: Ignore
rules:
- name: add-cost-labels
context:
- name: namespaceLabels
apiCall:
urlPath: "/api/v1/namespaces/{{request.namespace}}"
jmesPath: metadata.labels
match:
any:
- resources:
kinds:
- Pod
- Deployment
- StatefulSet
- DaemonSet
- Job
- CronJob
mutate:
patchStrategicMerge:
metadata:
labels:
cost.starfleet.evtech/project: "{{namespaceLabels.\"cost.starfleet.evtech/project\"}}"
cost.starfleet.evtech/application: "{{request.object.metadata.labels.\"cost.starfleet.evtech/application\" || namespaceLabels.\"cost.starfleet.evtech/application\"}}"