Files
charts/bitnami/nginx-ingress-controller/templates/controller-deployment.yaml
2018-10-02 11:12:21 +02:00

195 lines
7.1 KiB
YAML

{{- if eq .Values.kind "Deployment" }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: {{ template "nginx-ingress.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "nginx-ingress.fullname" . }}
spec:
selector:
matchLabels:
app: {{ template "nginx-ingress.name" . }}
release: "{{ .Release.Name }}"
component: "{{ .Values.name }}"
replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
strategy:
{{ toYaml .Values.updateStrategy | indent 4 }}
minReadySeconds: {{ .Values.minReadySeconds }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations:
{{ toYaml .Values.podAnnotations | indent 8}}
{{- end }}
labels:
app: {{ template "nginx-ingress.name" . }}
chart: {{ template "nginx-ingress-controller.chart" . }}
component: "{{ .Values.name }}"
release: {{ .Release.Name }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
spec:
dnsPolicy: {{ .Values.dnsPolicy }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
containers:
- name: {{ template "nginx-ingress.name" . }}-{{ .Values.name }}
image: "{{ template "nginx-ingress-controller.image" . }}"
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
{{- if .Values.lifecycle }}
lifecycle:
{{ toYaml .Values.lifecycle | indent 12 }}
{{- end }}
args:
- /nginx-ingress-controller
- --default-backend-service={{ if .Values.defaultBackend.enabled }}{{ .Release.Namespace }}/{{ template "nginx-ingress.defaultBackend.fullname" . }}{{ else }}{{ .Values.defaultBackendService }}{{ end }}
{{- if .Values.publishService.enabled }}
- --publish-service={{ template "nginx-ingress.publishServicePath" . }}
{{- end }}
- --election-id={{ .Values.electionID }}
- --ingress-class={{ .Values.ingressClass }}
- --configmap={{ .Release.Namespace }}/{{ template "nginx-ingress.fullname" . }}
{{- if .Values.tcp }}
- --tcp-services-configmap={{ .Release.Namespace }}/{{ template "nginx-ingress.fullname" . }}-tcp
{{- end }}
{{- if .Values.udp }}
- --udp-services-configmap={{ .Release.Namespace }}/{{ template "nginx-ingress.fullname" . }}-udp
{{- end }}
{{- if .Values.scope.enabled }}
- --watch-namespace={{ default .Release.Namespace .Values.scope.namespace }}
{{- end }}
{{- range $key, $value := .Values.extraArgs }}
{{- if $value }}
- --{{ $key }}={{ $value }}
{{- else }}
- --{{ $key }}
{{- end }}
{{- end }}
securityContext:
capabilities:
drop: ["ALL"]
add: ["NET_BIND_SERVICE"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.extraEnvs }}
{{ toYaml .Values.extraEnvs | indent 12 }}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.livenessProbe.port }}
scheme: HTTP
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
{{- if .Values.stats.enabled }}
- name: stats
containerPort: 18080
protocol: TCP
{{- if .Values.metrics.enabled }}
- name: metrics
containerPort: 10254
protocol: TCP
{{- end }}
{{- 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 }}
readinessProbe:
httpGet:
path: /healthz
port: {{ .Values.readinessProbe.port }}
scheme: HTTP
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
{{- if (or .Values.customTemplate.configMapName .Values.extraVolumeMounts) }}
volumeMounts:
{{- end }}
{{- if .Values.customTemplate.configMapName }}
- mountPath: /etc/nginx/template
name: nginx-template-volume
readOnly: true
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{ toYaml .Values.extraVolumeMounts | indent 12}}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.extraContainers }}
{{ toYaml .Values.extraContainers | indent 8}}
{{- end }}
{{- if .Values.extraInitContainers }}
initContainers:
{{ toYaml .Values.extraInitContainers | indent 8}}
{{- end }}
hostNetwork: {{ .Values.hostNetwork }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
serviceAccountName: {{ template "nginx-ingress.serviceAccountName" . }}
terminationGracePeriodSeconds: 60
{{- if (or .Values.customTemplate.configMapName .Values.extraVolumes) }}
volumes:
{{- end }}
{{- 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 }}
{{ toYaml .Values.extraVolumes | indent 8}}
{{- end }}
{{- end }}