mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 18:38:40 +00:00
support failurePolicy in kyverno-policies helm chart (#4323)
* support failurePolicy in kyverno-policies helm chart Signed-off-by: Tom Stewart <thomas.stewart@arcadia.com>
This commit is contained in:
parent
c95bb74992
commit
ca3d346fcc
21 changed files with 33 additions and 8 deletions
charts/kyverno-policies
Chart.yamlREADME.mdvalues.yaml
templates
baseline
disallow-capabilities.yamldisallow-host-namespaces.yamldisallow-host-path.yamldisallow-host-ports.yamldisallow-host-process.yamldisallow-privileged-containers.yamldisallow-proc-mount.yamldisallow-selinux.yamlrestrict-apparmor-profiles.yamlrestrict-seccomp.yamlrestrict-sysctls.yaml
other
restricted
|
@ -29,3 +29,5 @@ annotations:
|
|||
description: Fix Kyverno version check when image tag contains registry port number
|
||||
- kind: fixed
|
||||
description: Ensure preconditions are present with default values
|
||||
- kind: added
|
||||
description: Support for failurePolicy setting in kyverno-policies helm chart
|
||||
|
|
|
@ -68,6 +68,7 @@ The command removes all the Kubernetes components associated with the chart and
|
|||
| podSecurityPolicies | list | `[]` | Policies to include when `podSecurityStandard` is `custom`. |
|
||||
| includeOtherPolicies | list | `[]` | Additional policies to include from `other`. |
|
||||
| validationFailureAction | string | `"audit"` | Validation failure action (`audit`, `enforce`). For more info https://kyverno.io/docs/writing-policies/validate. |
|
||||
| failurePolicy | string | `"Fail"` | API server behavior if the webhook fails to respond ('Ignore', 'Fail') For more info: https://kyverno.io/docs/writing-policies/policy-settings/ |
|
||||
| validationFailureActionOverrides | object | `{"all":[]}` | Define validationFailureActionOverrides for specific policies. The overrides for `all` will apply to all policies. |
|
||||
| policyExclude | object | `{}` | Exclude resources from individual policies. Policies with multiple rules can have individual rules excluded by using the name of the rule as the key in the `policyExclude` map. |
|
||||
| policyPreconditions | object | `{}` | Add preconditions to individual policies. Policies with multiple rules can have individual rules excluded by using the name of the rule as the key in the `policyPreconditions` map. |
|
||||
|
|
|
@ -23,6 +23,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: adding-capabilities
|
||||
match:
|
||||
|
|
|
@ -24,6 +24,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: host-namespaces
|
||||
match:
|
||||
|
|
|
@ -23,6 +23,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: host-path
|
||||
match:
|
||||
|
|
|
@ -16,13 +16,14 @@ metadata:
|
|||
policies.kyverno.io/description: >-
|
||||
Access to host ports allows potential snooping of network traffic and should not be
|
||||
allowed, or at minimum restricted to a known list. This policy ensures the `hostPort`
|
||||
field is unset or set to `0`.
|
||||
field is unset or set to `0`.
|
||||
spec:
|
||||
validationFailureAction: {{ .Values.validationFailureAction }}
|
||||
{{- with concat (index .Values "validationFailureActionOverrides" "all") (default list (index .Values "validationFailureActionOverrides" $name)) }}
|
||||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: host-ports-none
|
||||
match:
|
||||
|
@ -54,4 +55,4 @@ spec:
|
|||
containers:
|
||||
- =(ports):
|
||||
- =(hostPort): 0
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -24,6 +24,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: host-process-containers
|
||||
match:
|
||||
|
|
|
@ -22,6 +22,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: privileged-containers
|
||||
match:
|
||||
|
|
|
@ -24,6 +24,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: check-proc-mount
|
||||
match:
|
||||
|
|
|
@ -22,6 +22,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: selinux-type
|
||||
match:
|
||||
|
|
|
@ -25,6 +25,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: app-armor
|
||||
match:
|
||||
|
|
|
@ -14,8 +14,8 @@ metadata:
|
|||
kyverno.io/kyverno-version: 1.6.0
|
||||
kyverno.io/kubernetes-version: "1.22-1.23"
|
||||
policies.kyverno.io/description: >-
|
||||
The seccomp profile must not be explicitly set to Unconfined. This policy,
|
||||
requiring Kubernetes v1.19 or later, ensures that seccomp is unset or
|
||||
The seccomp profile must not be explicitly set to Unconfined. This policy,
|
||||
requiring Kubernetes v1.19 or later, ensures that seccomp is unset or
|
||||
set to `RuntimeDefault` or `Localhost`.
|
||||
spec:
|
||||
background: {{ .Values.background }}
|
||||
|
@ -23,6 +23,7 @@ spec:
|
|||
{{- with concat (index .Values "validationFailureActionOverrides" "all") (default list (index .Values "validationFailureActionOverrides" $name)) }}
|
||||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: check-seccomp
|
||||
match:
|
||||
|
@ -50,7 +51,7 @@ spec:
|
|||
spec:
|
||||
=(securityContext):
|
||||
=(seccompProfile):
|
||||
=(type): "RuntimeDefault | Localhost"
|
||||
=(type): "RuntimeDefault | Localhost"
|
||||
=(ephemeralContainers):
|
||||
- =(securityContext):
|
||||
=(seccompProfile):
|
||||
|
|
|
@ -26,6 +26,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: check-sysctls
|
||||
match:
|
||||
|
|
|
@ -24,6 +24,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: check-runasgroup
|
||||
match:
|
||||
|
|
|
@ -24,6 +24,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: require-drop-all
|
||||
match:
|
||||
|
|
|
@ -22,6 +22,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: privilege-escalation
|
||||
match:
|
||||
|
|
|
@ -22,6 +22,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: run-as-non-root-user
|
||||
match:
|
||||
|
|
|
@ -23,6 +23,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: run-as-non-root
|
||||
match:
|
||||
|
|
|
@ -15,16 +15,17 @@ metadata:
|
|||
kyverno.io/kubernetes-version: "1.22-1.23"
|
||||
policies.kyverno.io/description: >-
|
||||
The seccomp profile in the Restricted group must not be explicitly set to Unconfined
|
||||
but additionally must also not allow an unset value. This policy,
|
||||
requiring Kubernetes v1.19 or later, ensures that seccomp is
|
||||
but additionally must also not allow an unset value. This policy,
|
||||
requiring Kubernetes v1.19 or later, ensures that seccomp is
|
||||
set to `RuntimeDefault` or `Localhost`. A known issue prevents a policy such as this
|
||||
using `anyPattern` from being persisted properly in Kubernetes 1.23.0-1.23.2.
|
||||
spec:
|
||||
background: {{ .Values.background }}
|
||||
validationFailureAction: {{ .Values.validationFailureAction }}
|
||||
{{- with concat (index .Values "validationFailureActionOverrides" "all") (default list (index .Values "validationFailureActionOverrides" $name)) }}
|
||||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: check-seccomp-strict
|
||||
match:
|
||||
|
|
|
@ -25,6 +25,7 @@ spec:
|
|||
validationFailureActionOverrides: {{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
background: {{ .Values.background }}
|
||||
failurePolicy: {{ .Values.failurePolicy }}
|
||||
rules:
|
||||
- name: restricted-volumes
|
||||
match:
|
||||
|
|
|
@ -16,6 +16,10 @@ includeOtherPolicies: []
|
|||
# For more info https://kyverno.io/docs/writing-policies/validate.
|
||||
validationFailureAction: audit
|
||||
|
||||
# -- API server behavior if the webhook fails to respond ('Ignore', 'Fail')
|
||||
# For more info: https://kyverno.io/docs/writing-policies/policy-settings/
|
||||
failurePolicy: Fail
|
||||
|
||||
# -- Define validationFailureActionOverrides for specific policies.
|
||||
# The overrides for `all` will apply to all policies.
|
||||
validationFailureActionOverrides:
|
||||
|
|
Loading…
Add table
Reference in a new issue