{{- if .Values.preDelete.enabled }} apiVersion: batch/v1 kind: Job metadata: name: rancher-webhook-pre-delete namespace: {{ .Release.Namespace }} labels: {{ include "rancher-webhook.labels" . | nindent 4 }} annotations: "helm.sh/hook": pre-delete "helm.sh/hook-weight": "3" "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded spec: backoffLimit: 3 template: metadata: name: rancher-webhook-pre-delete labels: {{ include "rancher-webhook.labels" . | nindent 8 }} spec: serviceAccountName: rancher-webhook-pre-delete restartPolicy: OnFailure nodeSelector: {{ include "linux-node-selector" . | nindent 8 }} {{- if .Values.nodeSelector }} {{ toYaml .Values.nodeSelector | indent 8 }} {{- end }} tolerations: {{ include "linux-node-tolerations" . | nindent 6 }} {{- if .Values.tolerations }} {{ toYaml .Values.tolerations | indent 6 }} {{- end }} containers: - name: rancher-webhook-pre-delete image: "{{ include "system_default_registry" . }}{{ .Values.preDelete.image.repository }}:{{ .Values.preDelete.image.tag }}" imagePullPolicy: IfNotPresent securityContext: runAsUser: 0 command: [ "kubectl", "delete", "--ignore-not-found=true", "mutatingwebhookconfigurations", "rancher.cattle.io" ] {{- end }}