1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-14 00:06:45 +00:00
kyverno/charts/kyverno/templates/policies/restricted/restrict-seccomp.yaml
treydock 48f0d90dd1
Allow some helm policies to be excluded (#1611)
* Allow some helm policies to be excluded

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>

* Make Helm security policies opt-in when podSecurityStandard=custom

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
2021-02-18 11:50:35 -08:00

42 lines
No EOL
1.4 KiB
YAML

{{ $name := "restrict-seccomp" -}}
{{- if eq (include "kyverno.podSecurityRestricted" (merge (dict "name" $name) .)) "true" }}
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: {{ $name }}
annotations:
policies.kyverno.io/title: Restrict Seccomp
policies.kyverno.io/category: Pod Security Standards (Restricted)
policies.kyverno.io/description: >-
The runtime default seccomp profile must be required, or only specific
additional profiles should be allowed.
spec:
background: true
validationFailureAction: {{ .Values.validationFailureAction }}
rules:
- name: seccomp
match:
resources:
kinds:
- Pod
validate:
message: >-
Use of custom Seccomp profiles is disallowed. The fields
spec.securityContext.seccompProfile.type,
spec.containers[*].securityContext.seccompProfile.type, and
spec.initContainers[*].securityContext.seccompProfile.type
must be unset or set to `runtime/default`.
pattern:
spec:
=(securityContext):
=(seccompProfile):
=(type): "runtime/default"
=(initContainers):
- =(securityContext):
=(seccompProfile):
=(type): "runtime/default"
containers:
- =(securityContext):
=(seccompProfile):
=(type): "runtime/default"
{{- end -}}