@@ -16,6 +16,10 @@ metadata:
16
16
{{- end }}
17
17
spec :
18
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 }}
19
23
selector :
20
24
matchLabels :
21
25
app.kubernetes.io/name : {{ include "cainjector.name" . }}
@@ -40,11 +44,20 @@ spec:
40
44
annotations :
41
45
{{- toYaml . | nindent 8 }}
42
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 }}
43
55
spec :
44
56
serviceAccountName : {{ template "cainjector.serviceAccountName" . }}
45
57
{{- if hasKey .Values.cainjector "automountServiceAccountToken" }}
46
58
automountServiceAccountToken : {{ .Values.cainjector.automountServiceAccountToken }}
47
59
{{- end }}
60
+ enableServiceLinks : {{ .Values.cainjector.enableServiceLinks }}
48
61
{{- with .Values.global.priorityClassName }}
49
62
priorityClassName : {{ . | quote }}
50
63
{{- end }}
@@ -54,14 +67,16 @@ spec:
54
67
{{- end }}
55
68
containers :
56
69
- name : {{ .Chart.Name }}-cainjector
57
- {{- with .Values.cainjector.image }}
58
- image : " {{- if .registry -}}{{ .registry }}/{{- end -}}{{ .repository }}{{- if (.digest) -}} @{{ .digest }}{{- else -}}:{{ default $.Chart.AppVersion .tag }} {{- end -}}"
59
- {{- end }}
70
+ image : " {{ template " image" (tuple .Values.cainjector.image $.Chart.AppVersion) }}"
60
71
imagePullPolicy : {{ .Values.cainjector.image.pullPolicy }}
61
72
args :
62
- {{- if .Values.global.logLevel }}
73
+ {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}}
74
+ {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }}
63
75
- --v={{ .Values.global.logLevel }}
64
76
{{- end }}
77
+ {{- if .Values.cainjector.config }}
78
+ - --config=/var/cert-manager/config/config.yaml
79
+ {{- end }}
65
80
{{- with .Values.global.leaderElection }}
66
81
- --leader-election-namespace={{ .namespace }}
67
82
{{- if .leaseDuration }}
@@ -74,14 +89,29 @@ spec:
74
89
- --leader-election-retry-period={{ .retryPeriod }}
75
90
{{- end }}
76
91
{{- end }}
92
+ {{- with .Values.cainjector.featureGates}}
93
+ - --feature-gates={{ . }}
94
+ {{- end}}
77
95
{{- with .Values.cainjector.extraArgs }}
78
96
{{- toYaml . | nindent 10 }}
79
97
{{- end }}
98
+ {{- if not .Values.prometheus.enabled }}
99
+ - --metrics-listen-address=0
100
+ {{- end }}
101
+ {{- if .Values.prometheus.enabled }}
102
+ ports :
103
+ - containerPort : 9402
104
+ name : http-metrics
105
+ protocol : TCP
106
+ {{- end }}
80
107
env :
81
108
- name : POD_NAMESPACE
82
109
valueFrom :
83
110
fieldRef :
84
111
fieldPath : metadata.namespace
112
+ {{- with .Values.cainjector.extraEnv }}
113
+ {{- toYaml . | nindent 10 }}
114
+ {{- end }}
85
115
{{- with .Values.cainjector.containerSecurityContext }}
86
116
securityContext :
87
117
{{- toYaml . | nindent 12 }}
@@ -90,6 +120,16 @@ spec:
90
120
resources :
91
121
{{- toYaml . | nindent 12 }}
92
122
{{- end }}
123
+ {{- if or .Values.cainjector.config .Values.cainjector.volumeMounts }}
124
+ volumeMounts :
125
+ {{- if .Values.cainjector.config }}
126
+ - name : config
127
+ mountPath : /var/cert-manager/config
128
+ {{- end }}
129
+ {{- with .Values.cainjector.volumeMounts }}
130
+ {{- toYaml . | nindent 12 }}
131
+ {{- end }}
132
+ {{- end }}
93
133
{{- with .Values.cainjector.nodeSelector }}
94
134
nodeSelector :
95
135
{{- toYaml . | nindent 8 }}
@@ -106,4 +146,15 @@ spec:
106
146
topologySpreadConstraints :
107
147
{{- toYaml . | nindent 8 }}
108
148
{{- end }}
149
+ {{- if or .Values.cainjector.volumes .Values.cainjector.config }}
150
+ volumes :
151
+ {{- if .Values.cainjector.config }}
152
+ - name : config
153
+ configMap :
154
+ name : {{ include "cainjector.fullname" . }}
155
+ {{- end }}
156
+ {{ with .Values.cainjector.volumes }}
157
+ {{- toYaml . | nindent 8 }}
158
+ {{- end }}
159
+ {{- end }}
109
160
{{- end }}
0 commit comments