Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: support parameters api for mysql #1315

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions addons/mysql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ roles:
- name: secondary
serviceable: true
writable: false
exporter:
containerName: mysql-exporter
scrapePath: /metrics
scrapePort: http-metrics
{{- end }}

{{- define "mysql.spec.runtime.common" -}}
Expand Down
50 changes: 50 additions & 0 deletions addons/mysql/templates/_names.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,53 @@ Define mysql component definition name
{{- define "proxysql.componentDefName" -}}
{{- printf "%s-proxysql-%s" (include "mysql.cmpdNamePrefix" .) .Chart.Version -}}
{{- end -}}

{{/*
Define parametersdefinition name
*/}}
{{- define "mysql.paramsDefName57" -}}
mysql-5.7-pd
{{- end -}}

{{/*
Define parametersdefinition name
*/}}
{{- define "mysql.paramsDefName80" -}}
mysql-8.0-pd
{{- end -}}


{{/*
Define parameterconfigrenderer name
*/}}
{{- define "mysql.prcName57" -}}
mysql-5.7-pcr
{{- end -}}

{{/*
Define parameterconfigrenderer name
*/}}
{{- define "mysql.prcNameOrc57" -}}
mysql-5.7-orc-pcr
{{- end -}}

{{/*
Define parameterconfigrenderer name
*/}}
{{- define "mysql.prcName80" -}}
mysql-8.0-pcr
{{- end -}}

{{/*
Define parameterconfigrenderer name
*/}}
{{- define "mysql.prcNameOrc80" -}}
mysql-8.0-orc-pcr
{{- end -}}

{{/*
Define parameterconfigrenderer name
*/}}
{{- define "mysql.prcName84" -}}
mysql-8.4-pcr
{{- end -}}
3 changes: 0 additions & 3 deletions addons/mysql/templates/cmpd-mysql57-orc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ spec:
configs:
- name: mysql-replication-config
templateRef: mysql-5.7-config-template
constraintRef: mysql-5.7-config-constraints
volumeName: mysql-config
namespace: {{ .Release.Namespace }}
reRenderResourceTypes:
- vscale
runtime:
initContainers:
- image: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:5.7.44
Expand Down
3 changes: 0 additions & 3 deletions addons/mysql/templates/cmpd-mysql57.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ spec:
configs:
- name: mysql-replication-config
templateRef: mysql-5.7-config-template
constraintRef: mysql-5.7-config-constraints
volumeName: mysql-config
namespace: {{ .Release.Namespace }}
reRenderResourceTypes:
- vscale
runtime:
initContainers:
- image: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:5.7.44
Expand Down
3 changes: 0 additions & 3 deletions addons/mysql/templates/cmpd-mysql80-orc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ spec:
configs:
- name: mysql-replication-config
templateRef: mysql-8.0-config-template
constraintRef: mysql-8.0-config-constraints
volumeName: mysql-config
namespace: {{ .Release.Namespace }}
reRenderResourceTypes:
- vscale
runtime:
initContainers:
- image: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:8.0.33
Expand Down
3 changes: 0 additions & 3 deletions addons/mysql/templates/cmpd-mysql80.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ spec:
configs:
- name: mysql-replication-config
templateRef: mysql-8.0-config-template
constraintRef: mysql-8.0-config-constraints
volumeName: mysql-config
namespace: {{ .Release.Namespace }}
reRenderResourceTypes:
- vscale
runtime:
initContainers:
- image: {{ .Values.image.registry | default "docker.io" }}/apecloud/mysql_audit_log:8.0.33
Expand Down
3 changes: 0 additions & 3 deletions addons/mysql/templates/cmpd-mysql84.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ spec:
configs:
- name: mysql-replication-config
templateRef: mysql-8.0-config-template
constraintRef: mysql-8.0-config-constraints
volumeName: mysql-config
namespace: {{ .Release.Namespace }}
reRenderResourceTypes:
- vscale
runtime:
initContainers:
- command:
Expand Down
2 changes: 0 additions & 2 deletions addons/mysql/templates/cmpd-proxysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ spec:
templateRef: proxysql-config
namespace: {{ .Release.Namespace }}
volumeName: proxy-config
reRenderResourceTypes:
- hscale
scripts:
- name: proxysql-scripts
templateRef: proxysql-scripts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{- $cc := .Files.Get "config/mysql5.7-config-effect-scope.yaml" | fromYaml }}
apiVersion: apps.kubeblocks.io/v1beta1
kind: ConfigConstraint
{{- $pd := .Files.Get "config/mysql5.7-config-effect-scope.yaml" | fromYaml }}
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParametersDefinition
metadata:
name: mysql-5.7-config-constraints
name: {{ include "mysql.paramsDefName57" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
Expand All @@ -16,6 +16,7 @@ spec:
namespace: {{ .Release.Namespace }}


fileName: my.cnf
# ConfigurationSchema that impose restrictions on engine parameter's rule
parametersSchema:
# top level mysql configuration type
Expand All @@ -27,35 +28,28 @@ spec:
{{- .Files.Get "config/mysql5.7-config-constraint.cue" | nindent 6 }}
## define static parameter list
{{- if hasKey $cc "staticParameters" }}
{{- if hasKey $pd "staticParameters" }}
staticParameters:
{{- $params := get $cc "staticParameters" }}
{{- $params := get $pd "staticParameters" }}
{{- range $params }}
- {{ . }}
{{- end }}
{{- end}}

## define dynamic parameter list
{{- if hasKey $cc "dynamicParameters" }}
{{- if hasKey $pd "dynamicParameters" }}
dynamicParameters:
{{- $params := get $cc "dynamicParameters" }}
{{- $params := get $pd "dynamicParameters" }}
{{- range $params }}
- {{ . }}
{{- end }}
{{- end}}

## define immutable parameter list, this feature is not currently supported.
{{- if hasKey $cc "immutableParameters" }}
{{- if hasKey $pd "immutableParameters" }}
immutableParameters:
{{- $params := get $cc "immutableParameters" }}
{{- $params := get $pd "immutableParameters" }}
{{- range $params }}
- {{ . }}
{{- end }}
{{- end}}


# mysql configuration file format
fileFormatConfig:
format: ini
iniConfig:
sectionName: mysqld
{{- end}}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{- $cc := .Files.Get "config/mysql8-config-effect-scope.yaml" | fromYaml }}
apiVersion: apps.kubeblocks.io/v1beta1
kind: ConfigConstraint
{{- $pd := .Files.Get "config/mysql8-config-effect-scope.yaml" | fromYaml }}
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParametersDefinition
metadata:
name: mysql-8.0-config-constraints
name: {{ include "mysql.paramsDefName80" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
Expand All @@ -15,6 +15,7 @@ spec:
namespace: {{ .Release.Namespace }}


fileName: my.cnf
# ConfigurationSchema that impose restrictions on engine parameter's rule
parametersSchema:
# top level mysql configuration type
Expand All @@ -26,35 +27,28 @@ spec:
{{- .Files.Get "config/mysql8-config-constraint.cue" | nindent 6 }}
## define static parameter list
{{- if hasKey $cc "staticParameters" }}
{{- if hasKey $pd "staticParameters" }}
staticParameters:
{{- $params := get $cc "staticParameters" }}
{{- $params := get $pd "staticParameters" }}
{{- range $params }}
- {{ . }}
{{- end }}
{{- end}}

## define dynamic parameter list
{{- if hasKey $cc "dynamicParameters" }}
## define dynamic parameter list
{{- if hasKey $pd "dynamicParameters" }}
dynamicParameters:
{{- $params := get $cc "dynamicParameters" }}
{{- $params := get $pd "dynamicParameters" }}
{{- range $params }}
- {{ . }}
{{- end }}
{{- end}}

## define immutable parameter list, this feature is not currently supported.
{{- if hasKey $cc "immutableParameters" }}
## define immutable parameter list, this feature is not currently supported.
{{- if hasKey $pd "immutableParameters" }}
immutableParameters:
{{- $params := get $cc "immutableParameters" }}
{{- $params := get $pd "immutableParameters" }}
{{- range $params }}
- {{ . }}
{{- end }}
{{- end}}


# mysql configuration file format
fileFormatConfig:
format: ini
iniConfig:
sectionName: mysqld
{{- end}}
19 changes: 19 additions & 0 deletions addons/mysql/templates/pcr-57-orc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParamConfigRenderer
metadata:
name: {{ include "mysql.prcNameOrc57" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
componentDef: {{ include "mysql.componentDefNameOrc57" . }}
parametersDefs:
- {{ include "mysql.paramsDefName57" . }}

configs:
- name: my.cnf
fileFormatConfig:
format: ini
iniConfig:
sectionName: mysqld
reRenderResourceTypes:
- vscale
19 changes: 19 additions & 0 deletions addons/mysql/templates/pcr-57.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParamConfigRenderer
metadata:
name: {{ include "mysql.prcName57" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
componentDef: {{ include "mysql.componentDefName57" . }}
parametersDefs:
- {{ include "mysql.paramsDefName57" . }}

configs:
- name: my.cnf
fileFormatConfig:
format: ini
iniConfig:
sectionName: mysqld
reRenderResourceTypes:
- vscale
19 changes: 19 additions & 0 deletions addons/mysql/templates/pcr-80-orc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParamConfigRenderer
metadata:
name: {{ include "mysql.prcNameOrc80" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
componentDef: {{ include "mysql.componentDefNameOrc80" . }}
parametersDefs:
- {{ include "mysql.paramsDefName80" . }}

configs:
- name: my.cnf
fileFormatConfig:
format: ini
iniConfig:
sectionName: mysqld
reRenderResourceTypes:
- vscale
19 changes: 19 additions & 0 deletions addons/mysql/templates/pcr-80.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParamConfigRenderer
metadata:
name: {{ include "mysql.prcName80" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
componentDef: {{ include "mysql.componentDefName80" . }}
parametersDefs:
- {{ include "mysql.paramsDefName80" . }}

configs:
- name: my.cnf
fileFormatConfig:
format: ini
iniConfig:
sectionName: mysqld
reRenderResourceTypes:
- vscale
19 changes: 19 additions & 0 deletions addons/mysql/templates/pcr-84.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: parameters.kubeblocks.io/v1alpha1
kind: ParamConfigRenderer
metadata:
name: {{ include "mysql.prcName84" . }}
labels:
{{- include "mysql.labels" . | nindent 4 }}
spec:
componentDef: {{ include "mysql.componentDefName84" . }}
parametersDefs:
- {{ include "mysql.paramsDefName80" . }}

configs:
- name: my.cnf
fileFormatConfig:
format: ini
iniConfig:
sectionName: mysqld
reRenderResourceTypes:
- vscale
Loading