2020-03-02 14:49:26 +00:00
{{- if or (eq .Values.controller.kind "Deployment") (eq .Values.controller.kind "Both") -}}
2020-02-24 19:25:57 +00:00
apiVersion : {{ template "deployment.apiVersion" . }}
kind : Deployment
metadata :
labels :
2020-02-28 14:53:24 +00:00
{{- include "ingress-nginx.labels" . | nindent 4 }}
2020-03-04 02:53:23 +00:00
app.kubernetes.io/component : controller
name : {{ include "ingress-nginx.controller.fullname" . }}
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.deploymentAnnotations }}
annotations : {{ toYaml .Values.controller.deploymentAnnotations | nindent 4 }}
{{- end }}
2020-02-24 19:25:57 +00:00
spec :
selector :
matchLabels :
2020-02-28 14:53:24 +00:00
{{- include "ingress-nginx.selectorLabels" . | nindent 6 }}
2020-03-04 02:53:23 +00:00
app.kubernetes.io/component : controller
2020-02-24 19:25:57 +00:00
{{- if not .Values.controller.autoscaling.enabled }}
replicas : {{ .Values.controller.replicaCount }}
{{- end }}
revisionHistoryLimit : {{ .Values.revisionHistoryLimit }}
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.updateStrategy }}
strategy : {{ toYaml .Values.controller.updateStrategy | nindent 4 }}
{{- end }}
2020-02-24 19:25:57 +00:00
minReadySeconds : {{ .Values.controller.minReadySeconds }}
template :
metadata :
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.podAnnotations }}
annotations : {{ toYaml .Values.controller.podAnnotations | nindent 8 }}
{{- end }}
2020-02-24 19:25:57 +00:00
labels :
2020-02-28 14:53:24 +00:00
{{- include "ingress-nginx.selectorLabels" . | nindent 8 }}
2020-03-04 02:53:23 +00:00
app.kubernetes.io/component : controller
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.podLabels }}
{{- toYaml .Values.controller.podLabels | nindent 8 }}
{{- end }}
2020-02-24 19:25:57 +00:00
spec :
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.dnsConfig }}
dnsConfig : {{ toYaml .Values.controller.dnsConfig | nindent 8 }}
{{- end }}
2020-02-24 19:25:57 +00:00
dnsPolicy : {{ .Values.controller.dnsPolicy }}
2020-03-02 14:49:26 +00:00
{{- if .Values.imagePullSecrets }}
imagePullSecrets : {{ toYaml .Values.imagePullSecrets | nindent 8 }}
{{- end }}
{{- if .Values.controller.priorityClassName }}
priorityClassName : {{ .Values.controller.priorityClassName }}
{{- end }}
{{- if .Values.controller.podSecurityContext }}
securityContext : {{ toYaml .Values.controller.podSecurityContext | nindent 8 }}
{{- end }}
2020-02-24 19:25:57 +00:00
containers :
2020-02-28 14:53:24 +00:00
- name : {{ template "ingress-nginx.name" . }}-{{ .Values.controller.name }}
2020-03-02 14:49:26 +00:00
image : {{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag }}
imagePullPolicy : {{ .Values.controller.image.pullPolicy }}
{{- if .Values.controller.lifecycle }}
lifecycle : {{ toYaml .Values.controller.lifecycle | nindent 12 }}
{{- end }}
2020-02-24 19:25:57 +00:00
args :
- /nginx-ingress-controller
{{- if .Values.defaultBackend.enabled }}
2020-03-04 02:53:23 +00:00
- --default-backend-service={{ .Release.Namespace }}/{{ include "ingress-nginx.defaultBackend.fullname" . }}
2020-02-24 19:25:57 +00:00
{{- else }}
{{- if (semverCompare "<0.21.0" .Values.controller.image.tag) }}
- --default-backend-service={{ required ".Values.controller.defaultBackendService is required if .Values.defaultBackend.enabled=false and .Values.controller.image.tag < 0.21.0" .Values.controller.defaultBackendService }}
{{- else if .Values.controller.defaultBackendService }}
- --default-backend-service={{ .Values.controller.defaultBackendService }}
{{- end }}
{{- end }}
{{- if and (semverCompare ">=0.9.0-beta.1" .Values.controller.image.tag) .Values.controller.publishService.enabled }}
2020-02-28 14:53:24 +00:00
- --publish-service={{ template "ingress-nginx.controller.publishServicePath" . }}
2020-02-24 19:25:57 +00:00
{{- end }}
{{- if (semverCompare ">=0.9.0-beta.1" .Values.controller.image.tag) }}
- --election-id={{ .Values.controller.electionID }}
{{- end }}
{{- if (semverCompare ">=0.9.0-beta.1" .Values.controller.image.tag) }}
- --ingress-class={{ .Values.controller.ingressClass }}
{{- end }}
{{- if (semverCompare ">=0.9.0-beta.1" .Values.controller.image.tag) }}
2020-03-04 02:53:23 +00:00
- --configmap={{ default .Release.Namespace .Values.controller.configMapNamespace }}/{{ include "ingress-nginx.controller.fullname" . }}
2020-02-24 19:25:57 +00:00
{{- else }}
2020-03-04 02:53:23 +00:00
- --nginx-configmap={{ default .Release.Namespace .Values.controller.configMapNamespace }}/{{ include "ingress-nginx.controller.fullname" . }}
2020-02-24 19:25:57 +00:00
{{- end }}
{{- if .Values.tcp }}
2020-02-28 14:53:24 +00:00
- --tcp-services-configmap={{ default .Release.Namespace .Values.controller.tcp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-tcp
2020-02-24 19:25:57 +00:00
{{- end }}
{{- if .Values.udp }}
2020-02-28 14:53:24 +00:00
- --udp-services-configmap={{ default .Release.Namespace .Values.controller.udp.configMapNamespace }}/{{ include "ingress-nginx.fullname" . }}-udp
2020-02-24 19:25:57 +00:00
{{- end }}
{{- if .Values.controller.scope.enabled }}
- --watch-namespace={{ default .Release.Namespace .Values.controller.scope.namespace }}
{{- end }}
2020-03-02 14:49:26 +00:00
{{- if and .Values.controller.reportNodeInternalIp .Values.controller.hostNetwork }}
2020-02-24 19:25:57 +00:00
- --report-node-internal-ip-address={{ .Values.controller.reportNodeInternalIp }}
{{- end }}
{{- if .Values.controller.admissionWebhooks.enabled }}
- --validating-webhook=:{{ .Values.controller.admissionWebhooks.port }}
- --validating-webhook-certificate=/usr/local/certificates/cert
- --validating-webhook-key=/usr/local/certificates/key
{{- end }}
{{- if .Values.controller.maxmindLicenseKey }}
- --maxmind-license-key={{ .Values.controller.maxmindLicenseKey }}
{{- end }}
{{- range $key, $value := .Values.controller.extraArgs }}
{{- if $value }}
- --{{ $key }}={{ $value }}
{{- else }}
- --{{ $key }}
{{- end }}
{{- end }}
2020-03-02 14:49:26 +00:00
{{- if (semverCompare ">=0.16.0" .Values.controller.image.tag) }}
2020-02-24 19:25:57 +00:00
securityContext :
capabilities :
drop :
- ALL
add :
- NET_BIND_SERVICE
runAsUser : {{ .Values.controller.image.runAsUser }}
allowPrivilegeEscalation : {{ .Values.controller.image.allowPrivilegeEscalation }}
2020-03-02 14:49:26 +00:00
{{- end }}
2020-02-24 19:25:57 +00:00
env :
- name : POD_NAME
valueFrom :
fieldRef :
fieldPath : metadata.name
- name : POD_NAMESPACE
valueFrom :
fieldRef :
fieldPath : metadata.namespace
{{- if .Values.controller.extraEnvs }}
2020-03-02 14:49:26 +00:00
{{- toYaml .Values.controller.extraEnvs | nindent 12 }}
2020-02-24 19:25:57 +00:00
{{- end }}
livenessProbe :
httpGet :
path : /healthz
port : {{ .Values.controller.livenessProbe.port }}
scheme : HTTP
initialDelaySeconds : {{ .Values.controller.livenessProbe.initialDelaySeconds }}
periodSeconds : {{ .Values.controller.livenessProbe.periodSeconds }}
timeoutSeconds : {{ .Values.controller.livenessProbe.timeoutSeconds }}
successThreshold : {{ .Values.controller.livenessProbe.successThreshold }}
failureThreshold : {{ .Values.controller.livenessProbe.failureThreshold }}
2020-03-02 14:49:26 +00:00
readinessProbe :
httpGet :
path : /healthz
port : {{ .Values.controller.readinessProbe.port }}
scheme : HTTP
initialDelaySeconds : {{ .Values.controller.readinessProbe.initialDelaySeconds }}
periodSeconds : {{ .Values.controller.readinessProbe.periodSeconds }}
timeoutSeconds : {{ .Values.controller.readinessProbe.timeoutSeconds }}
successThreshold : {{ .Values.controller.readinessProbe.successThreshold }}
failureThreshold : {{ .Values.controller.readinessProbe.failureThreshold }}
2020-02-24 19:25:57 +00:00
ports :
{{- range $key, $value := .Values.controller.containerPort }}
- name : {{ $key }}
containerPort : {{ $value }}
protocol : TCP
{{- end }}
{{- if .Values.controller.metrics.enabled }}
- name : metrics
containerPort : {{ .Values.controller.metrics.port }}
protocol : TCP
{{- end }}
{{- if .Values.controller.admissionWebhooks.enabled }}
- name : webhook
containerPort : {{ .Values.controller.admissionWebhooks.port }}
protocol : TCP
{{- end }}
{{- range $key, $value := .Values.tcp }}
2020-03-02 14:49:26 +00:00
- name : {{ $key }}-tcp
2020-02-24 19:25:57 +00:00
containerPort : {{ $key }}
protocol : TCP
{{- end }}
{{- range $key, $value := .Values.udp }}
2020-03-02 14:49:26 +00:00
- name : {{ $key }}-udp
2020-02-24 19:25:57 +00:00
containerPort : {{ $key }}
protocol : UDP
{{- end }}
2020-03-02 14:49:26 +00:00
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled) }}
2020-02-24 19:25:57 +00:00
volumeMounts :
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.customTemplate.configMapName }}
2020-02-24 19:25:57 +00:00
- mountPath : /etc/nginx/template
name : nginx-template-volume
readOnly : true
2020-03-02 14:49:26 +00:00
{{- end }}
{{- if .Values.controller.admissionWebhooks.enabled }}
2020-02-24 19:25:57 +00:00
- name : webhook-cert
2020-03-02 14:49:26 +00:00
mountPath : /usr/local/certificates/
2020-02-24 19:25:57 +00:00
readOnly : true
2020-03-02 14:49:26 +00:00
{{- end }}
{{- if .Values.controller.extraVolumeMounts }}
{{- toYaml .Values.controller.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.controller.resources }}
resources : {{ toYaml .Values.controller.resources | nindent 12 }}
{{- end }}
{{- if .Values.controller.extraContainers }}
{{ toYaml .Values.controller.extraContainers | nindent 8 }}
{{- end }}
{{- if .Values.controller.extraInitContainers }}
initContainers : {{ toYaml .Values.controller.extraInitContainers | nindent 8 }}
{{- end }}
{{- if .Values.controller.hostNetwork }}
2020-02-24 19:25:57 +00:00
hostNetwork : {{ .Values.controller.hostNetwork }}
2020-03-02 14:49:26 +00:00
{{- end }}
2020-02-24 19:25:57 +00:00
{{- if .Values.controller.nodeSelector }}
2020-03-02 14:49:26 +00:00
nodeSelector : {{ toYaml .Values.controller.nodeSelector | nindent 8 }}
2020-02-24 19:25:57 +00:00
{{- end }}
{{- if .Values.controller.tolerations }}
2020-03-02 14:49:26 +00:00
tolerations : {{ toYaml .Values.controller.tolerations | nindent 8 }}
2020-02-24 19:25:57 +00:00
{{- end }}
{{- if .Values.controller.affinity }}
2020-03-02 14:49:26 +00:00
affinity : {{ toYaml .Values.controller.affinity | nindent 8 }}
2020-02-24 19:25:57 +00:00
{{- end }}
2020-02-28 14:53:24 +00:00
serviceAccountName : {{ template "ingress-nginx.serviceAccountName" . }}
2020-02-24 19:25:57 +00:00
terminationGracePeriodSeconds : {{ .Values.controller.terminationGracePeriodSeconds }}
2020-03-02 14:49:26 +00:00
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled .Values.controller.extraVolumes) }}
2020-02-24 19:25:57 +00:00
volumes :
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.customTemplate.configMapName }}
2020-02-24 19:25:57 +00:00
- name : nginx-template-volume
configMap :
name : {{ .Values.controller.customTemplate.configMapName }}
items :
- key : {{ .Values.controller.customTemplate.configMapKey }}
path : nginx.tmpl
2020-03-02 14:49:26 +00:00
{{- end }}
{{- if .Values.controller.admissionWebhooks.enabled }}
2020-02-24 19:25:57 +00:00
- name : webhook-cert
secret :
2020-03-04 02:53:23 +00:00
secretName : {{ include "ingress-nginx.fullname" . }}-admission
2020-03-02 14:49:26 +00:00
{{- end }}
{{- if .Values.controller.extraVolumes }}
{{ toYaml .Values.controller.extraVolumes | nindent 8 }}
{{- end }}
{{- end }}
2020-02-24 19:25:57 +00:00
{{- end }}