| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 1 | apiVersion: apps/v1 |
| 2 | kind: Deployment |
| 3 | metadata: |
| 4 | name: {{ include "webhook.fullname" . }} |
| 5 | namespace: {{ include "cert-manager.namespace" . }} |
| 6 | labels: |
| 7 | app: {{ include "webhook.name" . }} |
| 8 | app.kubernetes.io/name: {{ include "webhook.name" . }} |
| 9 | app.kubernetes.io/instance: {{ .Release.Name }} |
| 10 | app.kubernetes.io/component: "webhook" |
| 11 | {{- include "labels" . | nindent 4 }} |
| 12 | {{- with .Values.webhook.deploymentAnnotations }} |
| 13 | annotations: |
| 14 | {{- toYaml . | nindent 4 }} |
| 15 | {{- end }} |
| 16 | spec: |
| 17 | replicas: {{ .Values.webhook.replicaCount }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 18 | {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} |
| 19 | {{- if not (has (quote .Values.global.revisionHistoryLimit) (list "" (quote ""))) }} |
| 20 | revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }} |
| 21 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 22 | selector: |
| 23 | matchLabels: |
| 24 | app.kubernetes.io/name: {{ include "webhook.name" . }} |
| 25 | app.kubernetes.io/instance: {{ .Release.Name }} |
| 26 | app.kubernetes.io/component: "webhook" |
| 27 | {{- with .Values.webhook.strategy }} |
| 28 | strategy: |
| 29 | {{- toYaml . | nindent 4 }} |
| 30 | {{- end }} |
| 31 | template: |
| 32 | metadata: |
| 33 | labels: |
| 34 | app: {{ include "webhook.name" . }} |
| 35 | app.kubernetes.io/name: {{ include "webhook.name" . }} |
| 36 | app.kubernetes.io/instance: {{ .Release.Name }} |
| 37 | app.kubernetes.io/component: "webhook" |
| 38 | {{- include "labels" . | nindent 8 }} |
| 39 | {{- with .Values.webhook.podLabels }} |
| 40 | {{- toYaml . | nindent 8 }} |
| 41 | {{- end }} |
| 42 | {{- with .Values.webhook.podAnnotations }} |
| 43 | annotations: |
| 44 | {{- toYaml . | nindent 8 }} |
| 45 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 46 | {{- if and .Values.prometheus.enabled (not (or .Values.prometheus.servicemonitor.enabled .Values.prometheus.podmonitor.enabled)) }} |
| 47 | {{- if not .Values.webhook.podAnnotations }} |
| 48 | annotations: |
| 49 | {{- end }} |
| 50 | prometheus.io/path: "/metrics" |
| 51 | prometheus.io/scrape: 'true' |
| 52 | prometheus.io/port: '9402' |
| 53 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 54 | spec: |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 55 | {{- if not .Values.webhook.serviceAccount.create }} |
| 56 | {{- with .Values.global.imagePullSecrets }} |
| 57 | imagePullSecrets: |
| 58 | {{- toYaml . | nindent 8 }} |
| 59 | {{- end }} |
| 60 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 61 | serviceAccountName: {{ template "webhook.serviceAccountName" . }} |
| 62 | {{- if hasKey .Values.webhook "automountServiceAccountToken" }} |
| 63 | automountServiceAccountToken: {{ .Values.webhook.automountServiceAccountToken }} |
| 64 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 65 | enableServiceLinks: {{ .Values.webhook.enableServiceLinks }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 66 | {{- with .Values.global.priorityClassName }} |
| 67 | priorityClassName: {{ . | quote }} |
| 68 | {{- end }} |
| 69 | {{- with .Values.webhook.securityContext }} |
| 70 | securityContext: |
| 71 | {{- toYaml . | nindent 8 }} |
| 72 | {{- end }} |
| 73 | {{- if .Values.webhook.hostNetwork }} |
| 74 | hostNetwork: true |
| 75 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 76 | {{- if .Values.webhook.hostNetwork }} |
| 77 | dnsPolicy: ClusterFirstWithHostNet |
| 78 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 79 | containers: |
| 80 | - name: {{ .Chart.Name }}-webhook |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 81 | image: "{{ template "image" (tuple .Values.webhook.image $.Chart.AppVersion) }}" |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 82 | imagePullPolicy: {{ .Values.webhook.image.pullPolicy }} |
| 83 | args: |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 84 | {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} |
| 85 | {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 86 | - --v={{ .Values.global.logLevel }} |
| 87 | {{- end }} |
| 88 | {{- if .Values.webhook.config }} |
| 89 | - --config=/var/cert-manager/config/config.yaml |
| 90 | {{- end }} |
| 91 | {{- $config := default .Values.webhook.config "" }} |
| 92 | {{ if not $config.securePort -}} |
| 93 | - --secure-port={{ .Values.webhook.securePort }} |
| 94 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 95 | {{- if .Values.webhook.featureGates }} |
| 96 | - --feature-gates={{ .Values.webhook.featureGates }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 97 | {{- end }} |
| 98 | {{- $tlsConfig := default $config.tlsConfig "" }} |
| 99 | {{ if or (not $config.tlsConfig) (and (not $tlsConfig.dynamic) (not $tlsConfig.filesystem) ) -}} |
| 100 | - --dynamic-serving-ca-secret-namespace=$(POD_NAMESPACE) |
| 101 | - --dynamic-serving-ca-secret-name={{ template "webhook.fullname" . }}-ca |
| 102 | - --dynamic-serving-dns-names={{ template "webhook.fullname" . }} |
| 103 | - --dynamic-serving-dns-names={{ template "webhook.fullname" . }}.$(POD_NAMESPACE) |
| 104 | - --dynamic-serving-dns-names={{ template "webhook.fullname" . }}.$(POD_NAMESPACE).svc |
| 105 | {{ if .Values.webhook.url.host }} |
| 106 | - --dynamic-serving-dns-names={{ .Values.webhook.url.host }} |
| 107 | {{- end }} |
| 108 | {{- end }} |
| 109 | {{- with .Values.webhook.extraArgs }} |
| 110 | {{- toYaml . | nindent 10 }} |
| 111 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 112 | {{- if not .Values.prometheus.enabled }} |
| 113 | - --metrics-listen-address=0 |
| 114 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 115 | ports: |
| 116 | - name: https |
| 117 | protocol: TCP |
| 118 | {{- if $config.securePort }} |
| 119 | containerPort: {{ $config.securePort }} |
| 120 | {{- else if .Values.webhook.securePort }} |
| 121 | containerPort: {{ .Values.webhook.securePort }} |
| 122 | {{- else }} |
| 123 | containerPort: 6443 |
| 124 | {{- end }} |
| 125 | - name: healthcheck |
| 126 | protocol: TCP |
| 127 | {{- if $config.healthzPort }} |
| 128 | containerPort: {{ $config.healthzPort }} |
| 129 | {{- else }} |
| 130 | containerPort: 6080 |
| 131 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 132 | {{- if .Values.prometheus.enabled }} |
| 133 | - containerPort: 9402 |
| 134 | name: http-metrics |
| 135 | protocol: TCP |
| 136 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 137 | livenessProbe: |
| 138 | httpGet: |
| 139 | path: /livez |
| 140 | {{- if $config.healthzPort }} |
| 141 | port: {{ $config.healthzPort }} |
| 142 | {{- else }} |
| 143 | port: 6080 |
| 144 | {{- end }} |
| 145 | scheme: HTTP |
| 146 | initialDelaySeconds: {{ .Values.webhook.livenessProbe.initialDelaySeconds }} |
| 147 | periodSeconds: {{ .Values.webhook.livenessProbe.periodSeconds }} |
| 148 | timeoutSeconds: {{ .Values.webhook.livenessProbe.timeoutSeconds }} |
| 149 | successThreshold: {{ .Values.webhook.livenessProbe.successThreshold }} |
| 150 | failureThreshold: {{ .Values.webhook.livenessProbe.failureThreshold }} |
| 151 | readinessProbe: |
| 152 | httpGet: |
| 153 | path: /healthz |
| 154 | {{- if $config.healthzPort }} |
| 155 | port: {{ $config.healthzPort }} |
| 156 | {{- else }} |
| 157 | port: 6080 |
| 158 | {{- end }} |
| 159 | scheme: HTTP |
| 160 | initialDelaySeconds: {{ .Values.webhook.readinessProbe.initialDelaySeconds }} |
| 161 | periodSeconds: {{ .Values.webhook.readinessProbe.periodSeconds }} |
| 162 | timeoutSeconds: {{ .Values.webhook.readinessProbe.timeoutSeconds }} |
| 163 | successThreshold: {{ .Values.webhook.readinessProbe.successThreshold }} |
| 164 | failureThreshold: {{ .Values.webhook.readinessProbe.failureThreshold }} |
| 165 | {{- with .Values.webhook.containerSecurityContext }} |
| 166 | securityContext: |
| 167 | {{- toYaml . | nindent 12 }} |
| 168 | {{- end }} |
| 169 | env: |
| 170 | - name: POD_NAMESPACE |
| 171 | valueFrom: |
| 172 | fieldRef: |
| 173 | fieldPath: metadata.namespace |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 174 | {{- with .Values.webhook.extraEnv }} |
| 175 | {{- toYaml . | nindent 10 }} |
| 176 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 177 | {{- with .Values.webhook.resources }} |
| 178 | resources: |
| 179 | {{- toYaml . | nindent 12 }} |
| 180 | {{- end }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 181 | {{- if or .Values.webhook.config .Values.webhook.volumeMounts }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 182 | volumeMounts: |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 183 | {{- if .Values.webhook.config }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 184 | - name: config |
| 185 | mountPath: /var/cert-manager/config |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 186 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 187 | {{- with .Values.webhook.volumeMounts }} |
| 188 | {{- toYaml . | nindent 12 }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 189 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 190 | {{- end }} |
| 191 | {{- with .Values.webhook.nodeSelector }} |
| 192 | nodeSelector: |
| 193 | {{- toYaml . | nindent 8 }} |
| 194 | {{- end }} |
| 195 | {{- with .Values.webhook.affinity }} |
| 196 | affinity: |
| 197 | {{- toYaml . | nindent 8 }} |
| 198 | {{- end }} |
| 199 | {{- with .Values.webhook.tolerations }} |
| 200 | tolerations: |
| 201 | {{- toYaml . | nindent 8 }} |
| 202 | {{- end }} |
| 203 | {{- with .Values.webhook.topologySpreadConstraints }} |
| 204 | topologySpreadConstraints: |
| 205 | {{- toYaml . | nindent 8 }} |
| 206 | {{- end }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 207 | {{- if or .Values.webhook.config .Values.webhook.volumes }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 208 | volumes: |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 209 | {{- if .Values.webhook.config }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 210 | - name: config |
| 211 | configMap: |
| 212 | name: {{ include "webhook.fullname" . }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 213 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame^] | 214 | {{- with .Values.webhook.volumes }} |
| 215 | {{- toYaml . | nindent 8 }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 216 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 217 | {{- end }} |