blob: fa2af6cdefabe044bb481d654f966d25417814a8 [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001apiVersion: apps/v1
2kind: Deployment
3metadata:
4 name: {{ template "cert-manager.fullname" . }}
5 namespace: {{ include "cert-manager.namespace" . }}
6 labels:
7 app: {{ template "cert-manager.name" . }}
8 app.kubernetes.io/name: {{ template "cert-manager.name" . }}
9 app.kubernetes.io/instance: {{ .Release.Name }}
10 app.kubernetes.io/component: "controller"
11 {{- include "labels" . | nindent 4 }}
12 {{- with .Values.deploymentAnnotations }}
13 annotations:
14 {{- toYaml . | nindent 4 }}
15 {{- end }}
16spec:
17 replicas: {{ .Values.replicaCount }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040018 {{- /* 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 Lekveishvili4ec4c022024-08-17 15:09:24 +040022 selector:
23 matchLabels:
24 app.kubernetes.io/name: {{ template "cert-manager.name" . }}
25 app.kubernetes.io/instance: {{ .Release.Name }}
26 app.kubernetes.io/component: "controller"
27 {{- with .Values.strategy }}
28 strategy:
29 {{- toYaml . | nindent 4 }}
30 {{- end }}
31 template:
32 metadata:
33 labels:
34 app: {{ template "cert-manager.name" . }}
35 app.kubernetes.io/name: {{ template "cert-manager.name" . }}
36 app.kubernetes.io/instance: {{ .Release.Name }}
37 app.kubernetes.io/component: "controller"
38 {{- include "labels" . | nindent 8 }}
39 {{- with .Values.podLabels }}
40 {{- toYaml . | nindent 8 }}
41 {{- end }}
42 {{- with .Values.podAnnotations }}
43 annotations:
44 {{- toYaml . | nindent 8 }}
45 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040046 {{- if and .Values.prometheus.enabled (not (or .Values.prometheus.servicemonitor.enabled .Values.prometheus.podmonitor.enabled)) }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040047 {{- if not .Values.podAnnotations }}
48 annotations:
49 {{- end }}
50 prometheus.io/path: "/metrics"
51 prometheus.io/scrape: 'true'
52 prometheus.io/port: '9402'
53 {{- end }}
54 spec:
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040055 {{- if not .Values.serviceAccount.create }}
56 {{- with .Values.global.imagePullSecrets }}
57 imagePullSecrets:
58 {{- toYaml . | nindent 8 }}
59 {{- end }}
60 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040061 serviceAccountName: {{ template "cert-manager.serviceAccountName" . }}
62 {{- if hasKey .Values "automountServiceAccountToken" }}
63 automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
64 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040065 enableServiceLinks: {{ .Values.enableServiceLinks }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040066 {{- with .Values.global.priorityClassName }}
67 priorityClassName: {{ . | quote }}
68 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040069 {{- if (hasKey .Values.global "hostUsers") }}
70 hostUsers: {{ .Values.global.hostUsers }}
71 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040072 {{- with .Values.securityContext }}
73 securityContext:
74 {{- toYaml . | nindent 8 }}
75 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040076 {{- if or .Values.volumes .Values.config}}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040077 volumes:
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040078 {{- if .Values.config }}
79 - name: config
80 configMap:
81 name: {{ include "cert-manager.fullname" . }}
82 {{- end }}
83 {{ with .Values.volumes }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040084 {{- toYaml . | nindent 8 }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040085 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040086 {{- end }}
87 containers:
88 - name: {{ .Chart.Name }}-controller
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040089 image: "{{ template "cert-manager.image" (tuple .Values.image .Values.imageRegistry .Values.imageNamespace (printf ":%s" .Chart.AppVersion)) }}"
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040090 imagePullPolicy: {{ .Values.image.pullPolicy }}
91 args:
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040092 {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}}
93 {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +040094 - --v={{ .Values.global.logLevel }}
95 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +040096 {{- if .Values.config }}
97 - --config=/var/cert-manager/config/config.yaml
98 {{- end }}
99 {{- $config := default .Values.config "" }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400100 {{- if .Values.clusterResourceNamespace }}
101 - --cluster-resource-namespace={{ .Values.clusterResourceNamespace }}
102 {{- else }}
103 - --cluster-resource-namespace=$(POD_NAMESPACE)
104 {{- end }}
105 {{- with .Values.global.leaderElection }}
106 - --leader-election-namespace={{ .namespace }}
107 {{- if .leaseDuration }}
108 - --leader-election-lease-duration={{ .leaseDuration }}
109 {{- end }}
110 {{- if .renewDeadline }}
111 - --leader-election-renew-deadline={{ .renewDeadline }}
112 {{- end }}
113 {{- if .retryPeriod }}
114 - --leader-election-retry-period={{ .retryPeriod }}
115 {{- end }}
116 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400117 - --acme-http01-solver-image={{ template "cert-manager.image" (tuple .Values.acmesolver.image .Values.imageRegistry .Values.imageNamespace (printf ":%s" .Chart.AppVersion)) }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400118 {{- with .Values.extraArgs }}
119 {{- toYaml . | nindent 10 }}
120 {{- end }}
121 {{- with .Values.ingressShim }}
122 {{- if .defaultIssuerName }}
123 - --default-issuer-name={{ .defaultIssuerName }}
124 {{- end }}
125 {{- if .defaultIssuerKind }}
126 - --default-issuer-kind={{ .defaultIssuerKind }}
127 {{- end }}
128 {{- if .defaultIssuerGroup }}
129 - --default-issuer-group={{ .defaultIssuerGroup }}
130 {{- end }}
131 {{- end }}
132 {{- if .Values.featureGates }}
133 - --feature-gates={{ .Values.featureGates }}
134 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400135 {{- if .Values.global.commonLabels }}
136 {{- range $key, $value := .Values.global.commonLabels }}
137 - --acme-http01-solver-extra-labels={{ $key }}={{ $value }}
138 {{- end }}
139 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400140 {{- if .Values.maxConcurrentChallenges }}
141 - --max-concurrent-challenges={{ .Values.maxConcurrentChallenges }}
142 {{- end }}
143 {{- if .Values.enableCertificateOwnerRef }}
144 - --enable-certificate-owner-ref=true
145 {{- end }}
146 {{- if .Values.dns01RecursiveNameserversOnly }}
147 - --dns01-recursive-nameservers-only=true
148 {{- end }}
149 {{- with .Values.dns01RecursiveNameservers }}
150 - --dns01-recursive-nameservers={{ . }}
151 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400152 {{- if .Values.disableAutoApproval }}
153 - --controllers=-certificaterequests-approver
154 {{- end }}
155 {{- with .Values.acmesolver.runtimeClassName }}
156 - --acme-http01-solver-runtime-class-name={{ . | quote }}
157 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400158 ports:
159 - containerPort: 9402
160 name: http-metrics
161 protocol: TCP
162 - containerPort: 9403
163 name: http-healthz
164 protocol: TCP
165 {{- with .Values.containerSecurityContext }}
166 securityContext:
167 {{- toYaml . | nindent 12 }}
168 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400169 {{- if or .Values.config .Values.volumeMounts }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400170 volumeMounts:
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400171 {{- if .Values.config }}
172 - name: config
173 mountPath: /var/cert-manager/config
174 {{- end }}
175 {{- with .Values.volumeMounts }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400176 {{- toYaml . | nindent 12 }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400177 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400178 {{- end }}
179 env:
180 - name: POD_NAMESPACE
181 valueFrom:
182 fieldRef:
183 fieldPath: metadata.namespace
184 {{- with .Values.extraEnv }}
185 {{- toYaml . | nindent 10 }}
186 {{- end }}
187 {{- with .Values.http_proxy }}
188 - name: HTTP_PROXY
189 value: {{ . }}
190 {{- end }}
191 {{- with .Values.https_proxy }}
192 - name: HTTPS_PROXY
193 value: {{ . }}
194 {{- end }}
195 {{- with .Values.no_proxy }}
196 - name: NO_PROXY
197 value: {{ . }}
198 {{- end }}
199 {{- with .Values.resources }}
200 resources:
201 {{- toYaml . | nindent 12 }}
202 {{- end }}
203
204 {{- with .Values.livenessProbe }}
205 {{- if .enabled }}
206 # LivenessProbe settings are based on those used for the Kubernetes
207 # controller-manager. See:
208 # https://github.com/kubernetes/kubernetes/blob/806b30170c61a38fedd54cc9ede4cd6275a1ad3b/cmd/kubeadm/app/util/staticpod/utils.go#L241-L245
209 livenessProbe:
210 httpGet:
211 port: http-healthz
212 path: /livez
213 scheme: HTTP
214 initialDelaySeconds: {{ .initialDelaySeconds }}
215 periodSeconds: {{ .periodSeconds }}
216 timeoutSeconds: {{ .timeoutSeconds }}
217 successThreshold: {{ .successThreshold }}
218 failureThreshold: {{ .failureThreshold }}
219 {{- end }}
220 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400221 {{- if .Values.extraContainers }}
222 {{- toYaml .Values.extraContainers | nindent 8 }}
223 {{- end }}
224 {{- if .Values.runtimeClassName }}
225 runtimeClassName: {{ .Values.runtimeClassName | quote }}
226 {{- else if .Values.global.runtimeClassName }}
227 runtimeClassName: {{ .Values.global.runtimeClassName | quote }}
228 {{- end }}
229 {{- $nodeSelector := .Values.global.nodeSelector | default dict }}
230 {{- $nodeSelector = merge $nodeSelector (.Values.nodeSelector | default dict) }}
231 {{- with $nodeSelector }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400232 nodeSelector:
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400233 {{- range $key, $value := . }}
234 {{ $key }}: {{ $value | quote }}
235 {{- end }}
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +0400236 {{- end }}
237 {{- with .Values.affinity }}
238 affinity:
239 {{- toYaml . | nindent 8 }}
240 {{- end }}
241 {{- with .Values.tolerations }}
242 tolerations:
243 {{- toYaml . | nindent 8 }}
244 {{- end }}
245 {{- with .Values.topologySpreadConstraints }}
246 topologySpreadConstraints:
247 {{- toYaml . | nindent 8 }}
248 {{- end }}
249 {{- with .Values.podDnsPolicy }}
250 dnsPolicy: {{ . }}
251 {{- end }}
252 {{- with .Values.podDnsConfig }}
253 dnsConfig:
254 {{- toYaml . | nindent 8 }}
255 {{- end }}
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +0400256 {{- with .Values.hostAliases }}
257 hostAliases: {{ toYaml . | nindent 8 }}
258 {{- end }}