|
| 1 | +{{ if .Values.wizUninstallJob.enabled -}} |
| 2 | +apiVersion: batch/v1 |
| 3 | +kind: Job |
| 4 | +metadata: |
| 5 | + name: {{ include "wiz-admission-controller-uninstall.name" . }} |
| 6 | + namespace: {{ .Release.Namespace | quote }} |
| 7 | + labels: |
| 8 | + wiz.io/component: "admission-controller-uninstall" |
| 9 | + {{- include "wiz-admission-controller-uninstall.labels" . | nindent 4 }} |
| 10 | + annotations: |
| 11 | + "helm.sh/hook": pre-delete |
| 12 | + "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded |
| 13 | + rollme.proxyHash: {{ include "wiz-admission-controller.proxyHash" . }} |
| 14 | + rollme.wizApiTokenHash: {{ include "wiz-admission-controller.wizApiTokenHash" . }} |
| 15 | + {{- with (.Values.wizUninstallJob.jobAnnotations) }} |
| 16 | + {{- toYaml . | nindent 4 }} |
| 17 | + {{- end }} |
| 18 | +spec: |
| 19 | + {{- if .Values.wizUninstallJob.useJobTTL }} |
| 20 | + ttlSecondsAfterFinished: 60 |
| 21 | + {{- end }} |
| 22 | + manualSelector: true |
| 23 | + selector: |
| 24 | + matchLabels: |
| 25 | + {{- include "wiz-admission-controller-uninstall.selectorLabels" . | nindent 6 }} |
| 26 | + activeDeadlineSeconds: {{ .Values.wizUninstallJob.timeoutSeconds }} |
| 27 | + backoffLimit: 1 |
| 28 | + template: |
| 29 | + metadata: |
| 30 | + {{- if (or .Values.global.podAnnotations .Values.podAnnotations .Values.wizUninstallJob.podAnnotations)}} |
| 31 | + annotations: |
| 32 | + {{- with .Values.global.podAnnotations }} |
| 33 | + {{- toYaml . | nindent 8 }} |
| 34 | + {{- end }} |
| 35 | + {{- with .Values.podAnnotations }} |
| 36 | + {{- toYaml . | nindent 8 }} |
| 37 | + {{- end }} |
| 38 | + {{- with .Values.wizUninstallJob.podAnnotations }} |
| 39 | + {{- toYaml . | nindent 8 }} |
| 40 | + {{- end }} |
| 41 | + {{- end }} |
| 42 | + labels: |
| 43 | + wiz.io/component: "admission-controller-uninstall" |
| 44 | + {{- include "wiz-admission-controller-uninstall.labels" . | nindent 8 }} |
| 45 | + {{- with .Values.global.podLabels }} |
| 46 | + {{- toYaml . | nindent 8 }} |
| 47 | + {{- end }} |
| 48 | + {{- with .Values.podLabels }} |
| 49 | + {{- toYaml . | nindent 8 }} |
| 50 | + {{- end }} |
| 51 | + spec: |
| 52 | + {{- with .Values.wizUninstallJob.podAdditionalSpec }} |
| 53 | + {{- toYaml . | nindent 8 }} |
| 54 | + {{- end }} |
| 55 | + {{- with .Values.global.imagePullSecrets }} |
| 56 | + imagePullSecrets: |
| 57 | + {{- toYaml . | nindent 8 }} |
| 58 | + {{- end }} |
| 59 | + restartPolicy: "Never" |
| 60 | + securityContext: |
| 61 | + {{- if hasKey .Values.global "lowPrivilegePodSecurityPolicy" }} |
| 62 | + {{- toYaml .Values.global.lowPrivilegePodSecurityPolicy | nindent 8 }} |
| 63 | + {{- else }} |
| 64 | + {{- toYaml .Values.podSecurityContext | nindent 8 }} |
| 65 | + {{- end }} |
| 66 | + {{- if .Values.hostNetwork }} |
| 67 | + hostNetwork: true |
| 68 | + {{- end }} |
| 69 | + volumes: |
| 70 | + {{- include "wiz-admission-controller.spec.common.volumes" . | trim | nindent 8 }} |
| 71 | + {{- with .Values.customVolumes }} |
| 72 | + {{- toYaml . | nindent 8 }} |
| 73 | + {{- end }} |
| 74 | + {{- with .Values.global.customVolumes }} |
| 75 | + {{- toYaml . | nindent 8 }} |
| 76 | + {{- end }} |
| 77 | + containers: |
| 78 | + - name: {{ .Chart.Name }}-uninstall |
| 79 | + securityContext: |
| 80 | + {{- if hasKey .Values.global "lowPrivilegeSecurityPolicy" }} |
| 81 | + {{- toYaml .Values.global.lowPrivilegeSecurityPolicy | nindent 14 }} |
| 82 | + {{- else }} |
| 83 | + {{- toYaml .Values.securityContext | nindent 14 }} |
| 84 | + {{- end }} |
| 85 | + image: {{ include "wiz-admission-controller.image" . }} |
| 86 | + imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 87 | + command: |
| 88 | + - "/usr/bin/wiz-admission-controller" |
| 89 | + - "uninstall" |
| 90 | + {{- include "wiz-admission-controller.spec.common.commandArgs" . | trim | nindent 10 }} |
| 91 | + env: |
| 92 | + {{- include "wiz-admission-controller.spec.common.envVars" . | trim | nindent 10 }} |
| 93 | + resources: |
| 94 | + {{- include "wiz-admission-controller.resources" . | trim | nindent 12 }} |
| 95 | + volumeMounts: |
| 96 | + {{- include "wiz-admission-controller.spec.common.volumeMounts" . | trim | nindent 14 }} |
| 97 | + {{- if or .Values.customVolumeMounts .Values.global.customVolumeMounts }} |
| 98 | + {{- with .Values.customVolumeMounts }} |
| 99 | + {{- toYaml . | nindent 14 }} |
| 100 | + {{- end }} |
| 101 | + {{- with .Values.global.customVolumeMounts }} |
| 102 | + {{- toYaml . | nindent 14 }} |
| 103 | + {{- end }} |
| 104 | + {{- end }} |
| 105 | + {{- with (coalesce .Values.global.nodeSelector .Values.nodeSelector) }} |
| 106 | + nodeSelector: |
| 107 | + {{- toYaml . | nindent 8 }} |
| 108 | + {{- end }} |
| 109 | + {{- with (coalesce .Values.global.affinity .Values.affinity) }} |
| 110 | + affinity: |
| 111 | + {{- toYaml . | nindent 8 }} |
| 112 | + {{- end }} |
| 113 | + {{- if (or .Values.global.tolerations .Values.tolerations) }} |
| 114 | + tolerations: |
| 115 | + {{- with .Values.global.tolerations }} |
| 116 | + {{- toYaml . | nindent 8 }} |
| 117 | + {{- end }} |
| 118 | + {{- with .Values.tolerations }} |
| 119 | + {{- toYaml . | nindent 8 }} |
| 120 | + {{- end }} |
| 121 | + {{- end }} |
| 122 | +{{- end }} |
| 123 | + |
0 commit comments