-
Notifications
You must be signed in to change notification settings - Fork 235
/
Copy pathdeployment.yaml
245 lines (245 loc) · 10.3 KB
/
deployment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.operator.name }}
namespace: {{ .Release.Namespace }}
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ .Values.operator.name }}
name: {{ .Values.operator.name }}
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 4 }}
spec:
revisionHistoryLimit: {{ .Values.operator.revisionHistoryLimit}}
replicas: {{ .Values.operator.replicaCount}}
{{- with .Values.upgradeStrategy.operator }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
app: {{ .Values.operator.name }}
template:
metadata:
labels:
app: {{ .Values.operator.name }}
name: {{ .Values.operator.name }}
app.kubernetes.io/name: {{ .Values.operator.name }}
{{- include "keda.labels" . | indent 8 }}
{{- if .Values.podLabels.keda }}
{{- toYaml .Values.podLabels.keda | nindent 8 }}
{{- end }}
{{- if .Values.podIdentity.azureWorkload.enabled }}
azure.workload.identity/use: "true"
{{- end }}
{{- if or .Values.podAnnotations.keda .Values.additionalAnnotations }}
annotations:
{{- if .Values.podAnnotations.keda }}
{{- toYaml .Values.podAnnotations.keda | nindent 8 }}
{{- end }}
{{- if .Values.additionalAnnotations }}
{{- toYaml .Values.additionalAnnotations | nindent 8 }}
{{- end }}
{{- end }}
spec:
enableServiceLinks: {{ .Values.enableServiceLinks }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ (.Values.serviceAccount.operator).name | default .Values.serviceAccount.name }}
automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.operator).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.operator).automountServiceAccountToken }}
securityContext:
{{- if .Values.podSecurityContext.operator }}
{{- toYaml .Values.podSecurityContext.operator | nindent 8 }}
{{- else }}
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: {{ .Values.operator.name }}
securityContext:
{{- if .Values.securityContext.operator }}
{{- toYaml .Values.securityContext.operator | nindent 12 }}
{{- else }}
{{- toYaml .Values.securityContext | nindent 12 }}
{{- end }}
{{- $registry := .Values.global.image.registry | default .Values.image.keda.registry | default "" }}
{{- if $registry }}
image: "{{ $registry }}/{{ .Values.image.keda.repository }}:{{ .Values.image.keda.tag | default .Chart.AppVersion }}"
{{- else }}
image: "{{ .Values.image.keda.repository }}:{{ .Values.image.keda.tag | default .Chart.AppVersion }}"
{{- end }}
command:
- "/keda"
args:
- "--leader-elect"
- "--disable-compression={{ .Values.operator.disableCompression}}"
- "--zap-log-level={{ .Values.logging.operator.level }}"
- "--zap-encoder={{ .Values.logging.operator.format }}"
- "--zap-time-encoding={{ .Values.logging.operator.timeEncoding }}"
- "--enable-webhook-patching={{ .Values.webhooks.enabled }}"
{{- if .Values.logging.operator.stackTracesEnabled }}
- "--zap-stacktrace-level=error"
{{- end }}
- "--cert-dir={{ .Values.certificates.mountPath }}"
- "--enable-cert-rotation={{ and .Values.certificates.autoGenerated ( not .Values.certificates.certManager.enabled ) }}"
- "--cert-secret-name={{ .Values.certificates.secretName }}"
- "--operator-service-name={{ .Values.operator.name }}"
- "--metrics-server-service-name={{ .Values.operator.name }}-metrics-apiserver"
- "--webhooks-service-name={{ .Values.webhooks.name }}"
- "--k8s-cluster-name={{ tpl .Values.clusterName . }}"
- "--k8s-cluster-domain={{ .Values.clusterDomain }}"
- "--enable-prometheus-metrics={{ .Values.prometheus.operator.enabled }}"
{{- if .Values.prometheus.operator.enabled }}
- "--metrics-bind-address=:{{ .Values.prometheus.operator.port }}"
{{- end }}
{{- if .Values.opentelemetry.operator.enabled }}
- "--enable-opentelemetry-metrics={{ .Values.opentelemetry.operator.enabled}}"
{{- end }}
{{- if .Values.profiling.operator.enabled }}
- "--profiling-bind-address=:{{ .Values.profiling.operator.port }}"
{{- end }}
{{- with (.Values.certificates.operator).caDirs }}
{{- range . }}
- "--ca-dir={{ . }}"
{{- end }}
{{- end }}
{{- range $key, $value := .Values.extraArgs.keda }}
- "--{{ $key }}={{ $value }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: {{ .Values.operator.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.operator.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.operator.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.operator.livenessProbe.failureThreshold }}
successThreshold: {{ .Values.operator.livenessProbe.successThreshold }}
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: {{ .Values.operator.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.operator.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.operator.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.operator.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.operator.readinessProbe.successThreshold }}
ports:
{{- if .Values.prometheus.operator.enabled }}
- containerPort: {{ .Values.prometheus.operator.port }}
name: metrics
protocol: TCP
{{- end }}
- containerPort: 9666
name: metricsservice
protocol: TCP
env:
- name: WATCH_NAMESPACE
value: {{ .Values.watchNamespace | quote }}
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OPERATOR_NAME
value: {{ .Values.operator.name }}
- name: KEDA_HTTP_DEFAULT_TIMEOUT
value: {{ .Values.http.timeout | quote }}
- name: KEDA_HTTP_MIN_TLS_VERSION
value: {{ .Values.http.minTlsVersion }}
{{- if ( not .Values.http.keepAlive.enabled ) }}
- name: KEDA_HTTP_DISABLE_KEEP_ALIVE
value: "true"
{{- end }}
{{- if .Values.permissions.operator.restrict.secret }}
- name: KEDA_RESTRICT_SECRET_ACCESS
value: {{ .Values.permissions.operator.restrict.secret | quote }}
{{- end }}
{{- if .Values.opentelemetry.collector.uri }}
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: {{ .Values.opentelemetry.collector.uri | quote }}
{{- end }}
{{- if .Values.env }}
{{- toYaml .Values.env | nindent 12 -}}
{{- end }}
volumeMounts:
- mountPath: {{ .Values.certificates.mountPath }}
name: certificates
readOnly: true
{{- if .Values.grpcTLSCertsSecret }}
- name: grpc-certs
mountPath: /grpccerts
{{- end }}
{{- if .Values.hashiCorpVaultTLS }}
- name: hashicorp-vault-certs
mountPath: /hashicorp-vaultcerts
{{- end }}
{{- if .Values.volumes.keda.extraVolumeMounts }}
{{- toYaml .Values.volumes.keda.extraVolumeMounts | nindent 10 }}
{{- end }}
resources:
{{- if .Values.resources.operator }}
{{- toYaml .Values.resources.operator | nindent 12 }}
{{- else }}
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
{{- if .Values.operator.extraContainers }}
{{- toYaml .Values.operator.extraContainers | nindent 8 }}
{{- end }}
{{- if .Values.operator.extraInitContainers }}
initContainers:
{{- toYaml .Values.operator.extraInitContainers | nindent 8 }}
{{- end }}
volumes:
- name: certificates
secret:
defaultMode: 420
secretName: {{ .Values.certificates.secretName }}
optional: {{ and .Values.certificates.autoGenerated ( not .Values.certificates.certManager.enabled ) }}
{{- if .Values.grpcTLSCertsSecret }}
- name: grpc-certs
secret:
secretName: {{ .Values.grpcTLSCertsSecret }}
{{- end }}
{{- if .Values.hashiCorpVaultTLS }}
- name: hashicorp-vault-certs
secret:
secretName: {{ .Values.hashiCorpVaultTLS }}
{{- end }}
{{- if .Values.volumes.keda.extraVolumes }}
{{- toYaml .Values.volumes.keda.extraVolumes | nindent 6 }}
{{- end }}
nodeSelector:
kubernetes.io/os: linux
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.podIdentity.gcp.enabled }}
iam.gke.io/gke-metadata-server-enabled: "true"
{{- end }}
{{- if .Values.operator.affinity }}
affinity:
{{- toYaml .Values.operator.affinity | nindent 8 }}
{{- else if .Values.affinity }}
affinity:
{{- toYaml .Values.affinity | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints.operator }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}