mirror of
https://github.com/wahyd4/charts.git
synced 2026-08-29 06:55:57 +10:00
* add support for Nginx Ingress Controller 1.x * update Chart version and Readme * fix linter Co-authored-by: Peter Jakubis <peter.jakubis@piano.io>
212 lines
10 KiB
YAML
212 lines
10 KiB
YAML
{{- if eq .Values.kind "Deployment" }}
|
|
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ template "common.names.fullname" . }}
|
|
namespace: {{ .Release.Namespace | quote }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
app.kubernetes.io/component: controller
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.commonAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
selector:
|
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
|
app.kubernetes.io/component: controller
|
|
{{- if not .Values.autoscaling.enabled }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
{{- end }}
|
|
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
|
{{- if .Values.updateStrategy }}
|
|
strategy: {{- toYaml .Values.updateStrategy | nindent 4 }}
|
|
{{- end }}
|
|
minReadySeconds: {{ .Values.minReadySeconds }}
|
|
template:
|
|
metadata:
|
|
{{- if .Values.podAnnotations }}
|
|
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
|
app.kubernetes.io/component: controller
|
|
{{- if .Values.podLabels }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- include "nginx-ingress-controller.imagePullSecrets" . | nindent 6 }}
|
|
dnsPolicy: {{ .Values.dnsPolicy }}
|
|
{{- if .Values.priorityClassName }}
|
|
priorityClassName: {{ .Values.priorityClassName | quote }}
|
|
{{- end }}
|
|
{{- if .Values.hostAliases }}
|
|
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.affinity }}
|
|
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }}
|
|
{{- else }}
|
|
affinity:
|
|
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "controller" "context" $) | nindent 10 }}
|
|
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "controller" "context" $) | nindent 10 }}
|
|
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.nodeSelector }}
|
|
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.podSecurityContext.enabled }}
|
|
securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
|
|
{{- end }}
|
|
hostNetwork: {{ .Values.hostNetwork }}
|
|
{{- if .Values.topologySpreadConstraints }}
|
|
topologySpreadConstraints: {{- toYaml .Values.topologySpreadConstraints | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ template "nginx-ingress-controller.serviceAccountName" . }}
|
|
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
|
|
{{- if .Values.initContainers }}
|
|
initContainers: {{- toYaml .Values.initContainers | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: controller
|
|
image: {{ include "nginx-ingress-controller.image" . }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
|
{{- if .Values.containerSecurityContext.enabled }}
|
|
# yamllint disable rule:indentation
|
|
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
|
|
# yamllint enable rule:indentation
|
|
{{- end }}
|
|
{{- if .Values.lifecycle }}
|
|
lifecycle: {{- toYaml .Values.lifecycle | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.command }}
|
|
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.args }}
|
|
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
|
|
{{- else }}
|
|
args:
|
|
- /nginx-ingress-controller
|
|
- --default-backend-service={{ if .Values.defaultBackend.enabled }}{{ .Release.Namespace }}/{{ include "nginx-ingress-controller.defaultBackend.fullname" . }}{{ else }}{{ .Values.defaultBackendService }}{{ end }}
|
|
{{- if .Values.publishService.enabled }}
|
|
- --publish-service={{ include "nginx-ingress-controller.publishServicePath" . }}
|
|
{{- end }}
|
|
- --election-id={{ .Values.electionID }}
|
|
- --controller-class={{ .Values.ingressClassResource.controllerClass }}
|
|
- --configmap={{ default .Release.Namespace .Values.configMapNamespace }}/{{ include "common.names.fullname" . }}
|
|
{{- if .Values.tcp }}
|
|
- --tcp-services-configmap={{ default .Release.Namespace .Values.tcpConfigMapNamespace }}/{{ include "common.names.fullname" . }}-tcp
|
|
{{- end }}
|
|
{{- if .Values.udp }}
|
|
- --udp-services-configmap={{ default .Release.Namespace .Values.udpConfigMapNamespace }}/{{ include "common.names.fullname" . }}-udp
|
|
{{- end }}
|
|
{{- if .Values.scope.enabled }}
|
|
- --watch-namespace={{ default .Release.Namespace .Values.scope.namespace }}
|
|
{{- end }}
|
|
{{- if .Values.maxmindLicenseKey }}
|
|
- --maxmind-license-key={{ .Values.maxmindLicenseKey }}
|
|
{{- end }}
|
|
{{- if and (.Values.reportNodeInternalIp) (.Values.hostNetwork) }}
|
|
- --report-node-internal-ip-address={{ .Values.reportNodeInternalIp }}
|
|
{{- end }}
|
|
{{- if .Values.watchIngressWithoutClass }}
|
|
- --watch-ingress-without-class=true
|
|
{{- end }}
|
|
{{- range $key, $value := .Values.extraArgs }}
|
|
{{- if $value }}
|
|
- --{{ $key }}={{ $value }}
|
|
{{- else }}
|
|
- --{{ $key }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
env:
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
{{- if .Values.extraEnvVars }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if or .Values.extraEnvVarsCM .Values.extraEnvVarsSecret }}
|
|
envFrom:
|
|
{{- if .Values.extraEnvVarsCM }}
|
|
- configMapRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
|
|
{{- end }}
|
|
{{- if .Values.extraEnvVarsSecret }}
|
|
- secretRef:
|
|
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.livenessProbe.enabled }}
|
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.livenessProbe "enabled") "context" $) | nindent 12 }}
|
|
{{- else if .Values.customLivenessProbe }}
|
|
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.readinessProbe.enabled }}
|
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.readinessProbe "enabled") "context" $) | nindent 12 }}
|
|
{{- else if .Values.customReadinessProbe }}
|
|
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.containerPorts.http }}
|
|
protocol: TCP
|
|
- name: https
|
|
containerPort: {{ .Values.containerPorts.https }}
|
|
protocol: TCP
|
|
{{- if .Values.metrics.enabled }}
|
|
- name: metrics
|
|
containerPort: {{ .Values.containerPorts.metrics }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- range $key, $value := .Values.tcp }}
|
|
- name: "{{ $key }}-tcp"
|
|
containerPort: {{ $key }}
|
|
protocol: TCP
|
|
{{- end }}
|
|
{{- range $key, $value := .Values.udp }}
|
|
- name: "{{ $key }}-udp"
|
|
containerPort: {{ $key }}
|
|
protocol: UDP
|
|
{{- end }}
|
|
{{- if .Values.resources }}
|
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
|
{{- end }}
|
|
{{- if or .Values.customTemplate.configMapName .Values.extraVolumeMounts }}
|
|
volumeMounts:
|
|
{{- if .Values.customTemplate.configMapName }}
|
|
- mountPath: /etc/nginx/template
|
|
name: nginx-template-volume
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- if .Values.extraVolumeMounts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.sidecars }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.sidecars "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if (or .Values.customTemplate.configMapName .Values.extraVolumes) }}
|
|
volumes:
|
|
{{- if .Values.customTemplate.configMapName }}
|
|
- name: nginx-template-volume
|
|
configMap:
|
|
name: {{ .Values.customTemplate.configMapName }}
|
|
items:
|
|
- key: {{ .Values.customTemplate.configMapKey }}
|
|
path: nginx.tmpl
|
|
{{- end }}
|
|
{{- if .Values.extraVolumes }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|