We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the sample policy to mount volumes and set default security context for ephemeral containers. To break down the following policy:
ephemeral-debug: true
apiVersion : kyverno.io/v1 kind: ClusterPolicy metadata: name: mount-volumes-for-ephemeral-containers spec: background: false rules: - name: add-volume-to-debug-pod match: any: - resources: kinds: - Pod namespaces: - default selector: matchLabels: ephemeral-debug: "true" operations: - CREATE mutate: patchStrategicMerge: spec: volumes: - name: ephemeralcontainer-tmp-tcpdump-volume emptyDir: sizeLimit: 1G - name: mutate-ephemeralcontainers-readonlyrootfilesystem match: any: - resources: kinds: - Pod namespaces: - default preconditions: all: - key: "{{ request.object.spec.ephemeralContainers[] || `[]` | length(@) }}" operator: GreaterThanOrEquals value: 1 mutate: foreach: - list: "request.object.spec.ephemeralContainers[]" patchStrategicMerge: spec: ephemeralContainers: - name: "{{ element.name }}" +(securityContext): +(readOnlyRootFilesystem): true - name: add-volumemount match: any: - resources: kinds: - Pod namespaces: - default preconditions: all: - key: "{{ request.object.spec.ephemeralContainers[] || `[]` | length(@) }}" operator: GreaterThanOrEquals value: 1 - key: "{{ request.object.spec.ephemeralContainers[].volumeMounts[?name=='ephemeralcontainer-tmp-tcpdump-volume'] | `[]` | length(@) }}" operator: LessThan value: "{{ request.object.spec.ephemeralContainers[] || `[]` | length(@) }}" mutate: foreach: - list: "request.object.spec.ephemeralContainers" patchStrategicMerge: spec: ephemeralContainers: - name: "{{ element.name }}" volumeMounts: - mountPath: /tmp name: ephemeralcontainer-tmp-tcpdump-volume
It would be good to add Chainsaw tests for this policy, the test scenarios:
kubectl debug -it nginx-64ff7dcdf4-5jbmb --image=network-multitool:v1 --target nginx -- bash
See above.
No response
https://kubernetes.slack.com/archives/CLGR9BJU9/p1721654971501889
The text was updated successfully, but these errors were encountered:
/assign
Sorry, something went wrong.
No branches or pull requests
Problem Statement
Add the sample policy to mount volumes and set default security context for ephemeral containers. To break down the following policy:
ephemeral-debug: true
It would be good to add Chainsaw tests for this policy, the test scenarios:
ephemeral-debug: true
kubectl debug -it nginx-64ff7dcdf4-5jbmb --image=network-multitool:v1 --target nginx -- bash
Solution Description
See above.
Example "Good" Resource
No response
Example "Bad" Resource
No response
Other Comments
No response
Slack discussion
https://kubernetes.slack.com/archives/CLGR9BJU9/p1721654971501889
Troubleshooting
The text was updated successfully, but these errors were encountered: