Skip to content

Commit

Permalink
feat: mysql supports cmpv (#1040)
Browse files Browse the repository at this point in the history
Co-authored-by: wangyelei <[email protected]>
  • Loading branch information
wangyelei and wangyelei authored Sep 14, 2024
1 parent 7fabc35 commit cce3317
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ KubeBlocks add-ons.
| minio | minio-1.0.0-alpha.0 | High Performance, Kubernetes Native Object Storage | fengluodb |
| mogdb | mogdb-5.0.5 | A Helm chart for Kubernetes | yabinji shanshanying |
| mongodb | mongodb-4.0.28<br>mongodb-4.2.24<br>mongodb-4.4.29<br>mongodb-5.0.28<br>mongodb-6.0.16<br>mongodb-7.0.12 | MongoDB is a document database designed for ease of application development and scaling. | xuriwuyun |
| mysql | mysql-5.7.44<br>mysql-8.0.33<br>mysql-8.4.2<br>proxysql-2.4.4 | MySQL is a widely used, open-source relational database management system (RDBMS) | xuriwuyun |
| mysql | mysql-5.7.44<br>mysql-8.0.33<br>mysql-8.4.2<br>mysql-orc-5.7.44<br>mysql-orc-8.0.33<br>mysql-proxysql-2.4.4 | MySQL is a widely used, open-source relational database management system (RDBMS) | xuriwuyun |
| nebula | nebula-v3.5.0 | NebulaGraph is a popular open-source graph database that can handle large volumes of data with milliseconds of latency, scale up quickly, and have the ability to perform fast graph analytics. | Shanshan Ying Xuntao Cheng |
| neon | neon-broker-1.0.0<br>neon-compute-1.0.0<br>neon-pageserver-1.0.0<br>neon-safekeeper-1.0.0 | Neon is a serverless open-source alternative to AWS Aurora Postgres. It separates storage and compute and substitutes the PostgreSQL storage layer by redistributing data across a cluster of nodes. | skyrise |
| oceanbase-ce | oceanbase-4.3.0 | 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. OceanBase has served over 400 customers across the globe and has been supporting all mission critical systems in Alipay. | Powerfool shanshanying |
Expand Down
65 changes: 58 additions & 7 deletions addons/mysql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,65 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Define mysql component definition regex regular
*/}}
{{- define "mysql.componentDefRegex" -}}
^mysql-\d+\.\d+.*$
{{- end -}}

{{/*
Define mysql component definition name
*/}}
{{- define "mysql.componentDefName" -}}
{{- if eq (len .Values.compDefinitionVersionSuffix) 0 -}}
mysql
{{- define "mysql.componentDefName57" -}}
{{- if gt (len .Values.compDefinitionVersionSuffix) 0 -}}
mysql-5.7
{{- else -}}
{{- printf "mysql-5.7-%s" .Values.compDefinitionVersionSuffix -}}
{{- end -}}
{{- end -}}

{{/*
Define mysql component definition name
*/}}
{{- define "mysql.componentDefNameOrc57" -}}
{{- if gt (len .Values.compDefinitionVersionSuffix) 0 -}}
mysql-orc-5.7
{{- else -}}
{{- printf "mysql-orc-5.7-%s" .Values.compDefinitionVersionSuffix -}}
{{- end -}}
{{- end -}}

{{/*
Define mysql component definition name
*/}}
{{- define "mysql.componentDefName80" -}}
{{- if gt (len .Values.compDefinitionVersionSuffix) 0 -}}
mysql-8.0
{{- else -}}
{{- printf "mysql-8.0-%s" .Values.compDefinitionVersionSuffix -}}
{{- end -}}
{{- end -}}

{{/*
Define mysql component definition name
*/}}
{{- define "mysql.componentDefNameOrc80" -}}
{{- if gt (len .Values.compDefinitionVersionSuffix) 0 -}}
mysql-orc-8.0
{{- else -}}
{{- printf "mysql-orc-8.0-%s" .Values.compDefinitionVersionSuffix -}}
{{- end -}}
{{- end -}}

{{/*
Define mysql component definition name
*/}}
{{- define "mysql.componentDefName84" -}}
{{- if gt (len .Values.compDefinitionVersionSuffix) 0 -}}
mysql-8.4
{{- else -}}
{{- printf "mysql-%s" .Values.compDefinitionVersionSuffix -}}
{{- printf "mysql-8.4-%s" .Values.compDefinitionVersionSuffix -}}
{{- end -}}
{{- end -}}

Expand All @@ -88,9 +139,9 @@ Define mysql component definition name
*/}}
{{- define "proxysql.componentDefName" -}}
{{- if eq (len .Values.compDefinitionVersionSuffix) 0 -}}
proxysql
mysql-proxysql
{{- else -}}
{{- printf "proxysql-%s" .Values.compDefinitionVersionSuffix -}}
{{- printf "mysql-proxysql-%s" .Values.compDefinitionVersionSuffix -}}
{{- end -}}
{{- end -}}

Expand All @@ -117,7 +168,7 @@ Create chart name and version as used by the chart label.
Selector labels
*/}}
{{- define "proxysql.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mysql.componentDefName" . }}
app.kubernetes.io/name: {{ include "proxysql.componentDefName" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

Expand Down
10 changes: 7 additions & 3 deletions addons/mysql/templates/clusterdefinition.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
apiVersion: apps.kubeblocks.io/v1
kind: ClusterDefinition
metadata:
name: {{ include "mysql.componentDefName" . }}
name: mysql
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
topologies:
- name: server
components:
- name: server
compDef: {{ include "mysql.componentDefName" . }}-8.0.33
compDef: {{ include "mysql.componentDefRegex" . }}
default: true
- name: server-with-orc
components:
- name: server
compDef: mysql-orc
- name: server-with-proxy
components:
- name: server
compDef: {{ include "mysql.componentDefName" . }}-8.0.33
compDef: {{ include "mysql.componentDefRegex" . }}
- name: proxysql
compDef: {{ include "proxysql.componentDefName" . }}
orders:
Expand Down
2 changes: 1 addition & 1 deletion addons/mysql/templates/cmpd-mysql57-orc.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps.kubeblocks.io/v1
kind: ComponentDefinition
metadata:
name: {{ include "mysql.componentDefName" . }}-5.7.44-orc
name: {{ include "mysql.componentDefNameOrc57" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion addons/mysql/templates/cmpd-mysql57.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps.kubeblocks.io/v1
kind: ComponentDefinition
metadata:
name: {{ include "mysql.componentDefName" . }}-5.7.44
name: {{ include "mysql.componentDefName57" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion addons/mysql/templates/cmpd-mysql80-orc.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps.kubeblocks.io/v1
kind: ComponentDefinition
metadata:
name: {{ include "mysql.componentDefName" . }}-8.0.33-orc
name: {{ include "mysql.componentDefNameOrc80" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion addons/mysql/templates/cmpd-mysql80.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps.kubeblocks.io/v1
kind: ComponentDefinition
metadata:
name: {{ include "mysql.componentDefName" . }}-8.0.33
name: {{ include "mysql.componentDefName80" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
Expand Down
2 changes: 1 addition & 1 deletion addons/mysql/templates/cmpd-mysql84.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps.kubeblocks.io/v1
kind: ComponentDefinition
metadata:
name: {{ include "mysql.componentDefName" . }}-8.4.2
name: {{ include "mysql.componentDefName84" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
Expand Down
8 changes: 4 additions & 4 deletions addons/mysql/templates/cmpd-proxysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
- name: BACKEND_SERVER
valueFrom:
serviceVarRef:
compDef: {{ include "mysql.componentDefName" . }}
compDef: {{ include "mysql.componentDefRegex" . }}
name: mysql-server
host: Required
optional: false
Expand All @@ -62,22 +62,22 @@ spec:
valueFrom:
credentialVarRef:
## reference the current component definition name
compDef: {{ include "mysql.componentDefName" . }}
compDef: {{ include "mysql.componentDefRegex" . }}
name: root
username: Required

- name: MYSQL_ROOT_PASSWORD
valueFrom:
credentialVarRef:
## reference the current component definition name
compDef: {{ include "mysql.componentDefName" . }}
compDef: {{ include "mysql.componentDefRegex" . }}
name: root
password: Required

- name: MYSQL_PORT
valueFrom:
serviceVarRef:
compDef: {{ include "mysql.componentDefName" . }}
compDef: {{ include "mysql.componentDefRegex" . }}
name: mysql-server
optional: false
port:
Expand Down
24 changes: 24 additions & 0 deletions addons/mysql/templates/cpmv-orc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: ComponentVersion
metadata:
name: mysql-orc
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
compatibilityRules:
- compDefs:
- mysql-orc
releases:
- 5.7.44
- 8.0.33
releases:
- name: 5.7.44
serviceVersion: 5.7.44
images:
mysql: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:5.7.44
init-data: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:5.7.44
- name: 8.0.33
serviceVersion: 8.0.33
images:
mysql: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:8.0.33
init-data: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:8.0.33
17 changes: 17 additions & 0 deletions addons/mysql/templates/cpmv-proxysql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: ComponentVersion
metadata:
name: mysql-proxysql
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
compatibilityRules:
- compDefs:
- mysql-proxy
releases:
- 2.4.4
releases:
- name: 2.4.4
serviceVersion: 2.4.4
images:
proxysql: {{ .Values.image.registry | default "docker.io" }}/apecloud/proxysql:2.4.4
29 changes: 29 additions & 0 deletions addons/mysql/templates/cpmv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps.kubeblocks.io/v1alpha1
kind: ComponentVersion
metadata:
name: mysql
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
compatibilityRules:
- compDefs:
- {{ include "mysql.componentDefRegex" . }}
releases:
- 5.7.44
- 8.0.33
- 8.4.2
releases:
- name: 5.7.44
serviceVersion: 5.7.44
images:
mysql: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:5.7.44
init-data: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:5.7.44
- name: 8.0.33
serviceVersion: 8.0.33
images:
mysql: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:8.0.33
init-data: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:8.0.33
- name: 8.4.2
serviceVersion: 8.4.2
images:
mysql: {{ .Values.image.registry | default "docker.io" }}/{{ .Values.image.repository }}:8.4.2

0 comments on commit cce3317

Please sign in to comment.