2020-03-02 08:49:26 -06:00
|
|
|
{{- if and .Values.controller.admissionWebhooks.enabled .Values.controller.admissionWebhooks.patch.enabled -}}
|
2020-02-24 16:25:57 -03:00
|
|
|
apiVersion: batch/v1
|
|
|
|
|
kind: Job
|
|
|
|
|
metadata:
|
2020-03-03 21:53:23 -05:00
|
|
|
name: {{ include "ingress-nginx.fullname" . }}-admission-patch
|
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
|
|
|
|
|
labels:
|
2020-02-28 08:53:24 -06:00
|
|
|
{{- include "ingress-nginx.labels" . | nindent 4 }}
|
|
|
|
|
app.kubernetes.io/component: admission-webhook
|
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:
|
2020-03-03 21:53:23 -05:00
|
|
|
name: {{ include "ingress-nginx.fullname" . }}-admission-patch
|
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
|
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 }}
|
2021-05-23 11:07:38 -05: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
|
2020-03-03 21:53:23 -05:00
|
|
|
- --webhook-name={{ include "ingress-nginx.fullname" . }}-admission
|
2020-07-29 11:08:51 +02:00
|
|
|
- --namespace=$(POD_NAMESPACE)
|
2020-02-24 16:25:57 -03:00
|
|
|
- --patch-mutating=false
|
2020-03-03 21:53:23 -05:00
|
|
|
- --secret-name={{ include "ingress-nginx.fullname" . }}-admission
|
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
|
2020-02-24 16:25:57 -03:00
|
|
|
restartPolicy: OnFailure
|
2020-03-03 21:53:23 -05:00
|
|
|
serviceAccountName: {{ include "ingress-nginx.fullname" . }}-admission
|
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 }}
|
2020-02-24 16:25:57 -03:00
|
|
|
securityContext:
|
|
|
|
|
runAsNonRoot: true
|
2020-05-04 17:50:00 +00:00
|
|
|
runAsUser: {{ .Values.controller.admissionWebhooks.patch.runAsUser }}
|
2020-05-19 12:58:57 +07:00
|
|
|
{{- end }}
|