| Giorgi Lekveishvili | ec6b3cc | 2023-12-01 16:30:04 +0400 | [diff] [blame^] | 1 | {{- if .Values.deployment.enabled }} |
| 2 | --- |
| 3 | apiVersion: apps/v1 |
| 4 | kind: Deployment |
| 5 | metadata: |
| 6 | name: {{ default (include "coredns.fullname" .) .Values.deployment.name }} |
| 7 | labels: {{- include "coredns.labels" . | nindent 4 }} |
| 8 | app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 9 | {{- if .Values.customLabels }} |
| 10 | {{ toYaml .Values.customLabels | indent 4 }} |
| 11 | {{- end }} |
| 12 | {{- if or .Values.deployment.annotations .Values.customAnnotations }} |
| 13 | annotations: |
| 14 | {{- if .Values.customAnnotations }} |
| 15 | {{- toYaml .Values.customAnnotations | nindent 4 }} |
| 16 | {{- end }} |
| 17 | {{- if .Values.deployment.annotations }} |
| 18 | {{- toYaml .Values.deployment.annotations | nindent 4 }} |
| 19 | {{- end }} |
| 20 | {{- end }} |
| 21 | spec: |
| 22 | {{- if and (not .Values.autoscaler.enabled) (not .Values.hpa.enabled) }} |
| 23 | replicas: {{ .Values.replicaCount }} |
| 24 | {{- end }} |
| 25 | strategy: |
| 26 | type: RollingUpdate |
| 27 | rollingUpdate: |
| 28 | maxUnavailable: {{ .Values.rollingUpdate.maxUnavailable }} |
| 29 | maxSurge: {{ .Values.rollingUpdate.maxSurge }} |
| 30 | selector: |
| 31 | matchLabels: |
| 32 | app.kubernetes.io/instance: {{ .Release.Name | quote }} |
| 33 | {{- if .Values.isClusterService }} |
| 34 | k8s-app: {{ template "coredns.k8sapplabel" . }} |
| 35 | {{- end }} |
| 36 | app.kubernetes.io/name: {{ template "coredns.name" . }} |
| 37 | template: |
| 38 | metadata: |
| 39 | labels: |
| 40 | {{- if .Values.isClusterService }} |
| 41 | k8s-app: {{ template "coredns.k8sapplabel" . }} |
| 42 | {{- end }} |
| 43 | app.kubernetes.io/name: {{ template "coredns.name" . }} |
| 44 | app.kubernetes.io/instance: {{ .Release.Name | quote }} |
| 45 | {{- if .Values.customLabels }} |
| 46 | {{ toYaml .Values.customLabels | indent 8 }} |
| 47 | {{- end }} |
| 48 | annotations: |
| 49 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 50 | {{- if .Values.isClusterService }} |
| 51 | scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]' |
| 52 | {{- end }} |
| 53 | {{- if .Values.podAnnotations }} |
| 54 | {{ toYaml .Values.podAnnotations | indent 8 }} |
| 55 | {{- end }} |
| 56 | spec: |
| 57 | {{- if .Values.podSecurityContext }} |
| 58 | securityContext: {{ toYaml .Values.podSecurityContext | nindent 8 }} |
| 59 | {{- end }} |
| 60 | {{- if .Values.terminationGracePeriodSeconds }} |
| 61 | terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} |
| 62 | {{- end }} |
| 63 | serviceAccountName: {{ template "coredns.serviceAccountName" . }} |
| 64 | {{- if .Values.priorityClassName }} |
| 65 | priorityClassName: {{ .Values.priorityClassName | quote }} |
| 66 | {{- end }} |
| 67 | {{- if .Values.isClusterService }} |
| 68 | dnsPolicy: Default |
| 69 | {{- end }} |
| 70 | {{- if .Values.affinity }} |
| 71 | affinity: |
| 72 | {{ toYaml .Values.affinity | indent 8 }} |
| 73 | {{- end }} |
| 74 | {{- if .Values.topologySpreadConstraints }} |
| 75 | topologySpreadConstraints: |
| 76 | {{ tpl (toYaml .Values.topologySpreadConstraints) $ | indent 8 }} |
| 77 | {{- end }} |
| 78 | {{- if .Values.tolerations }} |
| 79 | tolerations: |
| 80 | {{ toYaml .Values.tolerations | indent 8 }} |
| 81 | {{- end }} |
| 82 | {{- if .Values.nodeSelector }} |
| 83 | nodeSelector: |
| 84 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 85 | {{- end }} |
| 86 | {{- if not (empty .Values.image.pullSecrets) }} |
| 87 | imagePullSecrets: |
| 88 | {{ toYaml .Values.image.pullSecrets | indent 8 }} |
| 89 | {{- end }} |
| 90 | containers: |
| 91 | - name: "coredns" |
| 92 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 93 | imagePullPolicy: {{ .Values.image.pullPolicy }} |
| 94 | args: [ "-conf", "/etc/coredns/Corefile" ] |
| 95 | volumeMounts: |
| 96 | - name: config-volume |
| 97 | mountPath: /etc/coredns |
| 98 | {{- range .Values.extraSecrets }} |
| 99 | - name: {{ .name }} |
| 100 | mountPath: {{ .mountPath }} |
| 101 | readOnly: true |
| 102 | {{- end }} |
| 103 | {{- if .Values.extraVolumeMounts }} |
| 104 | {{- toYaml .Values.extraVolumeMounts | nindent 8}} |
| 105 | {{- end }} |
| 106 | resources: |
| 107 | {{ toYaml .Values.resources | indent 10 }} |
| 108 | ports: |
| 109 | {{ include "coredns.containerPorts" . | indent 8 }} |
| 110 | {{- if .Values.livenessProbe.enabled }} |
| 111 | livenessProbe: |
| 112 | httpGet: |
| 113 | path: /health |
| 114 | port: 8080 |
| 115 | scheme: HTTP |
| 116 | initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} |
| 117 | periodSeconds: {{ .Values.livenessProbe.periodSeconds }} |
| 118 | timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} |
| 119 | successThreshold: {{ .Values.livenessProbe.successThreshold }} |
| 120 | failureThreshold: {{ .Values.livenessProbe.failureThreshold }} |
| 121 | {{- end }} |
| 122 | {{- if .Values.readinessProbe.enabled }} |
| 123 | readinessProbe: |
| 124 | httpGet: |
| 125 | path: /ready |
| 126 | port: 8181 |
| 127 | scheme: HTTP |
| 128 | initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} |
| 129 | periodSeconds: {{ .Values.readinessProbe.periodSeconds }} |
| 130 | timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} |
| 131 | successThreshold: {{ .Values.readinessProbe.successThreshold }} |
| 132 | failureThreshold: {{ .Values.readinessProbe.failureThreshold }} |
| 133 | {{- end }} |
| 134 | {{- if .Values.securityContext }} |
| 135 | securityContext: |
| 136 | {{- toYaml .Values.securityContext | nindent 10 }} |
| 137 | {{- end }} |
| 138 | {{- if .Values.extraContainers }} |
| 139 | {{ toYaml .Values.extraContainers | indent 6 }} |
| 140 | {{- end }} |
| 141 | volumes: |
| 142 | - name: config-volume |
| 143 | configMap: |
| 144 | name: {{ template "coredns.fullname" . }} |
| 145 | items: |
| 146 | - key: Corefile |
| 147 | path: Corefile |
| 148 | {{ range .Values.zoneFiles }} |
| 149 | - key: {{ .filename }} |
| 150 | path: {{ .filename }} |
| 151 | {{ end }} |
| 152 | {{- range .Values.extraSecrets }} |
| 153 | - name: {{ .name }} |
| 154 | secret: |
| 155 | secretName: {{ .name }} |
| 156 | defaultMode: {{ default 400 .defaultMode }} |
| 157 | {{- end }} |
| 158 | {{- if .Values.extraVolumes }} |
| 159 | {{ toYaml .Values.extraVolumes | indent 8 }} |
| 160 | {{- end }} |
| 161 | {{- end }} |