mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-28 10:28:36 +00:00
fix(policies): Add ability to configure skipBackgroundRequests (#9532)
* fix(policies): Add ability to configure skipBackgroundRequests Signed-off-by: Marco Maurer <mkilchhofer@users.noreply.github.com> * fix: Drop trailing spaces to fix CI Signed-off-by: Marco Maurer <mkilchhofer@users.noreply.github.com> --------- Signed-off-by: Marco Maurer <mkilchhofer@users.noreply.github.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
This commit is contained in:
parent
7170cbb0c2
commit
2ee9db072a
21 changed files with 70 additions and 1 deletions
|
@ -21,4 +21,3 @@ kubeVersion: ">=1.16.0-0"
|
|||
annotations:
|
||||
artifacthub.io/operator: "false"
|
||||
artifacthub.io/prerelease: "false"
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ The command removes all the Kubernetes components associated with the chart and
|
|||
| nameOverride | string | `nil` | Name override. |
|
||||
| customLabels | object | `{}` | Additional labels. |
|
||||
| background | bool | `true` | Policies background mode |
|
||||
| skipBackgroundRequests | bool | `nil` | SkipBackgroundRequests bypasses admission requests that are sent by the background controller |
|
||||
| kyvernoVersion | string | `"autodetect"` | Kyverno version The default of "autodetect" will try to determine the currently installed version from the deployment |
|
||||
|
||||
## Source Code
|
||||
|
|
|
@ -64,6 +64,9 @@ spec:
|
|||
operator: NotEquals
|
||||
value: DELETE
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Any capabilities added beyond the allowed list (AUDIT_WRITE, CHOWN, DAC_OVERRIDE, FOWNER,
|
||||
|
|
|
@ -48,6 +48,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Sharing the host namespaces is disallowed. The fields spec.hostNetwork,
|
||||
|
|
|
@ -47,6 +47,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
HostPath volumes are forbidden. The field spec.volumes[*].hostPath must be unset.
|
||||
|
|
|
@ -47,6 +47,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Use of host ports is disallowed. The fields spec.containers[*].ports[*].hostPort
|
||||
|
|
|
@ -48,6 +48,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
HostProcess containers are disallowed. The fields spec.securityContext.windowsOptions.hostProcess,
|
||||
|
|
|
@ -46,6 +46,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Privileged mode is disallowed. The fields spec.containers[*].securityContext.privileged
|
||||
|
|
|
@ -48,6 +48,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Changing the proc mount from the default is not allowed. The fields
|
||||
|
|
|
@ -46,6 +46,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Setting the SELinux type is restricted. The fields
|
||||
|
@ -83,6 +86,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Setting the SELinux user or role is forbidden. The fields
|
||||
|
|
|
@ -49,6 +49,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Specifying other AppArmor profiles is disallowed. The annotation
|
||||
|
|
|
@ -47,6 +47,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Use of custom Seccomp profiles is disallowed. The fields
|
||||
|
|
|
@ -50,6 +50,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Setting additional sysctls above the allowed type is disallowed.
|
||||
|
|
|
@ -48,6 +48,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Running with root group IDs is disallowed. The fields
|
||||
|
@ -92,6 +95,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Containers cannot run with a root primary or supplementary GID. The field
|
||||
|
@ -111,6 +117,9 @@ spec:
|
|||
exclude:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Containers cannot run with a root primary or supplementary GID. The field
|
||||
|
|
|
@ -65,6 +65,9 @@ spec:
|
|||
operator: NotEquals
|
||||
value: DELETE
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Containers must drop `ALL` capabilities.
|
||||
|
@ -107,6 +110,9 @@ spec:
|
|||
operator: NotEquals
|
||||
value: DELETE
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Any capabilities added other than NET_BIND_SERVICE are disallowed.
|
||||
|
|
|
@ -46,6 +46,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Privilege escalation is disallowed. The fields
|
||||
|
|
|
@ -46,6 +46,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Running as root is not allowed. The fields spec.securityContext.runAsUser,
|
||||
|
|
|
@ -47,6 +47,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Running as root is not allowed. Either the field spec.securityContext.runAsNonRoot
|
||||
|
|
|
@ -49,6 +49,9 @@ spec:
|
|||
preconditions:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Use of custom Seccomp profiles is disallowed. The fields
|
||||
|
|
|
@ -66,6 +66,9 @@ spec:
|
|||
operator: NotEquals
|
||||
value: DELETE
|
||||
{{- end }}
|
||||
{{- if not (quote .Values.skipBackgroundRequests | empty) }}
|
||||
skipBackgroundRequests: {{ .Values.skipBackgroundRequests }}
|
||||
{{- end }}
|
||||
validate:
|
||||
message: >-
|
||||
Only the following types of volumes may be used: configMap, csi, downwardAPI,
|
||||
|
|
|
@ -101,6 +101,9 @@ customLabels: {}
|
|||
# -- Policies background mode
|
||||
background: true
|
||||
|
||||
# -- (bool) SkipBackgroundRequests bypasses admission requests that are sent by the background controller
|
||||
skipBackgroundRequests: ~
|
||||
|
||||
# -- Kyverno version
|
||||
# The default of "autodetect" will try to determine the currently installed version from the deployment
|
||||
kyvernoVersion: autodetect
|
||||
|
|
Loading…
Add table
Reference in a new issue