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 clickhouse #1372

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
6 changes: 3 additions & 3 deletions addons/clickhouse/configs/00_default_overrides.xml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
</prometheus>
<!-- tls configuration -->
{{- 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" }}
<protocols>
<prometheus_protocol>
<type>prometheus</type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
</prometheus>
<!-- tls configuration -->
{{- 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" -}}
<protocols>
<prometheus_protocol>
<type>prometheus</type>
Expand Down
6 changes: 3 additions & 3 deletions addons/clickhouse/configs/client.xml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<user>admin</user>
<password from_env="CLICKHOUSE_ADMIN_PASSWORD"/>
{{- 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" }}
<secure>true</secure>
<openSSL>
<client>
Expand Down
10 changes: 9 additions & 1 deletion addons/clickhouse/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/}}
Expand Down
1 change: 0 additions & 1 deletion addons/clickhouse/templates/cmpd-clickhouse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion addons/clickhouse/templates/configconstraints.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
18 changes: 18 additions & 0 deletions addons/clickhouse/templates/paramsdef.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
25 changes: 25 additions & 0 deletions addons/clickhouse/templates/pcr.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading