Skip to content

Commit

Permalink
Backport a pre-delete helm hook for sriov-network-operator
Browse files Browse the repository at this point in the history
Mutating and Validating webhook configs are created programmatically
and are not managed by helm.
To clean them up on helm delete, adding a small pre-delete hook
k8snetworkplumbingwg/sriov-network-operator#751

Signed-off-by: amaslennikov <amaslennikov@nvidia.com>
  • Loading branch information
almaslennikov committed Jul 29, 2024
1 parent 6c6eccb commit 652bf22
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{ if .Values.operator.admissionControllers.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ include "sriov-network-operator.fullname" . }}-post-delete-hook"
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": hook-succeeded,hook-failed
spec:
template:
spec:
serviceAccountName: {{ include "sriov-network-operator.fullname" . }}
containers:
- name: cleanup
image: bitnami/kubectl:latest
command:
- /bin/sh
- -c
- |
kubectl delete MutatingWebhookConfiguration -n {{ .Release.Namespace }} sriov-operator-webhook-config network-resources-injector-config
kubectl delete ValidatingWebhookConfiguration -n {{ .Release.Namespace }} sriov-operator-webhook-config
restartPolicy: Never
{{ end }}

0 comments on commit 652bf22

Please sign in to comment.