diff --git a/deployment/sriov-network-operator-chart/templates/predeletehook.yaml b/deployment/sriov-network-operator-chart/templates/predeletehook.yaml new file mode 100644 index 000000000..91bc64d30 --- /dev/null +++ b/deployment/sriov-network-operator-chart/templates/predeletehook.yaml @@ -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 }} \ No newline at end of file