diff --git a/addons/clickhouse/configs/00_default_overrides.xml.tpl b/addons/clickhouse/configs/00_default_overrides.xml.tpl index 680583f86..fafe9a571 100644 --- a/addons/clickhouse/configs/00_default_overrides.xml.tpl +++ b/addons/clickhouse/configs/00_default_overrides.xml.tpl @@ -68,9 +68,9 @@ {{- if eq (index $ "TLS_ENABLED") "true" -}} - {{- $CA_FILE := /etc/pki/tls/ca.pem -}} - {{- $CERT_FILE := /etc/pki/tls/cert.pem -}} - {{- $KEY_FILE := /etc/pki/tls/key.pem }} + {{- $CA_FILE := "/etc/pki/tls/ca.pem" -}} + {{- $CERT_FILE := "/etc/pki/tls/cert.pem" -}} + {{- $KEY_FILE := "/etc/pki/tls/key.pem" }} prometheus diff --git a/addons/clickhouse/configs/ch_keeper_00_default_overrides.xml.tpl b/addons/clickhouse/configs/ch_keeper_00_default_overrides.xml.tpl index 1ac45d3a7..49a2aab09 100644 --- a/addons/clickhouse/configs/ch_keeper_00_default_overrides.xml.tpl +++ b/addons/clickhouse/configs/ch_keeper_00_default_overrides.xml.tpl @@ -56,9 +56,9 @@ {{- if eq (index $ "TLS_ENABLED") "true" -}} - {{- $CA_FILE := /etc/pki/tls/ca.pem -}} - {{- $CERT_FILE := /etc/pki/tls/cert.pem -}} - {{- $KEY_FILE := /etc/pki/tls/key.pem -}} + {{- $CA_FILE := "/etc/pki/tls/ca.pem" -}} + {{- $CERT_FILE := "/etc/pki/tls/cert.pem" -}} + {{- $KEY_FILE := "/etc/pki/tls/key.pem" -}} prometheus diff --git a/addons/clickhouse/configs/client.xml.tpl b/addons/clickhouse/configs/client.xml.tpl index 492df57c4..0a736540d 100644 --- a/addons/clickhouse/configs/client.xml.tpl +++ b/addons/clickhouse/configs/client.xml.tpl @@ -2,9 +2,9 @@ admin {{- if eq (index $ "TLS_ENABLED") "true" -}} - {{- $CA_FILE := /etc/pki/tls/ca.pem -}} - {{- $CERT_FILE := /etc/pki/tls/cert.pem -}} - {{- $KEY_FILE := /etc/pki/tls/key.pem }} + {{- $CA_FILE := "/etc/pki/tls/ca.pem" -}} + {{- $CERT_FILE := "/etc/pki/tls/cert.pem" -}} + {{- $KEY_FILE := "/etc/pki/tls/key.pem" }} true diff --git a/addons/clickhouse/templates/_helpers.tpl b/addons/clickhouse/templates/_helpers.tpl index 23c3e1550..cc7aa01ec 100644 --- a/addons/clickhouse/templates/_helpers.tpl +++ b/addons/clickhouse/templates/_helpers.tpl @@ -104,10 +104,18 @@ Define clickhouse-keeper24 component definition regex pattern {{/* Define clickhouse24 config constraint name */}} -{{- define "clickhouse24.configConstraintName" -}} +{{- define "clickhouse24.paramsDefName" -}} clickhouse-24-config-constraints {{- end -}} +{{/* +Define clickhouse24 config constraint name +*/}} +{{- define "clickhouse24.pcrName" -}} +clickhouse-24-pcr +{{- end -}} + + {{/* Define clickhouse24 default overrides configuration tpl name */}} diff --git a/addons/clickhouse/templates/cmpd-clickhouse.yaml b/addons/clickhouse/templates/cmpd-clickhouse.yaml index fecc8ebe6..49f55d528 100644 --- a/addons/clickhouse/templates/cmpd-clickhouse.yaml +++ b/addons/clickhouse/templates/cmpd-clickhouse.yaml @@ -78,7 +78,6 @@ spec: templateRef: {{ include "clickhouse24.userTplName" . }} volumeName: user-config namespace: {{ .Release.Namespace }} - constraintRef: {{ include "clickhouse24.configConstraintName" . }} - name: clickhouse-client-tpl templateRef: {{ include "clickhouse24.clientTplName" . }} volumeName: client-config diff --git a/addons/clickhouse/templates/configconstraints.yaml b/addons/clickhouse/templates/configconstraints.yaml index 1c35afa29..a83e14cc1 100644 --- a/addons/clickhouse/templates/configconstraints.yaml +++ b/addons/clickhouse/templates/configconstraints.yaml @@ -1,7 +1,7 @@ apiVersion: apps.kubeblocks.io/v1beta1 kind: ConfigConstraint metadata: - name: {{ include "clickhouse24.configConstraintName" . }} + name: {{ include "clickhouse24.paramsDefName" . }} labels: {{- include "clickhouse.labels" . | nindent 4 }} spec: diff --git a/addons/clickhouse/templates/paramsdef.yaml b/addons/clickhouse/templates/paramsdef.yaml new file mode 100644 index 000000000..02ddfe858 --- /dev/null +++ b/addons/clickhouse/templates/paramsdef.yaml @@ -0,0 +1,18 @@ +{{- $pd := .Files.Get "config/3.0.2/broker-config-effect-scope.yaml" | fromYaml }} +apiVersion: parameters.kubeblocks.io/v1alpha1 +kind: ParametersDefinition +metadata: + name: {{ include "clickhouse24.paramsDefName" . }} + labels: + {{- include "clickhouse.labels" . | nindent 4 }} +spec: + fileName: user.xml + # ConfigurationSchema that impose restrictions on engine parameter's rule + parametersSchema: + # top level mysql configuration type + topLevelKey: ClickhouseParameter + + # schemaInJSON: auto generate from cue scripts + # example: ../../pkg/configuration/testdata/mysql_openapi.json + cue: |- + {{- .Files.Get "configs/clickhouse-config-constraint.cue" | nindent 6 }} \ No newline at end of file diff --git a/addons/clickhouse/templates/pcr.yaml b/addons/clickhouse/templates/pcr.yaml new file mode 100644 index 000000000..b29076aeb --- /dev/null +++ b/addons/clickhouse/templates/pcr.yaml @@ -0,0 +1,25 @@ +apiVersion: parameters.kubeblocks.io/v1alpha1 +kind: ParamConfigRenderer +metadata: + name: {{ include "clickhouse24.pcrName" . }} + labels: + {{- include "clickhouse.labels" . | nindent 4 }} +spec: + componentDef: {{ include "clickhouse24.cmpdName" . }} + parametersDefs: + - {{ include "clickhouse24.paramsDefName" . }} + + configs: + - name: config.xml + fileFormatConfig: + format: xml + reRenderResourceTypes: + - tls + - name: user.xml + fileFormatConfig: + format: xml + - name: 00_default_overrides.xml + fileFormatConfig: + format: xml + reRenderResourceTypes: + - hscale