ingress-nginx-helm/charts/ingress-nginx/templates/admission-webhooks/job-patch/job-createSecret.yaml

65 lines
3 KiB
YAML
Raw Normal View History

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:
name: {{ include "ingress-nginx.fullname" . }}-admission-create
namespace: {{ .Release.Namespace }}
2020-02-24 16:25:57 -03:00
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
labels:
{{- 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:
name: {{ include "ingress-nginx.fullname" . }}-admission-create
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:
{{- 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 }}
{{- 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: create
{{- with .Values.controller.admissionWebhooks.patch.image }}
image: "{{- if .repository -}}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{- end -}}:{{ .tag }}{{- if (.digest) -}} @{{.digest}} {{- end -}}"
{{- end }}
2020-02-24 16:25:57 -03:00
imagePullPolicy: {{ .Values.controller.admissionWebhooks.patch.image.pullPolicy }}
args:
- create
- --host={{ include "ingress-nginx.controller.fullname" . }}-admission,{{ include "ingress-nginx.controller.fullname" . }}-admission.$(POD_NAMESPACE).svc
- --namespace=$(POD_NAMESPACE)
- --secret-name={{ include "ingress-nginx.fullname" . }}-admission
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.controller.admissionWebhooks.createSecretJob.resources }}
resources: {{ toYaml .Values.controller.admissionWebhooks.createSecretJob.resources | nindent 12 }}
{{- end }}
2020-02-24 16:25:57 -03:00
restartPolicy: OnFailure
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 }}
{{- 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
runAsUser: {{ .Values.controller.admissionWebhooks.patch.runAsUser }}
2020-02-24 16:25:57 -03:00
{{- end }}