-
Notifications
You must be signed in to change notification settings - Fork 280
Expand file tree
/
Copy pathdeployment.yaml
More file actions
297 lines (297 loc) · 12.1 KB
/
Copy pathdeployment.yaml
File metadata and controls
297 lines (297 loc) · 12.1 KB
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "kubeblocks.fullname" . }}
{{- with .Values.deployAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "kubeblocks.labels" . | nindent 4 }}
app.kubernetes.io/component: "apps"
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ include "kubeblocks.replicaCount" . }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/component: "apps"
{{- include "kubeblocks.selectorLabels" . | nindent 6 }}
{{- with .Values.extraLabels }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- if .Values.updateStrategy }}
strategy:
{{ toYaml .Values.updateStrategy | nindent 4 | trim }}
{{- end }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/component: "apps"
{{- include "kubeblocks.selectorLabels" . | nindent 8 }}
{{- with .Values.extraLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
priorityClassName: {{ template "kubeblocks.priorityClassName" . }}
{{- with .Values.image.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "kubeblocks.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers: # only download tools image to local
- name: tools
image: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tools.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
limits:
cpu: 50m
memory: 64Mi
requests:
cpu: 50m
memory: 64Mi
command:
- /bin/true
containers:
- name: manager
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=:8080"
- "--leader-elect"
{{- with .Values.manager.leaderElection }}
- "--leader-elect-id={{- default "001c317f" .Id }}"
{{- end }}
{{- if .Values.manager.leaderElection.leaseDuration }}
- "--leader-elect-lease-duration={{ .Values.manager.leaderElection.leaseDuration }}"
{{- end }}
{{- if .Values.manager.leaderElection.renewDeadline }}
- "--leader-elect-renew-deadline={{ .Values.manager.leaderElection.renewDeadline }}"
{{- end }}
{{- if .Values.manager.leaderElection.retryPeriod }}
- "--leader-elect-retry-period={{ .Values.manager.leaderElection.retryPeriod }}"
{{- end }}
- "--zap-devel={{- default "false" .Values.loggerSettings.developmentMode }}"
- "--zap-time-encoding={{- default "iso8601" .Values.loggerSettings.timeEncoding }}"
{{- with .Values.loggerSettings.level }}
- "--zap-log-level={{ . }}"
{{- end }}
{{- with .Values.loggerSettings.encoder }}
- "--zap-encoder={{ . }}"
{{- end }}
- "--apps={{ ne .Values.controllers.apps.enabled false }}"
- "--workloads={{ ne .Values.controllers.workloads.enabled false }}"
- "--operations={{ ne .Values.controllers.operations.enabled false }}"
- "--extensions={{- default "true" ( include "kubeblocks.addonControllerEnabled" . ) }}"
- "--experimental={{- default "false" .Values.controllers.experimental.enabled }}"
- "--trace={{- default "false" .Values.controllers.trace.enabled }}"
{{- with .Values.managedNamespaces }}
- "--managed-namespaces={{ . }}"
{{- end }}
{{- if .Values.multiCluster.kubeConfig }}
- "--multi-cluster-kubeconfig={{ .Values.multiCluster.mountPath }}/kubeconfig"
{{- end }}
{{- if .Values.multiCluster.contexts }}
- "--multi-cluster-contexts={{ .Values.multiCluster.contexts }}"
{{- end }}
{{- if .Values.multiCluster.contextsDisabled }}
- "--multi-cluster-contexts-disabled={{ .Values.multiCluster.contextsDisabled }}"
{{- end }}
{{- if .Values.userAgent }}
- "--user-agent={{ .Values.userAgent }}"
{{- end }}
env:
- name: CM_NAMESPACE
value: {{ .Release.Namespace }}
{{- with .Values.affinity }}
- name: CM_AFFINITY
value: {{ toJson . | quote }}
{{- end }}
{{- if .Values.reconcileWorkers }}
- name: KUBEBLOCKS_RECONCILE_WORKERS
value: {{ .Values.reconcileWorkers | quote }}
{{- end }}
{{- if .Values.cache.syncTimeout }}
- name: CACHE_SYNC_TIMEOUT
value: {{ .Values.cache.syncTimeout | quote }}
{{- end }}
{{- if .Values.client.qps }}
- name: CLIENT_QPS
value: {{ .Values.client.qps | quote }}
{{- end }}
{{- if .Values.client.burst }}
- name: CLIENT_BURST
value: {{ .Values.client.burst | quote }}
{{- end }}
{{- with .Values.nodeSelector }}
- name: CM_NODE_SELECTOR
value: {{ toJson . | quote }}
{{- end }}
{{- with .Values.tolerations }}
- name: CM_TOLERATIONS
value: {{ toJson . | quote }}
{{- end }}
- name: KUBEBLOCKS_IMAGE_PULL_POLICY
value: {{ .Values.image.pullPolicy }}
- name: KUBEBLOCKS_IMAGE_PULL_SECRETS
value: {{ .Values.image.imagePullSecrets | toJson | quote }}
- name: KUBEBLOCKS_TOOLS_IMAGE
value: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.tools.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
- name: KUBEBLOCKS_SERVICEACCOUNT_NAME
value: {{ include "kubeblocks.serviceAccountName" . }}
{{- if .Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1" }}
- name: VOLUMESNAPSHOT_API_BETA
value: "false"
{{- else if .Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta1" }}
- name: VOLUMESNAPSHOT_API_BETA
value: "true"
{{- end }}
{{- if .Values.webhooks.conversionEnabled }}
- name: ENABLE_WEBHOOKS
value: "true"
{{- end }}
- name: ENABLE_RBAC_MANAGER
value: {{ .Values.rbac.enabled | quote}}
{{- if ( include "kubeblocks.addonControllerEnabled" . ) | deepEqual "true" }}
{{- with .Values.addonController }}
- name: ADDON_JOB_TTL
value: {{ .jobTTL | quote }}
- name: ADDON_JOB_IMAGE_PULL_POLICY
value: {{ .jobImagePullPolicy | default "IfNotPresent" }}
{{- end }}
- name: KUBEBLOCKS_ADDON_HELM_INSTALL_OPTIONS
value: {{ join " " .Values.addonHelmInstallOptions }}
- name: KUBEBLOCKS_ADDON_CHARTS_IMAGE_PULL_POLICY
value: {{ .Values.addonChartsImage.pullPolicy | default "IfNotPresent" }}
{{- end }}
{{- if .Values.enabledAlphaFeatureGates.recoverVolumeExpansionFailure }}
- name: RECOVER_VOLUME_EXPANSION_FAILURE
value: "true"
{{- end }}
- name: DP_ENCRYPTION_KEY
valueFrom:
secretKeyRef:
{{- include "dataprotection.encryptionKeySecretKeyRef" . | nindent 18 }}
- name: KUBE_PROVIDER
value: {{ .Values.provider | quote }}
- name: HOST_PORT_INCLUDE_RANGES
value: '{{ join "," .Values.hostPorts.include }}'
- name: HOST_PORT_EXCLUDE_RANGES
value: '{{ join "," .Values.hostPorts.exclude }}'
- name: HOST_PORT_CM_NAME
value: {{ include "kubeblocks.fullname" . }}-host-ports
{{- if .Values.serviceMonitor.goRuntime.enabled }}
- name: ENABLED_RUNTIME_METRICS
value: "true"
{{- end }}
{{- if .Values.featureGates.ignoreConfigTemplateDefaultMode.enabled }}
- name: IGNORE_CONFIG_TEMPLATE_DEFAULT_MODE
value: "true"
{{- end }}
{{- if .Values.featureGates.ignorePodVerticalScaling.enabled }}
- name: IGNORE_POD_VERTICAL_SCALING
value: "true"
{{- end }}
- name: COMPONENT_REPLICAS_ANNOTATION
value: {{ .Values.featureGates.componentReplicasAnnotation.enabled | quote }}
- name: IN_PLACE_POD_VERTICAL_SCALING
value: {{ .Values.featureGates.inPlacePodVerticalScaling.enabled | quote }}
{{- if .Values.controllers.trace.enabled }}
- name: I18N_RESOURCES_NAME
value: {{ include "kubeblocks.i18nResourcesName" . }}
{{- end }}
{{- if .Values.extraEnvs }}
{{- toYaml .Values.extraEnvs | nindent 12 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: webhook-server
containerPort: 9443
protocol: TCP
- name: health
containerPort: 8081
protocol: TCP
- name: metrics
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: health
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: health
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: {{ .Values.resources.cpu }}
memory: {{ .Values.resources.memory }}
requests:
cpu: {{ .Values.resources.cpu }}
memory: {{ .Values.resources.memory }}
volumeMounts:
- mountPath: /etc/kubeblocks
name: manager-config
{{- if .Values.webhooks.conversionEnabled }}
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
{{- end }}
{{- if .Values.multiCluster.kubeConfig }}
- mountPath: {{ .Values.multiCluster.mountPath }}
name: multi-cluster-kubeconfig
readOnly: true
{{- end }}
{{- if .Values.hostNetwork }}
hostNetwork: {{ .Values.hostNetwork }}
{{- end }}
{{- if .Values.dnsPolicy }}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: 10
volumes:
- name: manager-config
configMap:
name: {{ include "kubeblocks.fullname" . }}-manager-config
{{- if .Values.webhooks.conversionEnabled }}
- name: cert
secret:
defaultMode: 420
secretName: {{ include "kubeblocks.fullname" . }}.{{ .Release.Namespace }}.svc.tls-pair
{{- end }}
{{- if .Values.multiCluster.kubeConfig }}
- name: multi-cluster-kubeconfig
secret:
secretName: {{ .Values.multiCluster.kubeConfig }}
defaultMode: 420
{{- end }}