-
Notifications
You must be signed in to change notification settings - Fork 39
/
componentdefinition.yaml
375 lines (375 loc) · 13 KB
/
componentdefinition.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
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
apiVersion: v1
kind: List
metadata:
items:
- apiVersion: apps.kubeblocks.io/v1alpha1
kind: ComponentDefinition
metadata:
name: {{ include "oceanbase-release.name" . }}
labels:
{{- include "oceanbase.labels" . | nindent 6 }}
spec:
provider: &obprovider community
serviceKind: &obsvckind oceanbase
serviceVersion: &obver 4.2.0
description: &obdesc "Unlimited scalable distributed database for data-intensive transactional and real-time operational analytics workloads, with ultra-fast performance that has once achieved world records in the TPC-C benchmark test."
services: &observices
- name: oceanbase
serviceName: oceanbase
spec:
ports:
- name: sql
port: 2881
targetPort: sql
- name: rpc
port: 2882
targetPort: rpc
updateStrategy: Serial
configs: &obconfigs
# - name: oceanbase-init-config
# templateRef: oceanbase-init-config
# volumeName: oceanbase-init-config
# namespace: {{ .Release.Namespace }}
# defaultMode: 0555
- name: {{ printf "%s-sysvars" (include "oceanbase-release.name" .) }}
templateRef: {{ printf "%s-sysvars" (include "oceanbase-release.name" .) }}
volumeName: {{ printf "%s-sysvars" (include "oceanbase-release.name" .) }}
constraintRef: {{ printf "%s-sysvars-cc" (include "oceanbase-release.name" .) }}
namespace: {{ .Release.Namespace }}
defaultMode: 0555
- name: {{ printf "%s-config" (include "oceanbase-release.name" .) }}
templateRef: {{ printf "%s-config" (include "oceanbase-release.name" .) }}
volumeName: {{ printf "%s-config" (include "oceanbase-release.name" .) }}
constraintRef: {{ printf "%s-parameters-cc" (include "oceanbase-release.name" .) }}
namespace: {{ .Release.Namespace }}
defaultMode: 0555
scripts: &obscripts
- name: {{ printf "%s-scripts" (include "oceanbase-release.name" .) }}
templateRef: {{ printf "%s-scripts" (include "oceanbase-release.name" .) }}
namespace: {{ .Release.Namespace }}
volumeName: scripts
defaultMode: 0555
runtime: &obruntime
terminationGracePeriodSeconds: 60
containers:
- name: observer-container
command:
- bash
- -c
- |
/scripts/entrypoint.sh
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.observer.repository }}:{{ .Values.images.observer.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
ports:
- containerPort: 2881
name: sql
protocol: TCP
- containerPort: 2882
name: rpc
protocol: TCP
readinessProbe:
failureThreshold: 10
initialDelaySeconds: 10
successThreshold: 1
timeoutSeconds: 5
exec:
command:
- cat
- /tmp/ready
volumeMounts:
- mountPath: /home/admin/data-file
name: data-file
- mountPath: /home/admin/data-log
name: data-log
- mountPath: /home/admin/log
name: log
- mountPath: /home/admin/workdir
name: workdir
- name: scripts
mountPath: /scripts
- name: oceanbase-config
mountPath: /kb-config
- name: oceanbase-sysvars
mountPath: /opt/oceanbase/sysvars
workingDir: /home/admin/workdir
env:
- name: LD_LIBRARY_PATH
value: /home/admin/oceanbase/lib
- name: CLUSTER_NAME
value: "$(KB_CLUSTER_COMP_NAME)"
- name: OB_HOME_DIR
value: "/home/admin/workdir"
- name: OB_SERVICE_PORT
value: "2881"
- name: AUDITLOG_USER
value: "root"
- name: metrics
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.metrics.repository }}:{{ .Values.images.metrics.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
command:
- bash
- -c
- |
/scripts/setupmetrics.sh
env:
- name: OB_MONITOR_STATUS
value: active
- name: CLUSTER_NAME
value: "$(KB_CLUSTER_COMP_NAME)"
- name: CLUSTER_ID
value: "1"
- name: MONITOR_USER
value: "root"
- name: MONITOR_PASSWORD
value: ""
- name: SERVICE_PORT
value: "8088"
- name: OB_SERVICE_PORT
value: "2881"
ports:
- containerPort: 8088
name: http
protocol: TCP
- containerPort: 8089
name: pprof
protocol: TCP
# readinessProbe:
# failureThreshold: 3
# httpGet:
# path: /metrics/stat
# port: 8088
# scheme: HTTP
# initialDelaySeconds: 5
# periodSeconds: 2
# successThreshold: 1
# timeoutSeconds: 1
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: "200m"
memory: 256Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: scripts
mountPath: /scripts
- name: kb-tools
mountPath: /kb_tools
- name: metricslog
mountPath: /home/admin/obagent/log
workingDir: /home/admin/obagento
volumes:
- name: metricslog
emptyDir: {}
- apiVersion: apps.kubeblocks.io/v1alpha1
kind: ComponentDefinition
metadata:
name: {{ printf "%s-hostnetwork" (include "oceanbase-release.name" .) }}
labels:
{{- include "oceanbase-hostnetwork.labels" . | nindent 6 }}
spec:
provider: *obprovider
serviceKind: *obsvckind
serviceVersion: *obver
description: *obdesc
services: *observices
updateStrategy: Serial
configs: &obhostconfigs
# - name: oceanbase-init-config
# templateRef: oceanbase-init-config
# volumeName: oceanbase-init-config
# namespace: {{ .Release.Namespace }}
# defaultMode: 0555
- name: {{ printf "%s-sysvars" (include "oceanbase-release.name" .) }}
templateRef: {{ printf "%s-sysvars" (include "oceanbase-release.name" .) }}
volumeName: {{ printf "%s-sysvars" (include "oceanbase-release.name" .) }}
constraintRef: {{ printf "%s-sysvars-cc" (include "oceanbase-release.name" .) }}
namespace: {{ .Release.Namespace }}
defaultMode: 0555
- name: {{ printf "%s-config" (include "oceanbase-release.name" .) }}
templateRef: {{ printf "%s-config" (include "oceanbase-release.name" .) }}
volumeName: {{ printf "%s-config" (include "oceanbase-release.name" .) }}
constraintRef: {{ printf "%s-parameters-cc" (include "oceanbase-release.name" .) }}
namespace: {{ .Release.Namespace }}
defaultMode: 0555
- name: {{ printf "%s-inject-env" (include "oceanbase-release.name" .) }}
templateRef: {{ printf "%s-inject-env" (include "oceanbase-release.name" .) }}
volumeName: {{ printf "%s-inject-env" (include "oceanbase-release.name" .) }}
constraintRef: {{ printf "%s-env-cc" (include "oceanbase-release.name" .) }}
namespace: {{ .Release.Namespace }}
defaultMode: 0555
asEnvFrom:
- observer-container
- metrics
- config-manager
scripts: *obscripts
runtime: &obhostruntime
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
terminationGracePeriodSeconds: 60
containers:
- name: observer-container
command:
- bash
- -c
- |
/scripts/entrypoint.sh
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.observer.repository }}:{{ .Values.images.observer.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
ports:
- containerPort: 88
name: sql
protocol: TCP
- containerPort: 99
name: rpc
protocol: TCP
readinessProbe:
failureThreshold: 10
initialDelaySeconds: 10
successThreshold: 1
timeoutSeconds: 5
exec:
command:
- cat
- /tmp/ready
volumeMounts:
- mountPath: /home/admin/data-file
name: data-file
- mountPath: /home/admin/data-log
name: data-log
- mountPath: /home/admin/log
name: log
- mountPath: /home/admin/workdir
name: workdir
- name: scripts
mountPath: /scripts
- name: oceanbase-config
mountPath: /kb-config
- name: oceanbase-sysvars
mountPath: /opt/oceanbase/sysvars
workingDir: /home/admin/workdir
env:
- name: LD_LIBRARY_PATH
value: /home/admin/oceanbase/lib
- name: CLUSTER_NAME
value: "$(KB_CLUSTER_COMP_NAME)"
- name: OB_HOME_DIR
value: "/home/admin/workdir"
- name: AUDITLOG_USER
value: "root"
- name: metrics
image: {{ .Values.images.registry | default "docker.io" }}/{{ .Values.images.metrics.repository }}:{{ .Values.images.metrics.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.images.pullPolicy }}
command:
- bash
- -c
- |
/scripts/setupmetrics.sh
env:
- name: OB_MONITOR_STATUS
value: active
- name: CLUSTER_NAME
value: "$(KB_CLUSTER_COMP_NAME)"
- name: CLUSTER_ID
value: "1"
- name: MONITOR_USER
value: "root"
- name: MONITOR_PASSWORD
value: ""
# - name: SERVICE_PORT
# value: "8088"
# - name: OB_SERVICE_PORT
# value: "2881"
ports:
- containerPort: 60
name: http
protocol: TCP
- containerPort: 61
name: pprof
protocol: TCP
- containerPort: 62
name: config-manager
protocol: TCP
# readinessProbe:
# failureThreshold: 3
# httpGet:
# path: /metrics/stat
# port: http
# scheme: HTTP
# initialDelaySeconds: 5
# periodSeconds: 2
# successThreshold: 1
# timeoutSeconds: 1
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: "200m"
memory: 256Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- name: scripts
mountPath: /scripts
- name: kb-tools
mountPath: /kb_tools
- name: metricslog
mountPath: /home/admin/obagent/log
workingDir: /home/admin/obagento
volumes:
- name: metricslog
emptyDir: {}
- apiVersion: apps.kubeblocks.io/v1alpha1
kind: ComponentDefinition
metadata:
name: {{ printf "%s-repl" (include "oceanbase-release.name" .) }}
labels:
{{- include "oceanbase.labels" . | nindent 6 }}
spec:
provider: *obprovider
serviceKind: *obsvckind
serviceVersion: *obver
description: *obdesc
services: *observices
updateStrategy: Serial
configs: *obconfigs
scripts: *obscripts
roles: &obroles
- name: primary
serviceable: true
writable: true
votable: true
- name: standby
serviceable: true
writable: false
votable: true
lifecycleActions: &oblifecycle
roleProbe:
builtinHandler: oceanbase
periodSeconds: {{ .Values.roleProbe.periodSeconds }}
timeoutSeconds: {{ .Values.roleProbe.timeoutSeconds }}
labels: &oblabels
kubeblocks.io/ready-without-primary: "true"
runtime: *obruntime
- apiVersion: apps.kubeblocks.io/v1alpha1
kind: ComponentDefinition
metadata:
name: {{ printf "%s-repl-host" (include "oceanbase-release.name" .) }}
labels:
{{- include "oceanbase-hostnetwork.labels" . | nindent 6 }}
spec:
provider: *obprovider
serviceKind: *obsvckind
serviceVersion: *obver
description: *obdesc
services: *observices
updateStrategy: Serial
configs: *obhostconfigs
scripts: *obscripts
roles: *obroles
lifecycleActions: *oblifecycle
labels: *oblabels
runtime: *obhostruntime