blob: 79ba857d59d756b173a7bb56ffb77a00b9587d93 [file] [log] [blame]
Giorgi Lekveishviliea328da2026-07-29 12:15:15 +04001{{- if .Values.cainjector.enabled }}
2apiVersion: apps/v1
3kind: Deployment
4metadata:
5 name: {{ include "cainjector.fullname" . }}
6 namespace: {{ include "cert-manager.namespace" . }}
7 labels:
8 app: {{ include "cainjector.name" . }}
9 app.kubernetes.io/name: {{ include "cainjector.name" . }}
10 app.kubernetes.io/instance: {{ .Release.Name }}
11 app.kubernetes.io/component: "cainjector"
12 {{- include "labels" . | nindent 4 }}
13 {{- with .Values.cainjector.deploymentAnnotations }}
14 annotations:
15 {{- toYaml . | nindent 4 }}
16 {{- end }}
17spec:
18 replicas: {{ .Values.cainjector.replicaCount }}
19 {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}}
20 {{- if not (has (quote .Values.global.revisionHistoryLimit) (list "" (quote ""))) }}
21 revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }}
22 {{- end }}
23 selector:
24 matchLabels:
25 app.kubernetes.io/name: {{ include "cainjector.name" . }}
26 app.kubernetes.io/instance: {{ .Release.Name }}
27 app.kubernetes.io/component: "cainjector"
28 {{- with .Values.cainjector.strategy }}
29 strategy:
30 {{- toYaml . | nindent 4 }}
31 {{- end }}
32 template:
33 metadata:
34 labels:
35 app: {{ include "cainjector.name" . }}
36 app.kubernetes.io/name: {{ include "cainjector.name" . }}
37 app.kubernetes.io/instance: {{ .Release.Name }}
38 app.kubernetes.io/component: "cainjector"
39 {{- include "labels" . | nindent 8 }}
40 {{- with .Values.cainjector.podLabels }}
41 {{- toYaml . | nindent 8 }}
42 {{- end }}
43 {{- with .Values.cainjector.podAnnotations }}
44 annotations:
45 {{- toYaml . | nindent 8 }}
46 {{- end }}
47 {{- if and .Values.prometheus.enabled (not (or .Values.prometheus.servicemonitor.enabled .Values.prometheus.podmonitor.enabled)) }}
48 {{- if not .Values.cainjector.podAnnotations }}
49 annotations:
50 {{- end }}
51 prometheus.io/path: "/metrics"
52 prometheus.io/scrape: 'true'
53 prometheus.io/port: '9402'
54 {{- end }}
55 spec:
56 {{- if not .Values.cainjector.serviceAccount.create }}
57 {{- with .Values.global.imagePullSecrets }}
58 imagePullSecrets:
59 {{- toYaml . | nindent 8 }}
60 {{- end }}
61 {{- end }}
62 serviceAccountName: {{ template "cainjector.serviceAccountName" . }}
63 {{- if hasKey .Values.cainjector "automountServiceAccountToken" }}
64 automountServiceAccountToken: {{ .Values.cainjector.automountServiceAccountToken }}
65 {{- end }}
66 enableServiceLinks: {{ .Values.cainjector.enableServiceLinks }}
67 {{- with .Values.global.priorityClassName }}
68 priorityClassName: {{ . | quote }}
69 {{- end }}
70 {{- with .Values.cainjector.securityContext }}
71 securityContext:
72 {{- toYaml . | nindent 8 }}
73 {{- end }}
74 containers:
75 - name: {{ .Chart.Name }}-cainjector
76 image: "{{ template "image" (tuple .Values.cainjector.image $.Chart.AppVersion) }}"
77 imagePullPolicy: {{ .Values.cainjector.image.pullPolicy }}
78 args:
79 {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}}
80 {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }}
81 - --v={{ .Values.global.logLevel }}
82 {{- end }}
83 {{- if .Values.cainjector.config }}
84 - --config=/var/cert-manager/config/config.yaml
85 {{- end }}
86 {{- with .Values.global.leaderElection }}
87 - --leader-election-namespace={{ .namespace }}
88 {{- if .leaseDuration }}
89 - --leader-election-lease-duration={{ .leaseDuration }}
90 {{- end }}
91 {{- if .renewDeadline }}
92 - --leader-election-renew-deadline={{ .renewDeadline }}
93 {{- end }}
94 {{- if .retryPeriod }}
95 - --leader-election-retry-period={{ .retryPeriod }}
96 {{- end }}
97 {{- end }}
98 {{- with .Values.cainjector.featureGates}}
99 - --feature-gates={{ . }}
100 {{- end}}
101 {{- with .Values.cainjector.extraArgs }}
102 {{- toYaml . | nindent 10 }}
103 {{- end }}
104 {{- if not .Values.prometheus.enabled }}
105 - --metrics-listen-address=0
106 {{- end }}
107 {{- if .Values.prometheus.enabled }}
108 ports:
109 - containerPort: 9402
110 name: http-metrics
111 protocol: TCP
112 {{- end }}
113 env:
114 - name: POD_NAMESPACE
115 valueFrom:
116 fieldRef:
117 fieldPath: metadata.namespace
118 {{- with .Values.cainjector.extraEnv }}
119 {{- toYaml . | nindent 10 }}
120 {{- end }}
121 {{- with .Values.cainjector.containerSecurityContext }}
122 securityContext:
123 {{- toYaml . | nindent 12 }}
124 {{- end }}
125 {{- with .Values.cainjector.resources }}
126 resources:
127 {{- toYaml . | nindent 12 }}
128 {{- end }}
129 {{- if or .Values.cainjector.config .Values.cainjector.volumeMounts }}
130 volumeMounts:
131 {{- if .Values.cainjector.config }}
132 - name: config
133 mountPath: /var/cert-manager/config
134 {{- end }}
135 {{- with .Values.cainjector.volumeMounts }}
136 {{- toYaml . | nindent 12 }}
137 {{- end }}
138 {{- end }}
139 {{- with .Values.cainjector.nodeSelector }}
140 nodeSelector:
141 {{- range $key, $value := . }}
142 {{ $key }}: {{ $value | quote }}
143 {{- end }}
144 {{- end }}
145 {{- with .Values.cainjector.affinity }}
146 affinity:
147 {{- toYaml . | nindent 8 }}
148 {{- end }}
149 {{- with .Values.cainjector.tolerations }}
150 tolerations:
151 {{- toYaml . | nindent 8 }}
152 {{- end }}
153 {{- with .Values.cainjector.topologySpreadConstraints }}
154 topologySpreadConstraints:
155 {{- toYaml . | nindent 8 }}
156 {{- end }}
157 {{- if or .Values.cainjector.volumes .Values.cainjector.config }}
158 volumes:
159 {{- if .Values.cainjector.config }}
160 - name: config
161 configMap:
162 name: {{ include "cainjector.fullname" . }}
163 {{- end }}
164 {{ with .Values.cainjector.volumes }}
165 {{- toYaml . | nindent 8 }}
166 {{- end }}
167 {{- end }}
168{{- end }}