-
Notifications
You must be signed in to change notification settings - Fork 220
/
deployment.yaml
205 lines (205 loc) · 9.39 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
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.operator.name }}-metrics-apiserver
namespace: {{ .Release.Namespace }}
{{- with .Values.additionalAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ .Values.operator.name }}-metrics-apiserver
app.kubernetes.io/name: {{ .Values.operator.name }}-metrics-apiserver
{{- include "keda.labels" . | indent 4 }}
spec:
revisionHistoryLimit: {{ .Values.metricsServer.revisionHistoryLimit}}
replicas: {{ .Values.metricsServer.replicaCount }}
{{- with .Values.upgradeStrategy.metricsApiServer }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
app: {{ .Values.operator.name }}-metrics-apiserver
template:
metadata:
labels:
app: {{ .Values.operator.name }}-metrics-apiserver
app.kubernetes.io/name: {{ .Values.operator.name }}-metrics-apiserver
{{- include "keda.labels" . | indent 8 }}
{{- if .Values.podLabels.metricsAdapter }}
{{- toYaml .Values.podLabels.metricsAdapter | nindent 8}}
{{- end }}
{{- if or .Values.additionalAnnotations .Values.podAnnotations.metricsAdapter (and .Values.prometheus.metricServer.enabled ( not (or .Values.prometheus.metricServer.podMonitor.enabled .Values.prometheus.metricServer.serviceMonitor.enabled )) )}}
annotations:
{{- if .Values.additionalAnnotations }}
{{- toYaml .Values.additionalAnnotations | nindent 8 }}
{{- end }}
{{- if and .Values.prometheus.metricServer.enabled ( not (or .Values.prometheus.metricServer.podMonitor.enabled .Values.prometheus.metricServer.serviceMonitor.enabled )) }}
prometheus.io/scrape: "true"
prometheus.io/port: {{ .Values.prometheus.metricServer.port | quote }}
{{- end }}
{{- if .Values.podAnnotations.metricsAdapter }}
{{- toYaml .Values.podAnnotations.metricsAdapter | nindent 8}}
{{- end }}
{{- end }}
spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ (.Values.serviceAccount.metricServer).name | default .Values.serviceAccount.name }}
automountServiceAccountToken: {{ kindIs "invalid" (.Values.serviceAccount.metricServer).automountServiceAccountToken | ternary .Values.serviceAccount.automountServiceAccountToken (.Values.serviceAccount.metricServer).automountServiceAccountToken }}
securityContext:
{{- if .Values.podSecurityContext.metricServer }}
{{- toYaml .Values.podSecurityContext.metricServer | nindent 8 }}
{{- else }}
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- end }}
containers:
- name: {{ .Values.operator.name }}-metrics-apiserver
securityContext:
{{- if .Values.securityContext.metricServer }}
{{- toYaml .Values.securityContext.metricServer | nindent 12 }}
{{- else }}
{{- toYaml .Values.securityContext | nindent 12 }}
{{- end }}
{{- $registry := .Values.global.image.registry | default .Values.image.metricsApiServer.registry | default "" }}
{{- if $registry }}
image: "{{ $registry }}/{{ .Values.image.metricsApiServer.repository }}:{{ .Values.image.metricsApiServer.tag | default .Chart.AppVersion }}"
{{- else }}
image: "{{ .Values.image.metricsApiServer.repository }}:{{ .Values.image.metricsApiServer.tag | default .Chart.AppVersion }}"
{{- end }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.service.portHttpsTarget }}
scheme: HTTPS
initialDelaySeconds: {{ .Values.metricsServer.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.metricsServer.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.metricsServer.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.metricsServer.livenessProbe.failureThreshold }}
successThreshold: {{ .Values.metricsServer.livenessProbe.successThreshold }}
readinessProbe:
httpGet:
path: /readyz
port: {{ .Values.service.portHttpsTarget }}
scheme: HTTPS
initialDelaySeconds: {{ .Values.metricsServer.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.metricsServer.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.metricsServer.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.metricsServer.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.metricsServer.readinessProbe.successThreshold }}
env:
- name: WATCH_NAMESPACE
value: {{ .Values.watchNamespace | quote }}
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- 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.metricServer.restrict.secret }}
- name: KEDA_RESTRICT_SECRET_ACCESS
value: {{ .Values.permissions.metricServer.restrict.secret | quote }}
{{- end }}
{{- if .Values.env }}
{{- toYaml .Values.env | nindent 12 -}}
{{- end }}
args:
- /usr/local/bin/keda-adapter
- --port={{ .Values.prometheus.metricServer.port }}
- --secure-port={{ .Values.service.portHttpsTarget }}
- --logtostderr=true
- --stderrthreshold={{ .Values.logging.metricServer.stderrthreshold }}
- --disable-compression={{ .Values.metricsServer.disableCompression}}
- --metrics-service-address={{ .Values.operator.name }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}:9666
- --client-ca-file={{ .Values.certificates.mountPath }}/ca.crt
- --tls-cert-file={{ .Values.certificates.mountPath }}/tls.crt
- --tls-private-key-file={{ .Values.certificates.mountPath }}/tls.key
- --cert-dir={{ .Values.certificates.mountPath }}
- --v={{ .Values.logging.metricServer.level }}
{{- if .Values.profiling.metricsServer.enabled }}
- "--profiling-bind-address=:{{ .Values.profiling.metricsServer.port }}"
{{- end }}
{{- range $key, $value := .Values.extraArgs.metricsAdapter }}
- --{{ $key }}={{ $value }}
{{- end }}
ports:
- containerPort: {{ .Values.service.portHttpsTarget }}
name: https
protocol: TCP
- containerPort: {{ .Values.prometheus.metricServer.port }}
name: {{ .Values.prometheus.metricServer.portName }}
protocol: TCP
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.metricsApiServer.extraVolumeMounts }}
{{- toYaml .Values.volumes.metricsApiServer.extraVolumeMounts | nindent 10 }}
{{- end }}
resources:
{{- if .Values.resources.metricServer }}
{{- toYaml .Values.resources.metricServer | nindent 12 }}
{{- else }}
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
volumes:
- name: certificates
secret:
defaultMode: 420
secretName: {{ .Values.certificates.secretName }}
{{- 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.metricsApiServer.extraVolumes }}
{{- toYaml .Values.volumes.metricsApiServer.extraVolumes | nindent 6 }}
{{- end }}
dnsPolicy: {{ .Values.metricsServer.dnsPolicy }}
hostNetwork: {{ .Values.metricsServer.useHostNetwork }}
nodeSelector:
kubernetes.io/os: linux
{{- with .Values.nodeSelector }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.metricsServer.affinity }}
affinity:
{{- toYaml .Values.metricsServer.affinity | nindent 8 }}
{{- else if .Values.affinity }}
affinity:
{{- toYaml .Values.affinity | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints.metricsServer}}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}