1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-28 10:28:36 +00:00

fix(policy chart): Skip DELETE requests on policies using deny statements (#7883)

Fixes #7456

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
treydock 2023-07-24 10:29:35 -04:00 committed by GitHub
parent 295e98aebe
commit 2273529a35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 4 deletions

View file

@ -29,3 +29,5 @@ annotations:
description: Support for customLabels, they were ignored up to now
- kind: removed
description: "Walk back change in PSS policy to send to to_upper"
- kind: fixed
description: Skip DELETE requests on policies using deny statements

View file

@ -12,8 +12,18 @@ policyPreconditions:
- key: "{{ request.object.metadata.name }}"
operator: NotEquals
value: "dcgm-exporter*"
disallow-capabilities:
all:
- key: "{{ request.object.metadata.name }}"
operator: NotEquals
value: "dcgm-exporter*"
adding-capabilities-strict:
all:
- key: "{{ request.object.metadata.name }}"
operator: NotEquals
value: "dcgm-exporter*"
restrict-volume-types:
all:
- key: "{{ request.object.metadata.name }}"
operator: NotEquals
value: "dcgm-exporter*"

View file

@ -43,9 +43,26 @@ spec:
exclude:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with index .Values "policyPreconditions" $name }}
{{- $preconditions := index .Values "policyPreconditions" $name }}
{{- if $preconditions }}
{{- with $preconditions }}
preconditions:
{{- toYaml . | nindent 8 }}
{{- if .all }}
all:
- key: "{{`{{ request.operation || 'BACKGROUND' }}`}}"
operator: NotEquals
value: DELETE
{{- toYaml .all | nindent 8 }}
{{- else }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- else }}
preconditions:
all:
- key: "{{`{{ request.operation || 'BACKGROUND' }}`}}"
operator: NotEquals
value: DELETE
{{- end }}
validate:
message: >-

View file

@ -45,9 +45,26 @@ spec:
exclude:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with index .Values "policyPreconditions" $name }}
{{- $preconditions := index .Values "policyPreconditions" $name }}
{{- if $preconditions }}
{{- with $preconditions }}
preconditions:
{{- toYaml . | nindent 8 }}
{{- if .all }}
all:
- key: "{{`{{ request.operation || 'BACKGROUND' }}`}}"
operator: NotEquals
value: DELETE
{{- toYaml .all | nindent 8 }}
{{- else }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- else }}
preconditions:
all:
- key: "{{`{{ request.operation || 'BACKGROUND' }}`}}"
operator: NotEquals
value: DELETE
{{- end }}
validate:
message: >-