blob: 453e82386f715791db87083628733a8c15dc6c83 [file] [log] [blame]
gio15aa6632026-07-23 17:14:23 +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 }}
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 }}
22 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 }}
46 {{- if and .Values.prometheus.enabled (not (or .Values.prometheus.servicemonitor.enabled .Values.prometheus.podmonitor.enabled)) }}
47 {{- 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:
55 {{- if not .Values.serviceAccount.create }}
56 {{- with .Values.global.imagePullSecrets }}
57 imagePullSecrets:
58 {{- toYaml . | nindent 8 }}
59 {{- end }}
60 {{- end }}
61 serviceAccountName: {{ template "cert-manager.serviceAccountName" . }}
62 {{- if hasKey .Values "automountServiceAccountToken" }}
63 automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
64 {{- end }}
65 enableServiceLinks: {{ .Values.enableServiceLinks }}
66 {{- with .Values.global.priorityClassName }}
67 priorityClassName: {{ . | quote }}
68 {{- end }}
69 {{- if (hasKey .Values.global "hostUsers") }}
70 hostUsers: {{ .Values.global.hostUsers }}
71 {{- end }}
72 {{- with .Values.securityContext }}
73 securityContext:
74 {{- toYaml . | nindent 8 }}
75 {{- end }}
76 {{- if or .Values.volumes .Values.config}}
77 volumes:
78 {{- if .Values.config }}
79 - name: config
80 configMap:
81 name: {{ include "cert-manager.fullname" . }}
82 {{- end }}
83 {{ with .Values.volumes }}
84 {{- toYaml . | nindent 8 }}
85 {{- end }}
86 {{- end }}
87 containers:
88 - name: {{ .Chart.Name }}-controller
89 image: "{{ template "image" (tuple .Values.image $.Chart.AppVersion) }}"
90 imagePullPolicy: {{ .Values.image.pullPolicy }}
91 args:
92 {{- /* 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 ""))) }}
94 - --v={{ .Values.global.logLevel }}
95 {{- end }}
96 {{- if .Values.config }}
97 - --config=/var/cert-manager/config/config.yaml
98 {{- end }}
99 {{- $config := default .Values.config "" }}
100 {{- 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 }}
117 {{- with .Values.acmesolver.image }}
118 - --acme-http01-solver-image={{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}{{- if (.digest) -}} @{{ .digest }}{{- else -}}:{{ default $.Chart.AppVersion .tag }} {{- end -}}
119 {{- end }}
120 {{- with .Values.extraArgs }}
121 {{- toYaml . | nindent 10 }}
122 {{- end }}
123 {{- with .Values.ingressShim }}
124 {{- if .defaultIssuerName }}
125 - --default-issuer-name={{ .defaultIssuerName }}
126 {{- end }}
127 {{- if .defaultIssuerKind }}
128 - --default-issuer-kind={{ .defaultIssuerKind }}
129 {{- end }}
130 {{- if .defaultIssuerGroup }}
131 - --default-issuer-group={{ .defaultIssuerGroup }}
132 {{- end }}
133 {{- end }}
134 {{- if .Values.featureGates }}
135 - --feature-gates={{ .Values.featureGates }}
136 {{- end }}
137 {{- if .Values.maxConcurrentChallenges }}
138 - --max-concurrent-challenges={{ .Values.maxConcurrentChallenges }}
139 {{- end }}
140 {{- if .Values.enableCertificateOwnerRef }}
141 - --enable-certificate-owner-ref=true
142 {{- end }}
143 {{- if .Values.dns01RecursiveNameserversOnly }}
144 - --dns01-recursive-nameservers-only=true
145 {{- end }}
146 {{- with .Values.dns01RecursiveNameservers }}
147 - --dns01-recursive-nameservers={{ . }}
148 {{- end }}
149 {{- if .Values.disableAutoApproval }}
150 - --controllers=-certificaterequests-approver
151 {{- end }}
152 ports:
153 - containerPort: 9402
154 name: http-metrics
155 protocol: TCP
156 - containerPort: 9403
157 name: http-healthz
158 protocol: TCP
159 {{- with .Values.containerSecurityContext }}
160 securityContext:
161 {{- toYaml . | nindent 12 }}
162 {{- end }}
163 {{- if or .Values.config .Values.volumeMounts }}
164 volumeMounts:
165 {{- if .Values.config }}
166 - name: config
167 mountPath: /var/cert-manager/config
168 {{- end }}
169 {{- with .Values.volumeMounts }}
170 {{- toYaml . | nindent 12 }}
171 {{- end }}
172 {{- end }}
173 env:
174 - name: POD_NAMESPACE
175 valueFrom:
176 fieldRef:
177 fieldPath: metadata.namespace
178 {{- with .Values.extraEnv }}
179 {{- toYaml . | nindent 10 }}
180 {{- end }}
181 {{- with .Values.http_proxy }}
182 - name: HTTP_PROXY
183 value: {{ . }}
184 {{- end }}
185 {{- with .Values.https_proxy }}
186 - name: HTTPS_PROXY
187 value: {{ . }}
188 {{- end }}
189 {{- with .Values.no_proxy }}
190 - name: NO_PROXY
191 value: {{ . }}
192 {{- end }}
193 {{- with .Values.resources }}
194 resources:
195 {{- toYaml . | nindent 12 }}
196 {{- end }}
197
198 {{- with .Values.livenessProbe }}
199 {{- if .enabled }}
200 # LivenessProbe settings are based on those used for the Kubernetes
201 # controller-manager. See:
202 # https://github.com/kubernetes/kubernetes/blob/806b30170c61a38fedd54cc9ede4cd6275a1ad3b/cmd/kubeadm/app/util/staticpod/utils.go#L241-L245
203 livenessProbe:
204 httpGet:
205 port: http-healthz
206 path: /livez
207 scheme: HTTP
208 initialDelaySeconds: {{ .initialDelaySeconds }}
209 periodSeconds: {{ .periodSeconds }}
210 timeoutSeconds: {{ .timeoutSeconds }}
211 successThreshold: {{ .successThreshold }}
212 failureThreshold: {{ .failureThreshold }}
213 {{- end }}
214 {{- end }}
215 {{- $nodeSelector := .Values.global.nodeSelector | default dict }}
216 {{- $nodeSelector = merge $nodeSelector (.Values.nodeSelector | default dict) }}
217 {{- with $nodeSelector }}
218 nodeSelector:
219 {{- range $key, $value := . }}
220 {{ $key }}: {{ $value | quote }}
221 {{- end }}
222 {{- end }}
223 {{- with .Values.affinity }}
224 affinity:
225 {{- toYaml . | nindent 8 }}
226 {{- end }}
227 {{- with .Values.tolerations }}
228 tolerations:
229 {{- toYaml . | nindent 8 }}
230 {{- end }}
231 {{- with .Values.topologySpreadConstraints }}
232 topologySpreadConstraints:
233 {{- toYaml . | nindent 8 }}
234 {{- end }}
235 {{- with .Values.podDnsPolicy }}
236 dnsPolicy: {{ . }}
237 {{- end }}
238 {{- with .Values.podDnsConfig }}
239 dnsConfig:
240 {{- toYaml . | nindent 8 }}
241 {{- end }}
242 {{- with .Values.hostAliases }}
243 hostAliases: {{ toYaml . | nindent 8 }}
244 {{- end }}