blob: c4d267a242152738bec6adc67536a409bc5c4b84 [file] [log] [blame]
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +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 }}
gio33d62932026-07-23 16:39:35 +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 Lekveishvilid1234c12023-06-19 10:37:06 +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 }}
gio33d62932026-07-23 16:39:35 +040046 {{- if and .Values.prometheus.enabled (not (or .Values.prometheus.servicemonitor.enabled .Values.prometheus.podmonitor.enabled)) }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +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:
gio33d62932026-07-23 16:39:35 +040055 {{- if not .Values.serviceAccount.create }}
56 {{- with .Values.global.imagePullSecrets }}
57 imagePullSecrets:
58 {{- toYaml . | nindent 8 }}
59 {{- end }}
60 {{- end }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +040061 serviceAccountName: {{ template "cert-manager.serviceAccountName" . }}
62 {{- if hasKey .Values "automountServiceAccountToken" }}
63 automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
64 {{- end }}
gio33d62932026-07-23 16:39:35 +040065 enableServiceLinks: {{ .Values.enableServiceLinks }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +040066 {{- with .Values.global.priorityClassName }}
67 priorityClassName: {{ . | quote }}
68 {{- end }}
giod55d03a2026-07-23 16:57:48 +040069 {{- if (hasKey .Values.global "hostUsers") }}
gio15aa6632026-07-23 17:14:23 +040070 hostUsers: {{ .Values.global.hostUsers }}
giod55d03a2026-07-23 16:57:48 +040071 {{- end }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +040072 {{- with .Values.securityContext }}
73 securityContext:
74 {{- toYaml . | nindent 8 }}
75 {{- end }}
gio33d62932026-07-23 16:39:35 +040076 {{- if or .Values.volumes .Values.config}}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +040077 volumes:
gio33d62932026-07-23 16:39:35 +040078 {{- if .Values.config }}
gio15aa6632026-07-23 17:14:23 +040079 - name: config
80 configMap:
gio33d62932026-07-23 16:39:35 +040081 name: {{ include "cert-manager.fullname" . }}
82 {{- end }}
83 {{ with .Values.volumes }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +040084 {{- toYaml . | nindent 8 }}
gio33d62932026-07-23 16:39:35 +040085 {{- end }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +040086 {{- end }}
87 containers:
88 - name: {{ .Chart.Name }}-controller
gio15aa6632026-07-23 17:14:23 +040089 image: "{{ template "image" (tuple .Values.image .Values.imageRegistry .Values.imageNamespace (printf ":%s" .Chart.AppVersion)) }}"
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +040090 imagePullPolicy: {{ .Values.image.pullPolicy }}
91 args:
gio33d62932026-07-23 16:39:35 +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 Lekveishvilid1234c12023-06-19 10:37:06 +040094 - --v={{ .Values.global.logLevel }}
95 {{- end }}
gio33d62932026-07-23 16:39:35 +040096 {{- if .Values.config }}
97 - --config=/var/cert-manager/config/config.yaml
98 {{- end }}
99 {{- $config := default .Values.config "" }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +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 }}
gio15aa6632026-07-23 17:14:23 +0400117 - --acme-http01-solver-image={{ template "image" (tuple .Values.acmesolver.image .Values.imageRegistry .Values.imageNamespace (printf ":%s" .Chart.AppVersion)) }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +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 }}
135 {{- if .Values.maxConcurrentChallenges }}
136 - --max-concurrent-challenges={{ .Values.maxConcurrentChallenges }}
137 {{- end }}
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +0400138 {{- if .Values.enableCertificateOwnerRef }}
139 - --enable-certificate-owner-ref=true
140 {{- end }}
141 {{- if .Values.dns01RecursiveNameserversOnly }}
142 - --dns01-recursive-nameservers-only=true
143 {{- end }}
144 {{- with .Values.dns01RecursiveNameservers }}
145 - --dns01-recursive-nameservers={{ . }}
146 {{- end }}
gio33d62932026-07-23 16:39:35 +0400147 {{- if .Values.disableAutoApproval }}
148 - --controllers=-certificaterequests-approver
149 {{- end }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +0400150 ports:
151 - containerPort: 9402
152 name: http-metrics
153 protocol: TCP
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +0400154 - containerPort: 9403
155 name: http-healthz
156 protocol: TCP
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +0400157 {{- with .Values.containerSecurityContext }}
158 securityContext:
159 {{- toYaml . | nindent 12 }}
160 {{- end }}
gio33d62932026-07-23 16:39:35 +0400161 {{- if or .Values.config .Values.volumeMounts }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +0400162 volumeMounts:
gio33d62932026-07-23 16:39:35 +0400163 {{- if .Values.config }}
gio15aa6632026-07-23 17:14:23 +0400164 - name: config
gio33d62932026-07-23 16:39:35 +0400165 mountPath: /var/cert-manager/config
166 {{- end }}
167 {{- with .Values.volumeMounts }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +0400168 {{- toYaml . | nindent 12 }}
gio33d62932026-07-23 16:39:35 +0400169 {{- end }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +0400170 {{- end }}
171 env:
172 - name: POD_NAMESPACE
173 valueFrom:
174 fieldRef:
175 fieldPath: metadata.namespace
176 {{- with .Values.extraEnv }}
177 {{- toYaml . | nindent 10 }}
178 {{- end }}
179 {{- with .Values.http_proxy }}
180 - name: HTTP_PROXY
181 value: {{ . }}
182 {{- end }}
183 {{- with .Values.https_proxy }}
184 - name: HTTPS_PROXY
185 value: {{ . }}
186 {{- end }}
187 {{- with .Values.no_proxy }}
188 - name: NO_PROXY
189 value: {{ . }}
190 {{- end }}
191 {{- with .Values.resources }}
192 resources:
193 {{- toYaml . | nindent 12 }}
194 {{- end }}
Giorgi Lekveishvili0048a782023-06-20 18:32:21 +0400195
196 {{- with .Values.livenessProbe }}
197 {{- if .enabled }}
198 # LivenessProbe settings are based on those used for the Kubernetes
199 # controller-manager. See:
200 # https://github.com/kubernetes/kubernetes/blob/806b30170c61a38fedd54cc9ede4cd6275a1ad3b/cmd/kubeadm/app/util/staticpod/utils.go#L241-L245
201 livenessProbe:
202 httpGet:
203 port: http-healthz
204 path: /livez
205 scheme: HTTP
206 initialDelaySeconds: {{ .initialDelaySeconds }}
207 periodSeconds: {{ .periodSeconds }}
208 timeoutSeconds: {{ .timeoutSeconds }}
209 successThreshold: {{ .successThreshold }}
210 failureThreshold: {{ .failureThreshold }}
211 {{- end }}
212 {{- end }}
gio15aa6632026-07-23 17:14:23 +0400213 {{- if .Values.extraContainers }}
214 {{- toYaml .Values.extraContainers | nindent 8 }}
215 {{- end }}
giod55d03a2026-07-23 16:57:48 +0400216 {{- $nodeSelector := .Values.global.nodeSelector | default dict }}
217 {{- $nodeSelector = merge $nodeSelector (.Values.nodeSelector | default dict) }}
218 {{- with $nodeSelector }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +0400219 nodeSelector:
giob6e9f2f2026-07-23 16:53:10 +0400220 {{- range $key, $value := . }}
221 {{ $key }}: {{ $value | quote }}
222 {{- end }}
Giorgi Lekveishvilid1234c12023-06-19 10:37:06 +0400223 {{- end }}
224 {{- with .Values.affinity }}
225 affinity:
226 {{- toYaml . | nindent 8 }}
227 {{- end }}
228 {{- with .Values.tolerations }}
229 tolerations:
230 {{- toYaml . | nindent 8 }}
231 {{- end }}
232 {{- with .Values.topologySpreadConstraints }}
233 topologySpreadConstraints:
234 {{- toYaml . | nindent 8 }}
235 {{- end }}
236 {{- with .Values.podDnsPolicy }}
237 dnsPolicy: {{ . }}
238 {{- end }}
239 {{- with .Values.podDnsConfig }}
240 dnsConfig:
241 {{- toYaml . | nindent 8 }}
242 {{- end }}
gio33d62932026-07-23 16:39:35 +0400243 {{- with .Values.hostAliases }}
244 hostAliases: {{ toYaml . | nindent 8 }}
giod55d03a2026-07-23 16:57:48 +0400245 {{- end }}