rancher-partner-charts/charts/koor-tech/koor-operator/templates/predelete-job.yaml

37 lines
1.5 KiB
YAML

apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "koor-operator.fullname" . }}-predelete-job
labels:
app.kubernetes.io/created-by: koor-operator
app.kubernetes.io/part-of: koor-operator
{{- include "koor-operator.labels" . | nindent 4 }}
annotations:
helm.sh/hook: pre-delete
helm.sh/hook-delete-policy: hook-succeeded
spec:
backoffLimit: 20
template:
metadata:
name: {{ include "koor-operator.fullname" . }}-predelete-job
labels:
{{- include "koor-operator.labels" . | nindent 8 }}
spec:
restartPolicy: OnFailure
serviceAccountName: {{ include "koor-operator.jobName" . }}
containers:
- name: {{ include "koor-operator.fullname" . }}-pre-delete-job
image: bitnami/kubectl:1.26
command:
- "bin/bash"
- "-c"
args:
- |-
kubectl delete -n {{ .Release.Namespace }} job {{ include "koor-operator.jobName" . }} --ignore-not-found
cat <<EOF | kubectl delete -f - --ignore-not-found
{{- include "koor-operator.koorCluster" . | nindent 12}}
EOF
kubectl delete -n {{ .Release.Namespace }} deployment {{ include "koor-operator.fullname" . }}-controller-manager --ignore-not-found
kubectl delete -n {{ .Release.Namespace }} certificate {{ include "koor-operator.fullname" . }}-serving-cert --ignore-not-found
kubectl delete -n {{ .Release.Namespace }} issuer {{ include "koor-operator.fullname" . }}-selfsigned-issuer --ignore-not-found