| 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 }} |
| gio | d55d03a | 2026-07-23 16:57:48 +0400 | [diff] [blame] | 69 | {{- if (hasKey .Values.global "hostUsers") }} |
| 70 | hostUsers: {{ .Values.global.hostUsers }} |
| 71 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 72 | {{- with .Values.webhook.securityContext }} |
| 73 | securityContext: |
| 74 | {{- toYaml . | nindent 8 }} |
| 75 | {{- end }} |
| 76 | {{- if .Values.webhook.hostNetwork }} |
| 77 | hostNetwork: true |
| 78 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 79 | {{- if .Values.webhook.hostNetwork }} |
| 80 | dnsPolicy: ClusterFirstWithHostNet |
| 81 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 82 | containers: |
| 83 | - name: {{ .Chart.Name }}-webhook |
| gio | c895c1d | 2026-07-23 17:18:25 +0400 | [diff] [blame^] | 84 | image: "{{ template "cert-manager.image" (tuple .Values.webhook.image .Values.imageRegistry .Values.imageNamespace (printf ":%s" .Chart.AppVersion)) }}" |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 85 | imagePullPolicy: {{ .Values.webhook.image.pullPolicy }} |
| 86 | args: |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 87 | {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} |
| 88 | {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 89 | - --v={{ .Values.global.logLevel }} |
| 90 | {{- end }} |
| 91 | {{- if .Values.webhook.config }} |
| 92 | - --config=/var/cert-manager/config/config.yaml |
| 93 | {{- end }} |
| 94 | {{- $config := default .Values.webhook.config "" }} |
| 95 | {{ if not $config.securePort -}} |
| 96 | - --secure-port={{ .Values.webhook.securePort }} |
| 97 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 98 | {{- if .Values.webhook.featureGates }} |
| 99 | - --feature-gates={{ .Values.webhook.featureGates }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 100 | {{- end }} |
| gio | 15aa663 | 2026-07-23 17:14:23 +0400 | [diff] [blame] | 101 | {{- if .Values.webhook.enableClientVerification }} |
| 102 | - --enable-client-verification={{ .Values.webhook.enableClientVerification }} |
| 103 | {{- end }} |
| 104 | {{- if .Values.webhook.clientCAFile }} |
| 105 | - --client-ca-path={{ .Values.webhook.clientCAFile }} |
| 106 | {{- end }} |
| 107 | {{- if .Values.webhook.apiserverClientCertSubjects }} |
| 108 | - --client-subject-names={{ .Values.webhook.apiserverClientCertSubjects }} |
| 109 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 110 | {{- $tlsConfig := default $config.tlsConfig "" }} |
| 111 | {{ if or (not $config.tlsConfig) (and (not $tlsConfig.dynamic) (not $tlsConfig.filesystem) ) -}} |
| 112 | - --dynamic-serving-ca-secret-namespace=$(POD_NAMESPACE) |
| 113 | - --dynamic-serving-ca-secret-name={{ template "webhook.fullname" . }}-ca |
| 114 | - --dynamic-serving-dns-names={{ template "webhook.fullname" . }} |
| 115 | - --dynamic-serving-dns-names={{ template "webhook.fullname" . }}.$(POD_NAMESPACE) |
| 116 | - --dynamic-serving-dns-names={{ template "webhook.fullname" . }}.$(POD_NAMESPACE).svc |
| gio | d55d03a | 2026-07-23 16:57:48 +0400 | [diff] [blame] | 117 | {{- if .Values.webhook.url.host }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 118 | - --dynamic-serving-dns-names={{ .Values.webhook.url.host }} |
| 119 | {{- end }} |
| 120 | {{- end }} |
| 121 | {{- with .Values.webhook.extraArgs }} |
| 122 | {{- toYaml . | nindent 10 }} |
| 123 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 124 | {{- if not .Values.prometheus.enabled }} |
| 125 | - --metrics-listen-address=0 |
| 126 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 127 | ports: |
| 128 | - name: https |
| 129 | protocol: TCP |
| 130 | {{- if $config.securePort }} |
| 131 | containerPort: {{ $config.securePort }} |
| 132 | {{- else if .Values.webhook.securePort }} |
| 133 | containerPort: {{ .Values.webhook.securePort }} |
| 134 | {{- else }} |
| 135 | containerPort: 6443 |
| 136 | {{- end }} |
| 137 | - name: healthcheck |
| 138 | protocol: TCP |
| 139 | {{- if $config.healthzPort }} |
| 140 | containerPort: {{ $config.healthzPort }} |
| 141 | {{- else }} |
| 142 | containerPort: 6080 |
| 143 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 144 | {{- if .Values.prometheus.enabled }} |
| 145 | - containerPort: 9402 |
| 146 | name: http-metrics |
| 147 | protocol: TCP |
| 148 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 149 | livenessProbe: |
| 150 | httpGet: |
| 151 | path: /livez |
| gio | b6e9f2f | 2026-07-23 16:53:10 +0400 | [diff] [blame] | 152 | port: healthcheck |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 153 | scheme: HTTP |
| 154 | initialDelaySeconds: {{ .Values.webhook.livenessProbe.initialDelaySeconds }} |
| 155 | periodSeconds: {{ .Values.webhook.livenessProbe.periodSeconds }} |
| 156 | timeoutSeconds: {{ .Values.webhook.livenessProbe.timeoutSeconds }} |
| 157 | successThreshold: {{ .Values.webhook.livenessProbe.successThreshold }} |
| 158 | failureThreshold: {{ .Values.webhook.livenessProbe.failureThreshold }} |
| 159 | readinessProbe: |
| 160 | httpGet: |
| 161 | path: /healthz |
| gio | b6e9f2f | 2026-07-23 16:53:10 +0400 | [diff] [blame] | 162 | port: healthcheck |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 163 | scheme: HTTP |
| 164 | initialDelaySeconds: {{ .Values.webhook.readinessProbe.initialDelaySeconds }} |
| 165 | periodSeconds: {{ .Values.webhook.readinessProbe.periodSeconds }} |
| 166 | timeoutSeconds: {{ .Values.webhook.readinessProbe.timeoutSeconds }} |
| 167 | successThreshold: {{ .Values.webhook.readinessProbe.successThreshold }} |
| 168 | failureThreshold: {{ .Values.webhook.readinessProbe.failureThreshold }} |
| 169 | {{- with .Values.webhook.containerSecurityContext }} |
| 170 | securityContext: |
| 171 | {{- toYaml . | nindent 12 }} |
| 172 | {{- end }} |
| 173 | env: |
| 174 | - name: POD_NAMESPACE |
| 175 | valueFrom: |
| 176 | fieldRef: |
| 177 | fieldPath: metadata.namespace |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 178 | {{- with .Values.webhook.extraEnv }} |
| 179 | {{- toYaml . | nindent 10 }} |
| 180 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 181 | {{- with .Values.webhook.resources }} |
| 182 | resources: |
| 183 | {{- toYaml . | nindent 12 }} |
| 184 | {{- end }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 185 | {{- if or .Values.webhook.config .Values.webhook.volumeMounts }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 186 | volumeMounts: |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 187 | {{- if .Values.webhook.config }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 188 | - name: config |
| 189 | mountPath: /var/cert-manager/config |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 190 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 191 | {{- with .Values.webhook.volumeMounts }} |
| 192 | {{- toYaml . | nindent 12 }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 193 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 194 | {{- end }} |
| gio | d55d03a | 2026-07-23 16:57:48 +0400 | [diff] [blame] | 195 | {{- $nodeSelector := .Values.global.nodeSelector | default dict }} |
| 196 | {{- $nodeSelector = merge $nodeSelector (.Values.webhook.nodeSelector | default dict) }} |
| 197 | {{- with $nodeSelector }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 198 | nodeSelector: |
| gio | b6e9f2f | 2026-07-23 16:53:10 +0400 | [diff] [blame] | 199 | {{- range $key, $value := . }} |
| 200 | {{ $key }}: {{ $value | quote }} |
| 201 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 202 | {{- end }} |
| 203 | {{- with .Values.webhook.affinity }} |
| 204 | affinity: |
| 205 | {{- toYaml . | nindent 8 }} |
| 206 | {{- end }} |
| gio | c895c1d | 2026-07-23 17:18:25 +0400 | [diff] [blame^] | 207 | {{- if .Values.webhook.runtimeClassName }} |
| 208 | runtimeClassName: {{ .Values.webhook.runtimeClassName | quote }} |
| 209 | {{- else if .Values.global.runtimeClassName }} |
| 210 | runtimeClassName: {{ .Values.global.runtimeClassName | quote }} |
| 211 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 212 | {{- with .Values.webhook.tolerations }} |
| 213 | tolerations: |
| 214 | {{- toYaml . | nindent 8 }} |
| 215 | {{- end }} |
| 216 | {{- with .Values.webhook.topologySpreadConstraints }} |
| 217 | topologySpreadConstraints: |
| 218 | {{- toYaml . | nindent 8 }} |
| 219 | {{- end }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 220 | {{- if or .Values.webhook.config .Values.webhook.volumes }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 221 | volumes: |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 222 | {{- if .Values.webhook.config }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 223 | - name: config |
| 224 | configMap: |
| 225 | name: {{ include "webhook.fullname" . }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 226 | {{- end }} |
| gio | 33d6293 | 2026-07-23 16:39:35 +0400 | [diff] [blame] | 227 | {{- with .Values.webhook.volumes }} |
| 228 | {{- toYaml . | nindent 8 }} |
| Giorgi Lekveishvili | 0048a78 | 2023-06-20 18:32:21 +0400 | [diff] [blame] | 229 | {{- end }} |
| Giorgi Lekveishvili | d1234c1 | 2023-06-19 10:37:06 +0400 | [diff] [blame] | 230 | {{- end }} |