Skip to content

Commit 4ea740e

Browse files
committed
upgrade altinity-clickhouse-operator
1 parent eb9f160 commit 4ea740e

10 files changed

Lines changed: 485 additions & 826 deletions

charts/altinity-clickhouse-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ description: |-
77
88
Refer to operator repo for additional information.
99
type: application
10-
version: 0.1.1
11-
appVersion: 0.19.3
10+
version: 0.1.2
11+
appVersion: 0.20.0
1212
home: https://github.com/slamdev/helm-charts/tree/master/charts/altinity-clickhouse-operator
1313
icon: https://artifacthub.io/image/2d6aa29c-c74f-4bff-bede-ba7e6e0315a7@2x
1414
maintainers:

charts/altinity-clickhouse-operator/README.md

Lines changed: 5 additions & 2 deletions
Large diffs are not rendered by default.

charts/altinity-clickhouse-operator/crds/CustomResourceDefinition-clickhouseinstallations.clickhouse.altinity.com.yaml

Lines changed: 116 additions & 373 deletions
Large diffs are not rendered by default.

charts/altinity-clickhouse-operator/crds/CustomResourceDefinition-clickhouseinstallationtemplates.clickhouse.altinity.com.yaml

Lines changed: 116 additions & 373 deletions
Large diffs are not rendered by default.

charts/altinity-clickhouse-operator/crds/CustomResourceDefinition-clickhouseoperatorconfigurations.clickhouse.altinity.com.yaml

Lines changed: 76 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ kind: CustomResourceDefinition
77
metadata:
88
name: clickhouseoperatorconfigurations.clickhouse.altinity.com
99
labels:
10-
clickhouse.altinity.com/chop: 0.19.3
10+
clickhouse.altinity.com/chop: 0.20.0
1111
spec:
1212
group: clickhouse.altinity.com
1313
scope: Namespaced
@@ -51,6 +51,7 @@ spec:
5151
properties:
5252
watch:
5353
type: object
54+
description: "Parameters for watch kubernetes resources which used by clickhouse-operator deployment"
5455
properties:
5556
namespaces:
5657
type: array
@@ -59,6 +60,7 @@ spec:
5960
type: string
6061
clickhouse:
6162
type: object
63+
description: "Clickhouse related parameters used by clickhouse-operator"
6264
properties:
6365
configuration:
6466
type: object
@@ -77,9 +79,10 @@ spec:
7779
description: "Path to the folder where ClickHouse configuration files unique for each instance (host) within a CHI are located. Default - conf.d"
7880
user:
7981
type: string
80-
description: "Path to the folder where ClickHouse configuration files with users settings are located. Files are common for all instances within a CHI."
82+
description: "Path to the folder where ClickHouse configuration files with users settings are located. Files are common for all instances within a CHI. Default - users.d"
8183
user:
8284
type: object
85+
description: "Default parameters for any user which will create"
8386
properties:
8487
default:
8588
type: object
@@ -100,12 +103,14 @@ spec:
100103
description: "ClickHouse server configuration `<password>...</password>` for any <user>"
101104
network:
102105
type: object
106+
description: "Default network parameters for any user which will create"
103107
properties:
104108
hostRegexpTemplate:
105109
type: string
106110
description: "ClickHouse server configuration `<host_regexp>...</host_regexp>` for any <user>"
107111
access:
108112
type: object
113+
description: "parameters which use for connect to clickhouse from clickhouse-operator deployment"
109114
properties:
110115
scheme:
111116
type: string
@@ -132,9 +137,24 @@ spec:
132137
type: integer
133138
minimum: 1
134139
maximum: 65535
135-
description: "port to be used by operator to connect to ClickHouse instances"
140+
description: "Port to be used by operator to connect to ClickHouse instances"
141+
timeouts:
142+
type: object
143+
description: "Timeouts used to limit connection and queries from the operator to ClickHouse instances, In seconds"
144+
properties:
145+
connect:
146+
type: integer
147+
minimum: 1
148+
maximum: 10
149+
description: "Connect timeout. In seconds."
150+
query:
151+
type: integer
152+
minimum: 1
153+
maximum: 600
154+
description: "Query timeout. In seconds."
136155
template:
137156
type: object
157+
description: "Parameters which are used if you want to generate ClickHouseInstallationTemplate custom resources from files which are stored inside clickhouse-operator deployment"
138158
properties:
139159
chi:
140160
type: object
@@ -144,9 +164,11 @@ spec:
144164
description: "Path to folder where ClickHouseInstallationTemplate .yaml manifests are located."
145165
reconcile:
146166
type: object
167+
description: "allow tuning reconciling process"
147168
properties:
148169
runtime:
149170
type: object
171+
description: "runtime parameters for clickhouse-operator process which use during reconciling"
150172
properties:
151173
threadsNumber:
152174
type: integer
@@ -155,9 +177,11 @@ spec:
155177
description: "How many goroutines will be used to reconcile in parallel, 10 by default"
156178
statefulSet:
157179
type: object
180+
description: "Allow change default behavior for reconciling StatefulSet which generated by clickhouse-operator"
158181
properties:
159182
create:
160183
type: object
184+
description: "Behavior during create StatefulSet"
161185
properties:
162186
onFailure:
163187
type: string
@@ -169,6 +193,7 @@ spec:
169193
3. ignore (default) - ignore error, pretend nothing happened and move on to the next StatefulSet.
170194
update:
171195
type: object
196+
description: "Behavior during update StatefulSet"
172197
properties:
173198
timeout:
174199
type: integer
@@ -186,30 +211,69 @@ spec:
186211
3. ignore - ignore error, pretend nothing happened and move on to the next StatefulSet.
187212
host:
188213
type: object
214+
description: "allow define how to wait host include to system.cluster behavior during scale up and scale down cluster operations"
189215
properties:
190216
wait:
191217
type: object
192218
properties:
193-
exclude:
194-
type: boolean
219+
exclude: &TypeStringBool
220+
type: string
221+
description: "wait when a pod will be removed from the cluster"
222+
enum:
223+
# List StringBoolXXX constants from model
224+
- ""
225+
- "0"
226+
- "1"
227+
- "False"
228+
- "false"
229+
- "True"
230+
- "true"
231+
- "No"
232+
- "no"
233+
- "Yes"
234+
- "yes"
235+
- "Off"
236+
- "off"
237+
- "On"
238+
- "on"
239+
- "Disable"
240+
- "disable"
241+
- "Enable"
242+
- "enable"
243+
- "Disabled"
244+
- "disabled"
245+
- "Enabled"
246+
- "enabled"
195247
include:
196-
type: boolean
248+
!!merge <<: *TypeStringBool
249+
description: "wait when a pod will be added to the cluster"
197250
annotation:
198251
type: object
252+
description: "defines which metadata.annotations items will include or exclude during render StatefulSet, Pod, PVC resources"
199253
properties:
200254
include:
201255
type: array
256+
description: |
257+
When propagating labels from the chi's `metadata.annotations` section to child objects' `metadata.annotations`,
258+
include annotations with names from the following list
202259
items:
203260
type: string
204261
exclude:
205262
type: array
263+
description: |
264+
When propagating labels from the chi's `metadata.annotations` section to child objects' `metadata.annotations`,
265+
exclude annotations with names from the following list
206266
items:
207267
type: string
208268
label:
209269
type: object
270+
description: "defines which metadata.labels will include or exclude during render StatefulSet, Pod, PVC resources"
210271
properties:
211272
include:
212273
type: array
274+
description: |
275+
When propagating labels from the chi's `metadata.labels` section to child objects' `metadata.labels`,
276+
include labels from the following list
213277
items:
214278
type: string
215279
exclude:
@@ -220,7 +284,7 @@ spec:
220284
When propagating labels from the chi's `metadata.labels` section to child objects' `metadata.labels`,
221285
exclude labels from the following list
222286
appendScope:
223-
type: string
287+
!!merge <<: *TypeStringBool
224288
description: |
225289
Whether to append *Scope* labels to StatefulSet and Pod
226290
- "LabelShardScopeIndex"
@@ -233,43 +297,23 @@ spec:
233297
- "LabelClusterScopeCycleSize"
234298
- "LabelClusterScopeCycleIndex"
235299
- "LabelClusterScopeCycleOffset"
236-
enum:
237-
# List StringBoolXXX constants from model
238-
- ""
239-
- "0"
240-
- "1"
241-
- "False"
242-
- "false"
243-
- "True"
244-
- "true"
245-
- "No"
246-
- "no"
247-
- "Yes"
248-
- "yes"
249-
- "Off"
250-
- "off"
251-
- "On"
252-
- "on"
253-
- "Disable"
254-
- "disable"
255-
- "Enable"
256-
- "enable"
257-
- "Disabled"
258-
- "disabled"
259-
- "Enabled"
260-
- "enabled"
261300
statefulSet:
262301
type: object
302+
description: "define StatefulSet-specific parameters"
263303
properties:
264304
revisionHistoryLimit:
265305
type: integer
306+
description: "revisionHistoryLimit is the maximum number of revisions that will be\nmaintained in the StatefulSet's revision history. \nLook details in `statefulset.spec.revisionHistoryLimit`\n"
266307
pod:
267308
type: object
309+
description: "define pod specific parameters"
268310
properties:
269311
terminationGracePeriod:
270312
type: integer
313+
description: "Optional duration in seconds the pod needs to terminate gracefully. \nLook details in `pod.spec.terminationGracePeriodSeconds`\n"
271314
logger:
272315
type: object
316+
description: "allow setup clickhouse-operator logger behavior"
273317
properties:
274318
logtostderr:
275319
type: string

charts/altinity-clickhouse-operator/hacks/sync-yamls.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function process() {
8181
ServiceAccount)
8282
update_serviceaccount_resource "${processed_file}"
8383
;;
84+
Secret)
85+
update_secret_resource "${processed_file}"
86+
;;
8487
CustomResourceDefinition) ;;
8588

8689
*)
@@ -151,6 +154,7 @@ function update_deployment_resource() {
151154
yq e -i '.spec.template.spec.containers[1].image |= "{{ .Values.metrics.image.repository }}:{{ include \"altinity-clickhouse-operator.metrics.tag\" . }}"' "${file}"
152155
yq e -i '.spec.template.spec.containers[1].imagePullPolicy |= "{{ .Values.metrics.image.pullPolicy }}"' "${file}"
153156
yq e -i '.spec.template.spec.containers[1].resources |= "{{ toYaml .Values.metrics.resources | nindent 12 }}"' "${file}"
157+
yq e -i '(.spec.template.spec.containers[1].env[] | select(.valueFrom.resourceFieldRef.containerName == "clickhouse-operator") | .valueFrom.resourceFieldRef.containerName) = "{{ .Chart.Name }}"' "${file}"
154158
yq e -i '.spec.template.spec.containers[1].env += ["{{ with .Values.metrics.env }}{{ toYaml . | nindent 12 }}{{ end }}"]' "${file}"
155159

156160
perl -pi -e "s/'{{ toYaml .Values.podAnnotations \| nindent 8 }}': null/{{ toYaml .Values.podAnnotations \| nindent 8 }}/g" "${file}"
@@ -239,6 +243,36 @@ function update_serviceaccount_resource() {
239243
perl -pi -e "s/'//g" "${file}"
240244
}
241245

246+
function update_secret_resource() {
247+
readonly file="${1}"
248+
readonly name=$(yq e '.metadata.name' "${file}")
249+
250+
if [ "${name}" != 'clickhouse-operator' ]; then
251+
echo "do not know how to process ${name} secret"
252+
exit 1
253+
fi
254+
255+
yq e -i '.metadata.name |= "{{ include \"altinity-clickhouse-operator.fullname\" . }}"' "${file}"
256+
yq e -i '.metadata.namespace |= "{{ .Release.Namespace }}"' "${file}"
257+
yq e -i '.metadata.labels |= "{{ include \"altinity-clickhouse-operator.labels\" . | nindent 4 }}"' "${file}"
258+
259+
yq e -i '.data.username |= "{{ .Values.secret.username | b64enc }}"' "${file}"
260+
yq e -i '.data.password |= "{{ .Values.secret.password | b64enc }}"' "${file}"
261+
262+
readonly username=$(yq e '.stringData.username' "${file}")
263+
yq e -i '.secret.username |= "'"${username}"'"' "${values_yaml}"
264+
265+
readonly password=$(yq e '.stringData.password' "${file}")
266+
yq e -i '.secret.password |= "'"${password}"'"' "${values_yaml}"
267+
268+
yq e -i 'del(.stringData)' "${file}"
269+
270+
printf '%s\n%s\n' '{{- if .Values.secret.create -}}' "$(cat "${file}")" >"${file}"
271+
printf '%s\n%s\n' "$(cat "${file}")" '{{- end -}}' >"${file}"
272+
273+
perl -pi -e "s/'//g" "${file}"
274+
}
275+
242276
function to_camel_case() {
243277
readonly str="${1}"
244278
echo "${str}" | awk -F - '{printf "%s", $1; for(i=2; i<=NF; i++) printf "%s", toupper(substr($i,1,1)) substr($i,2); print"";}'

charts/altinity-clickhouse-operator/templates/generated/ClusterRole-clickhouse-operator-kube-system.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ rules:
2020
resources:
2121
- configmaps
2222
- services
23+
- persistentvolumeclaims
2324
verbs:
2425
- get
2526
- list
@@ -42,17 +43,6 @@ rules:
4243
- events
4344
verbs:
4445
- create
45-
- apiGroups:
46-
- ""
47-
resources:
48-
- persistentvolumeclaims
49-
verbs:
50-
- get
51-
- list
52-
- patch
53-
- update
54-
- watch
55-
- delete
5646
- apiGroups:
5747
- ""
5848
resources:

0 commit comments

Comments
 (0)