Files
capsule/charts/capsule/templates/pre-delete/job.yaml
Oliver Bähler 9ebbbed785 feat(helm): introduce new installation and CRD lifecycle (#1065)
* chore: name change for webhook names

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: remove apidocs

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* feat(helm): implement crd lifecycle and values consistency

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: change default group name

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

---------

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
2024-06-12 19:36:01 +02:00

82 lines
3.0 KiB
YAML

{{- if not $.Values.crds.exclusive }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ include "capsule.pre-delete.name" $ }}"
labels:
app.kubernetes.io/component: {{ include "capsule.pre-delete.component" . | quote }}
{{- include "capsule.labels" . | nindent 4 }}
annotations:
"helm.sh/hook-weight": "-1"
{{- include "capsule.pre-delete.annotations" . | nindent 4 }}
{{- with .Values.customAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if ge .Values.jobs.ttlSecondsAfterFinished 0.0 }}
ttlSecondsAfterFinished: {{ .Values.jobs.ttlSecondsAfterFinished }}
{{- end }}
template:
metadata:
labels:
app.kubernetes.io/component: {{ include "capsule.pre-delete.component" . | quote }}
{{- include "capsule.selectorLabels" . | nindent 8 }}
spec:
restartPolicy: {{ $.Values.jobs.restartPolicy }}
{{- with $.Values.jobs.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.jobs.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "capsule.pre-delete.name" . }}
containers:
- name: pre-delete-job
image: {{ include "capsule.jobsFullyQualifiedDockerImage" . }}
imagePullPolicy: {{ .Values.jobs.image.pullPolicy }}
command:
- "/bin/sh"
- "-c"
- |
set -o errexit ; set -o xtrace ; set -o nounset
{{- if or (.Values.tls.create) (.Values.certManager.generateCertificates) }}
kubectl delete secret -n $NAMESPACE {{ include "capsule.secretTlsName" $ }} --ignore-not-found
{{- end }}
kubectl delete clusterroles.rbac.authorization.k8s.io capsule-namespace-deleter capsule-namespace-provisioner --ignore-not-found
kubectl delete clusterrolebindings.rbac.authorization.k8s.io capsule-namespace-deleter capsule-namespace-provisioner --ignore-not-found
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- with $.Values.jobs.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.jobs.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}