Skip to content

Commit

Permalink
chore: adapt mysql addon for kbagent (#950)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuriwuyun authored Aug 26, 2024
1 parent dd1cf3d commit 8a8f11f
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 22 deletions.
6 changes: 3 additions & 3 deletions addons-cluster/mysql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ replicas: 1

## @param cpu
##
cpu: 1
cpu: 0.5

## @param memory, the unit is Gi
##
memory: 1
memory: 0.5

## @param requests.cpu if not set, use cpu
## @param requests.memory, if not set, use memory
Expand Down Expand Up @@ -48,7 +48,7 @@ proxysql:
# rbacEnabled: true

orchestrator:
enable: true
enable: false
# monitor_password: proxysql
# cluster_password: nb2wZpZ9OXXTF2Mv

Expand Down
28 changes: 18 additions & 10 deletions addons/mysql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,16 @@ vars:
password: Required
lifecycleActions:
roleProbe:
builtinHandler: mysql
periodSeconds: {{ .Values.roleProbe.periodSeconds }}
timeoutSeconds: {{ .Values.roleProbe.timeoutSeconds }}
exec:
container: mysql
command:
- /tools/dbctl
- --config-path
- /tools/config/dbctl/components
- mysql
- getrole
roles:
- name: primary
serviceable: true
Expand All @@ -198,24 +205,25 @@ roles:
- -r
- /bin/syncer
- /config
- /kubeblocks/
- /tools/
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.syncer.repository }}:{{ .Values.image.syncer.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }}
name: init-syncer
volumeMounts:
- mountPath: /kubeblocks
name: kubeblocks
- mountPath: /tools
name: tools
- command:
- cp
- -r
- /xtrabackup-2.4
- /kubeblocks/xtrabackup
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.syncer.repository }}:{{ .Values.image.syncer.tag }}
- /bin/dbctl
- /config
- /tools/
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.dbctl.repository }}:{{ .Values.image.dbctl.tag }}
imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }}
name: init-xtrabackup
name: init-dbctl
volumeMounts:
- mountPath: /kubeblocks
name: kubeblocks
- mountPath: /tools
name: tools
{{- end }}

{{- define "mysql-orc.spec.common"}}
Expand Down
21 changes: 16 additions & 5 deletions addons/mysql/templates/cmpd-mysql57.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,26 @@ spec:
volumeMounts:
- mountPath: {{ .Values.dataMountPath }}
name: data
{{- include "mysql.spec.runtime.common" . | nindent 6 }}
- command:
- cp
- -r
- /xtrabackup-2.4
- /tools/xtrabackup
image: {{ .Values.image.registry | default "docker.io" }}/apecloud/syncer:mysql
imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }}
name: init-xtrabackup
volumeMounts:
- mountPath: /tools
name: tools
{{- include "mysql.spec.runtime.common" . | nindent 6 }}
containers:
- name: mysql
image: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:5.7.44
imagePullPolicy: {{ default .Values.image.pullPolicy "IfNotPresent" }}
command:
- syncer
- --config-path
- /kubeblocks/config/components
- /tools/config/components
- --port
- "3601"
- --
Expand All @@ -60,16 +71,16 @@ spec:
name: mysql-config
- name: scripts
mountPath: /scripts
- mountPath: /kubeblocks
name: kubeblocks
- mountPath: /tools
name: tools
ports:
- containerPort: 3306
name: mysql
- containerPort: 3601
name: ha
env:
- name: PATH
value: /kubeblocks/xtrabackup/bin:/kubeblocks/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
value: /tools/xtrabackup/bin:/tools/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: KB_SERVICE_CHARACTER_TYPE
value: mysql
- name: MYSQL_INITDB_SKIP_TZINFO
Expand Down
19 changes: 15 additions & 4 deletions addons/mysql/templates/cmpd-mysql80.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ spec:
volumeMounts:
- mountPath: {{ .Values.dataMountPath }}
name: data
- command:
- cp
- -r
- /xtrabackup-8.0
- /tools/xtrabackup
image: {{ .Values.image.registry | default "docker.io" }}/apecloud/syncer:mysql
imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }}
name: init-xtrabackup
volumeMounts:
- mountPath: /tools
name: tools
{{- include "mysql.spec.runtime.common" . | nindent 6 }}
containers:
- name: mysql
Expand All @@ -38,7 +49,7 @@ spec:
command:
- syncer
- --config-path
- /kubeblocks/config/components
- /tools/config/components
- --port
- "3601"
- --
Expand All @@ -60,16 +71,16 @@ spec:
name: mysql-config
- name: scripts
mountPath: /scripts
- mountPath: /kubeblocks
name: kubeblocks
- mountPath: /tools
name: tools
ports:
- containerPort: 3306
name: mysql
- containerPort: 3601
name: ha
env:
- name: PATH
value: /kubeblocks/xtrabackup/bin:/kubeblocks/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
value: /tools/xtrabackup/bin:/tools/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: KB_SERVICE_CHARACTER_TYPE
value: mysql
- name: MYSQL_INITDB_SKIP_TZINFO
Expand Down
3 changes: 3 additions & 0 deletions addons/mysql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ image:
repository: perconalab/percona-xtrabackup
syncer:
repository: apecloud/syncer
tag: 0.1.8
dbctl:
repository: apecloud/dbctl
tag: 0.1.2
# refer: addons/mysql/orc-tools/Dockerfile
orcTools:
Expand Down

0 comments on commit 8a8f11f

Please sign in to comment.