2022-12-07 13:16:38 +01:00
{{- if and .Values.controller.admissionWebhooks.enabled .Values.controller.admissionWebhooks.patch.enabled (not .Values.controller.admissionWebhooks.certManager.enabled) -}}
2020-02-24 16:25:57 -03:00
apiVersion : batch/v1
kind : Job
metadata :
2023-10-29 18:26:05 +01:00
name : {{ include "ingress-nginx.admissionWebhooks.patchWebhookJob.fullname" . }}
2023-10-25 01:53:46 +08:00
namespace : {{ include "ingress-nginx.namespace" . }}
2020-02-24 16:25:57 -03:00
annotations :
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
2021-11-29 18:33:22 +07:00
{{- with .Values.controller.admissionWebhooks.annotations }}
2021-12-07 14:26:37 -05:00
{{- toYaml . | nindent 4 }}
2021-11-29 18:33:22 +07:00
{{- end }}
2020-02-24 16:25:57 -03:00
labels :
2020-02-28 08:53:24 -06:00
{{- include "ingress-nginx.labels" . | nindent 4 }}
app.kubernetes.io/component : admission-webhook
2021-11-19 15:52:52 +01:00
{{- with .Values.controller.admissionWebhooks.patch.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
2020-02-24 16:25:57 -03:00
spec :
2020-03-02 08:49:26 -06:00
{{- if .Capabilities.APIVersions.Has "batch/v1alpha1" }}
2020-02-24 16:25:57 -03:00
# Alpha feature since k8s 1.12
ttlSecondsAfterFinished : 0
2020-03-02 08:49:26 -06:00
{{- end }}
2020-02-24 16:25:57 -03:00
template :
metadata :
2023-10-29 18:26:05 +01:00
name : {{ include "ingress-nginx.admissionWebhooks.patchWebhookJob.fullname" . }}
2020-03-02 08:49:26 -06:00
{{- if .Values.controller.admissionWebhooks.patch.podAnnotations }}
annotations : {{ toYaml .Values.controller.admissionWebhooks.patch.podAnnotations | nindent 8 }}
{{- end }}
2020-02-24 16:25:57 -03:00
labels :
2020-02-28 08:53:24 -06:00
{{- include "ingress-nginx.labels" . | nindent 8 }}
app.kubernetes.io/component : admission-webhook
2021-11-19 15:52:52 +01:00
{{- with .Values.controller.admissionWebhooks.patch.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
2020-02-24 16:25:57 -03:00
spec :
2020-03-02 08:49:26 -06:00
{{- if .Values.controller.admissionWebhooks.patch.priorityClassName }}
2020-02-24 16:25:57 -03:00
priorityClassName : {{ .Values.controller.admissionWebhooks.patch.priorityClassName }}
2020-05-04 17:46:27 +00:00
{{- end }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets : {{ toYaml .Values.imagePullSecrets | nindent 8 }}
2020-03-02 08:49:26 -06:00
{{- end }}
2020-02-24 16:25:57 -03:00
containers :
- name : patch
2020-05-20 11:34:18 -04:00
{{- with .Values.controller.admissionWebhooks.patch.image }}
2023-12-05 17:22:12 +01:00
image : {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{ end }}:{{ .tag }}{{ if .digest }}@{{ .digest }}{{ end }}
2020-05-20 11:34:18 -04:00
{{- end }}
2020-05-04 13:48:05 -04:00
imagePullPolicy : {{ .Values.controller.admissionWebhooks.patch.image.pullPolicy }}
2020-02-24 16:25:57 -03:00
args :
- patch
2023-10-29 18:26:05 +01:00
- --webhook-name={{ include "ingress-nginx.admissionWebhooks.fullname" . }}
2020-07-29 11:08:51 +02:00
- --namespace=$(POD_NAMESPACE)
2020-02-24 16:25:57 -03:00
- --patch-mutating=false
2023-10-29 18:26:05 +01:00
- --secret-name={{ include "ingress-nginx.admissionWebhooks.fullname" . }}
2020-02-24 16:25:57 -03:00
- --patch-failure-policy={{ .Values.controller.admissionWebhooks.failurePolicy }}
2020-07-29 11:08:51 +02:00
env :
- name : POD_NAMESPACE
valueFrom :
fieldRef :
fieldPath : metadata.namespace
2022-06-21 22:16:26 +08:00
{{- if .Values.controller.admissionWebhooks.extraEnvs }}
{{- toYaml .Values.controller.admissionWebhooks.extraEnvs | nindent 12 }}
{{- end }}
2022-10-25 23:14:36 +02:00
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.securityContext }}
securityContext : {{ toYaml .Values.controller.admissionWebhooks.patchWebhookJob.securityContext | nindent 12 }}
{{- end }}
2021-08-06 04:01:41 +05:30
{{- if .Values.controller.admissionWebhooks.patchWebhookJob.resources }}
resources : {{ toYaml .Values.controller.admissionWebhooks.patchWebhookJob.resources | nindent 12 }}
{{- end }}
2020-02-24 16:25:57 -03:00
restartPolicy : OnFailure
2024-06-03 14:47:23 +05:30
serviceAccountName : {{ include "ingress-nginx.admissionWebhooks.patch.serviceAccountName" . }}
2020-03-02 08:49:26 -06:00
{{- if .Values.controller.admissionWebhooks.patch.nodeSelector }}
nodeSelector : {{ toYaml .Values.controller.admissionWebhooks.patch.nodeSelector | nindent 8 }}
2020-05-19 12:58:57 +07:00
{{- end }}
{{- if .Values.controller.admissionWebhooks.patch.tolerations }}
tolerations : {{ toYaml .Values.controller.admissionWebhooks.patch.tolerations | nindent 8 }}
2020-03-02 08:49:26 -06:00
{{- end }}
2023-11-07 18:52:36 +01:00
{{- if .Values.controller.admissionWebhooks.patch.securityContext }}
securityContext : {{ toYaml .Values.controller.admissionWebhooks.patch.securityContext | nindent 8 }}
{{- end }}
2020-05-19 12:58:57 +07:00
{{- end }}