1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/test/conformance/chainsaw/autogen/foreach-jsonpatch/policy.yaml
Mariam Fahmy 11b51aa487
chore: run autogen tests with chainsaw (#8937)
* chore: run autogen tests with chainsaw

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix chainsaw tests

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: remove the creationTimestamp from the TestStep

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix

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

* chore: run autogen tests with chainsaw

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix chainsaw tests

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: remove the creationTimestamp from the TestStep

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* bump chainsaw

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

* bump chainsaw

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

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-11-22 23:46:44 +01:00

28 lines
896 B
YAML

apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: mutate-pod-require-non-root-user
spec:
schemaValidation: false
rules:
- name: require-non-root-user
match:
all:
- resources:
kinds:
- Pod
mutate:
foreach:
- list: request.object.spec.containers
preconditions:
all:
# skip images that are exempt (allowed to run as a root user);
# escape quotes where the replaced value may contain hyphens
- key: "{{images.containers.\"{{element.name}}\".path}}"
operator: AnyNotIn
value:
- myorg/exempt-image-name
patchesJson6902: |-
- path: /spec/containers/{{elementIndex}}/securityContext/runAsNonRoot
op: add
value: true