| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 1 | {{- if .Values.defaultBackend.enabled -}} |
| 2 | apiVersion: apps/v1 |
| 3 | kind: Deployment |
| 4 | metadata: |
| 5 | labels: |
| 6 | {{- include "ingress-nginx.labels" . | nindent 4 }} |
| 7 | app.kubernetes.io/component: default-backend |
| Giorgi Lekveishvili | cccf72f | 2023-05-19 16:13:22 +0400 | [diff] [blame^] | 8 | {{- with .Values.defaultBackend.labels }} |
| 9 | {{- toYaml . | nindent 4 }} |
| 10 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 11 | name: {{ include "ingress-nginx.defaultBackend.fullname" . }} |
| 12 | namespace: {{ .Release.Namespace }} |
| 13 | spec: |
| 14 | selector: |
| 15 | matchLabels: |
| 16 | {{- include "ingress-nginx.selectorLabels" . | nindent 6 }} |
| 17 | app.kubernetes.io/component: default-backend |
| 18 | {{- if not .Values.defaultBackend.autoscaling.enabled }} |
| 19 | replicas: {{ .Values.defaultBackend.replicaCount }} |
| 20 | {{- end }} |
| 21 | revisionHistoryLimit: {{ .Values.revisionHistoryLimit }} |
| Giorgi Lekveishvili | cccf72f | 2023-05-19 16:13:22 +0400 | [diff] [blame^] | 22 | {{- if .Values.defaultBackend.updateStrategy }} |
| 23 | strategy: |
| 24 | {{ toYaml .Values.defaultBackend.updateStrategy | nindent 4 }} |
| 25 | {{- end }} |
| 26 | minReadySeconds: {{ .Values.defaultBackend.minReadySeconds }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 27 | template: |
| 28 | metadata: |
| 29 | {{- if .Values.defaultBackend.podAnnotations }} |
| 30 | annotations: {{ toYaml .Values.defaultBackend.podAnnotations | nindent 8 }} |
| 31 | {{- end }} |
| 32 | labels: |
| 33 | {{- include "ingress-nginx.selectorLabels" . | nindent 8 }} |
| 34 | app.kubernetes.io/component: default-backend |
| Giorgi Lekveishvili | cccf72f | 2023-05-19 16:13:22 +0400 | [diff] [blame^] | 35 | {{- with .Values.defaultBackend.labels }} |
| 36 | {{- toYaml . | nindent 8 }} |
| 37 | {{- end }} |
| Giorgi Lekveishvili | 725bb39 | 2023-05-05 18:24:27 +0400 | [diff] [blame] | 38 | {{- if .Values.defaultBackend.podLabels }} |
| 39 | {{- toYaml .Values.defaultBackend.podLabels | nindent 8 }} |
| 40 | {{- end }} |
| 41 | spec: |
| 42 | {{- if .Values.imagePullSecrets }} |
| 43 | imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }} |
| 44 | {{- end }} |
| 45 | {{- if .Values.defaultBackend.priorityClassName }} |
| 46 | priorityClassName: {{ .Values.defaultBackend.priorityClassName }} |
| 47 | {{- end }} |
| 48 | {{- if .Values.defaultBackend.podSecurityContext }} |
| 49 | securityContext: {{ toYaml .Values.defaultBackend.podSecurityContext | nindent 8 }} |
| 50 | {{- end }} |
| 51 | containers: |
| 52 | - name: {{ template "ingress-nginx.name" . }}-default-backend |
| 53 | {{- with .Values.defaultBackend.image }} |
| 54 | image: "{{- if .repository -}}{{ .repository }}{{ else }}{{ .registry }}/{{ .image }}{{- end -}}:{{ .tag }}{{- if (.digest) -}} @{{.digest}} {{- end -}}" |
| 55 | {{- end }} |
| 56 | imagePullPolicy: {{ .Values.defaultBackend.image.pullPolicy }} |
| 57 | {{- if .Values.defaultBackend.extraArgs }} |
| 58 | args: |
| 59 | {{- range $key, $value := .Values.defaultBackend.extraArgs }} |
| 60 | {{- /* Accept keys without values or with false as value */}} |
| 61 | {{- if eq ($value | quote | len) 2 }} |
| 62 | - --{{ $key }} |
| 63 | {{- else }} |
| 64 | - --{{ $key }}={{ $value }} |
| 65 | {{- end }} |
| 66 | {{- end }} |
| 67 | {{- end }} |
| 68 | securityContext: |
| 69 | capabilities: |
| 70 | drop: |
| 71 | - ALL |
| 72 | runAsUser: {{ .Values.defaultBackend.image.runAsUser }} |
| 73 | runAsNonRoot: {{ .Values.defaultBackend.image.runAsNonRoot }} |
| 74 | allowPrivilegeEscalation: {{ .Values.defaultBackend.image.allowPrivilegeEscalation }} |
| 75 | readOnlyRootFilesystem: {{ .Values.defaultBackend.image.readOnlyRootFilesystem}} |
| 76 | {{- if .Values.defaultBackend.extraEnvs }} |
| 77 | env: {{ toYaml .Values.defaultBackend.extraEnvs | nindent 12 }} |
| 78 | {{- end }} |
| 79 | livenessProbe: |
| 80 | httpGet: |
| 81 | path: /healthz |
| 82 | port: {{ .Values.defaultBackend.port }} |
| 83 | scheme: HTTP |
| 84 | initialDelaySeconds: {{ .Values.defaultBackend.livenessProbe.initialDelaySeconds }} |
| 85 | periodSeconds: {{ .Values.defaultBackend.livenessProbe.periodSeconds }} |
| 86 | timeoutSeconds: {{ .Values.defaultBackend.livenessProbe.timeoutSeconds }} |
| 87 | successThreshold: {{ .Values.defaultBackend.livenessProbe.successThreshold }} |
| 88 | failureThreshold: {{ .Values.defaultBackend.livenessProbe.failureThreshold }} |
| 89 | readinessProbe: |
| 90 | httpGet: |
| 91 | path: /healthz |
| 92 | port: {{ .Values.defaultBackend.port }} |
| 93 | scheme: HTTP |
| 94 | initialDelaySeconds: {{ .Values.defaultBackend.readinessProbe.initialDelaySeconds }} |
| 95 | periodSeconds: {{ .Values.defaultBackend.readinessProbe.periodSeconds }} |
| 96 | timeoutSeconds: {{ .Values.defaultBackend.readinessProbe.timeoutSeconds }} |
| 97 | successThreshold: {{ .Values.defaultBackend.readinessProbe.successThreshold }} |
| 98 | failureThreshold: {{ .Values.defaultBackend.readinessProbe.failureThreshold }} |
| 99 | ports: |
| 100 | - name: http |
| 101 | containerPort: {{ .Values.defaultBackend.port }} |
| 102 | protocol: TCP |
| 103 | {{- if .Values.defaultBackend.extraVolumeMounts }} |
| 104 | volumeMounts: {{- toYaml .Values.defaultBackend.extraVolumeMounts | nindent 12 }} |
| 105 | {{- end }} |
| 106 | {{- if .Values.defaultBackend.resources }} |
| 107 | resources: {{ toYaml .Values.defaultBackend.resources | nindent 12 }} |
| 108 | {{- end }} |
| 109 | {{- if .Values.defaultBackend.nodeSelector }} |
| 110 | nodeSelector: {{ toYaml .Values.defaultBackend.nodeSelector | nindent 8 }} |
| 111 | {{- end }} |
| 112 | serviceAccountName: {{ template "ingress-nginx.defaultBackend.serviceAccountName" . }} |
| 113 | {{- if .Values.defaultBackend.tolerations }} |
| 114 | tolerations: {{ toYaml .Values.defaultBackend.tolerations | nindent 8 }} |
| 115 | {{- end }} |
| 116 | {{- if .Values.defaultBackend.affinity }} |
| 117 | affinity: {{ toYaml .Values.defaultBackend.affinity | nindent 8 }} |
| 118 | {{- end }} |
| 119 | terminationGracePeriodSeconds: 60 |
| 120 | {{- if .Values.defaultBackend.extraVolumes }} |
| 121 | volumes: {{ toYaml .Values.defaultBackend.extraVolumes | nindent 8 }} |
| 122 | {{- end }} |
| 123 | {{- end }} |