2023-10-12 17:51:40 +00:00
|
|
|
{{- if eq .Values.controller.kind "Deployment" -}}
|
2020-04-06 23:01:52 +00:00
|
|
|
apiVersion: apps/v1
|
2020-02-24 19:25:57 +00:00
|
|
|
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
|
2020-08-31 20:14:44 +00:00
|
|
|
{{- with .Values.controller.labels }}
|
|
|
|
{{- toYaml . | nindent 4 }}
|
|
|
|
{{- end }}
|
2020-03-04 02:53:23 +00:00
|
|
|
name: {{ include "ingress-nginx.controller.fullname" . }}
|
2023-10-24 17:53:46 +00:00
|
|
|
namespace: {{ include "ingress-nginx.namespace" . }}
|
2020-04-06 23:01:52 +00:00
|
|
|
{{- if .Values.controller.annotations }}
|
|
|
|
annotations: {{ toYaml .Values.controller.annotations | 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
|
2024-03-12 13:43:51 +00:00
|
|
|
{{- if eq .Values.controller.autoscaling.enabled .Values.controller.keda.enabled }}
|
2020-02-24 19:25:57 +00:00
|
|
|
replicas: {{ .Values.controller.replicaCount }}
|
2020-04-06 23:01:52 +00:00
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
2024-09-27 10:14:01 +00:00
|
|
|
{{- if .Values.controller.progressDeadlineSeconds }}
|
|
|
|
progressDeadlineSeconds: {{ .Values.controller.progressDeadlineSeconds }}
|
|
|
|
{{- end }}
|
2020-04-06 23:01:52 +00:00
|
|
|
{{- if .Values.controller.updateStrategy }}
|
2023-09-10 14:20:09 +00:00
|
|
|
strategy: {{ toYaml .Values.controller.updateStrategy | nindent 4 }}
|
2020-04-06 23:01:52 +00:00
|
|
|
{{- 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 }}
|
2021-04-13 11:48:34 +00:00
|
|
|
annotations:
|
2020-10-11 10:14:36 +00:00
|
|
|
{{- range $key, $value := .Values.controller.podAnnotations }}
|
|
|
|
{{ $key }}: {{ $value | quote }}
|
|
|
|
{{- end }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
labels:
|
2023-03-14 13:44:17 +00:00
|
|
|
{{- include "ingress-nginx.labels" . | nindent 8 }}
|
2020-03-04 02:53:23 +00:00
|
|
|
app.kubernetes.io/component: controller
|
2021-11-19 14:52:52 +00:00
|
|
|
{{- with .Values.controller.labels }}
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
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 }}
|
2023-07-28 11:41:56 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.hostAliases }}
|
|
|
|
hostAliases: {{ tpl (toYaml .Values.controller.hostAliases) $ | nindent 8 }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- end }}
|
2021-08-09 13:45:31 +00:00
|
|
|
{{- if .Values.controller.hostname }}
|
|
|
|
hostname: {{ toYaml .Values.controller.hostname | 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 }}
|
2021-10-24 22:28:21 +00:00
|
|
|
priorityClassName: {{ .Values.controller.priorityClassName | quote }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- end }}
|
2020-06-12 07:45:55 +00:00
|
|
|
{{- if or .Values.controller.podSecurityContext .Values.controller.sysctls }}
|
|
|
|
securityContext:
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- if .Values.controller.podSecurityContext }}
|
2020-06-12 07:45:55 +00:00
|
|
|
{{- toYaml .Values.controller.podSecurityContext | nindent 8 }}
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.sysctls }}
|
2020-06-12 07:45:55 +00:00
|
|
|
sysctls:
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- range $sysctl, $value := .Values.controller.sysctls }}
|
|
|
|
- name: {{ $sysctl | quote }}
|
|
|
|
value: {{ $value | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2022-03-14 15:51:57 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.shareProcessNamespace }}
|
|
|
|
shareProcessNamespace: {{ .Values.controller.shareProcessNamespace }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
containers:
|
2021-04-13 11:48:34 +00:00
|
|
|
- name: {{ .Values.controller.containerName }}
|
2024-09-30 08:26:04 +00:00
|
|
|
{{- with (merge .Values.controller.image .Values.global.image) }}
|
2023-12-05 16:22:12 +00:00
|
|
|
image: {{ if .repository }}{{ .repository }}{{ else }}{{ .registry }}/{{ include "ingress-nginx.image" . }}{{ end }}:{{ .tag }}{{ include "ingress-nginx.imageDigest" . }}
|
2020-05-20 15:34:18 +00:00
|
|
|
{{- end }}
|
2020-03-02 14:49:26 +00:00
|
|
|
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
|
|
|
|
{{- if .Values.controller.lifecycle }}
|
|
|
|
lifecycle: {{ toYaml .Values.controller.lifecycle | nindent 12 }}
|
|
|
|
{{- end }}
|
2023-11-07 17:52:36 +00:00
|
|
|
args: {{ include "ingress-nginx.params" . | nindent 12 }}
|
|
|
|
securityContext: {{ include "ingress-nginx.controller.containerSecurityContext" . | nindent 12 }}
|
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
|
2020-04-06 16:34:19 +00:00
|
|
|
{{- if .Values.controller.enableMimalloc }}
|
|
|
|
- name: LD_PRELOAD
|
|
|
|
value: /usr/local/lib/libmimalloc.so
|
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- if .Values.controller.extraEnvs }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- toYaml .Values.controller.extraEnvs | nindent 12 }}
|
2021-08-21 20:42:00 +00:00
|
|
|
{{- end }}
|
2021-05-18 13:37:31 +00:00
|
|
|
{{- if .Values.controller.startupProbe }}
|
|
|
|
startupProbe: {{ toYaml .Values.controller.startupProbe | nindent 12 }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- end }}
|
2022-11-08 14:44:25 +00:00
|
|
|
{{- if .Values.controller.livenessProbe }}
|
2021-05-18 13:37:31 +00:00
|
|
|
livenessProbe: {{ toYaml .Values.controller.livenessProbe | nindent 12 }}
|
2022-11-08 14:44:25 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.readinessProbe }}
|
2021-05-18 13:37:31 +00:00
|
|
|
readinessProbe: {{ toYaml .Values.controller.readinessProbe | nindent 12 }}
|
2022-11-08 14:44:25 +00:00
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
ports:
|
|
|
|
{{- range $key, $value := .Values.controller.containerPort }}
|
|
|
|
- name: {{ $key }}
|
|
|
|
containerPort: {{ $value }}
|
|
|
|
protocol: TCP
|
2020-04-06 23:01:52 +00:00
|
|
|
{{- if $.Values.controller.hostPort.enabled }}
|
|
|
|
hostPort: {{ index $.Values.controller.hostPort.ports $key | default $value }}
|
2020-03-14 21:24:46 +00:00
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.metrics.enabled }}
|
2022-09-12 19:34:40 +00:00
|
|
|
- name: {{ .Values.controller.metrics.portName }}
|
2020-02-24 19:25:57 +00:00
|
|
|
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 }}
|
2022-05-10 16:13:43 +00:00
|
|
|
- name: {{ if $.Values.portNamePrefix }}{{ $.Values.portNamePrefix }}-{{ end }}{{ $key }}-tcp
|
2020-02-24 19:25:57 +00:00
|
|
|
containerPort: {{ $key }}
|
|
|
|
protocol: TCP
|
2020-04-06 23:01:52 +00:00
|
|
|
{{- if $.Values.controller.hostPort.enabled }}
|
|
|
|
hostPort: {{ $key }}
|
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- range $key, $value := .Values.udp }}
|
2022-05-10 16:13:43 +00:00
|
|
|
- name: {{ if $.Values.portNamePrefix }}{{ $.Values.portNamePrefix }}-{{ end }}{{ $key }}-udp
|
2020-02-24 19:25:57 +00:00
|
|
|
containerPort: {{ $key }}
|
|
|
|
protocol: UDP
|
2020-04-06 23:01:52 +00:00
|
|
|
{{- if $.Values.controller.hostPort.enabled }}
|
|
|
|
hostPort: {{ $key }}
|
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- end }}
|
2024-09-29 15:31:04 +00:00
|
|
|
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled .Values.controller.extraModules) }}
|
2020-02-24 19:25:57 +00:00
|
|
|
volumeMounts:
|
2024-09-29 15:31:04 +00:00
|
|
|
{{- if .Values.controller.extraModules }}
|
2022-01-16 21:33:28 +00:00
|
|
|
- name: modules
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- if .Values.controller.image.chroot }}
|
2022-09-28 21:02:30 +00:00
|
|
|
mountPath: /chroot/modules_mount
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- else }}
|
2022-01-16 21:33:28 +00:00
|
|
|
mountPath: /modules_mount
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- end }}
|
2022-01-16 21:33:28 +00:00
|
|
|
{{- end }}
|
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 }}
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- toYaml .Values.controller.extraContainers | nindent 8 }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- end }}
|
2024-09-29 15:31:04 +00:00
|
|
|
{{- if (or .Values.controller.extraInitContainers .Values.controller.extraModules) }}
|
2022-01-16 21:33:28 +00:00
|
|
|
initContainers:
|
|
|
|
{{- if .Values.controller.extraInitContainers }}
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- toYaml .Values.controller.extraInitContainers | nindent 8 }}
|
2022-01-16 21:33:28 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.extraModules }}
|
|
|
|
{{- range .Values.controller.extraModules }}
|
2023-09-10 14:20:09 +00:00
|
|
|
{{- $containerSecurityContext := .containerSecurityContext | default $.Values.controller.containerSecurityContext }}
|
2024-09-30 08:26:04 +00:00
|
|
|
{{- include "extraModules" (dict "name" .name "image" (merge .image $.Values.global.image) "containerSecurityContext" $containerSecurityContext "resources" .resources) | nindent 8 }}
|
2023-11-07 17:52:36 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- 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 }}
|
2024-06-14 09:13:44 +00:00
|
|
|
affinity: {{ tpl (toYaml .Values.controller.affinity) $ | nindent 8 }}
|
2020-09-11 06:55:34 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.topologySpreadConstraints }}
|
2023-09-10 12:38:10 +00:00
|
|
|
topologySpreadConstraints: {{ tpl (toYaml .Values.controller.topologySpreadConstraints) $ | nindent 8 }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- end }}
|
2020-02-28 14:53:24 +00:00
|
|
|
serviceAccountName: {{ template "ingress-nginx.serviceAccountName" . }}
|
2024-10-29 20:55:25 +00:00
|
|
|
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
|
2020-02-24 19:25:57 +00:00
|
|
|
terminationGracePeriodSeconds: {{ .Values.controller.terminationGracePeriodSeconds }}
|
2024-09-29 15:31:04 +00:00
|
|
|
{{- if (or .Values.controller.customTemplate.configMapName .Values.controller.extraVolumeMounts .Values.controller.admissionWebhooks.enabled .Values.controller.extraVolumes .Values.controller.extraModules) }}
|
2020-02-24 19:25:57 +00:00
|
|
|
volumes:
|
2024-09-29 15:31:04 +00:00
|
|
|
{{- if .Values.controller.extraModules }}
|
2022-01-16 21:33:28 +00:00
|
|
|
- name: modules
|
|
|
|
emptyDir: {}
|
|
|
|
{{- end }}
|
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:
|
2023-10-29 17:26:05 +00:00
|
|
|
secretName: {{ include "ingress-nginx.admissionWebhooks.fullname" . }}
|
2022-12-07 12:16:38 +00:00
|
|
|
{{- if .Values.controller.admissionWebhooks.certManager.enabled }}
|
|
|
|
items:
|
|
|
|
- key: tls.crt
|
|
|
|
path: cert
|
|
|
|
- key: tls.key
|
|
|
|
path: key
|
|
|
|
{{- end }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.controller.extraVolumes }}
|
|
|
|
{{ toYaml .Values.controller.extraVolumes | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2021-06-21 11:56:51 +00:00
|
|
|
{{- end }}
|