Skip to content

Commit a48261f

Browse files
authored
Implement multiple hostIPs for users (#73)
1 parent 36ad8d8 commit a48261f

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

charts/clickhouse/templates/chi.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,14 @@ spec:
132132
key: password
133133
{{- range .Values.clickhouse.users }}
134134
{{ required "A user must have a name" .name }}/access_management: {{ .accessManagement | default 0}}
135+
{{- if kindIs "slice" .hostIP }}
136+
{{ .name }}/networks/ip:
137+
{{- range .hostIP }}
138+
- {{ . | quote }}
139+
{{- end }}
140+
{{- else }}
135141
{{ .name }}/networks/ip: {{ .hostIP | default "0.0.0.0/0" | quote }}
142+
{{- end }}
136143
{{- if .grants }}
137144
{{ .name }}/grants/query:
138145
{{- range .grants }}

charts/clickhouse/values.schema.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,20 @@
4747
"pattern": "^[a-zA-Z0-9]+$"
4848
},
4949
"hostIP": {
50-
"type": "string",
51-
"description": "Mask for IPs allowed for this user.",
50+
"oneOf": [
51+
{
52+
"type": "string",
53+
"description": "Single IP mask allowed for this user."
54+
},
55+
{
56+
"type": "array",
57+
"description": "Multiple IP masks allowed for this user.",
58+
"items": {
59+
"type": "string"
60+
}
61+
}
62+
],
63+
"description": "Mask for IPs allowed for this user. Can be a string or array of strings.",
5264
"default": "0.0.0.0/0"
5365
},
5466
"password_secret_name": {

charts/clickhouse/values.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ clickhouse:
2626
# @default -- 127.0.0.1/32
2727
hostIP: 127.0.0.1/32
2828

29-
# Configure additional users
29+
# -- Configure additional ClickHouse users.
3030
users: []
31+
# users:
32+
# - name: app_user
33+
# hostIP: ["10.0.0.0/8"] # default: "0.0.0.0/0"
34+
# accessManagement: 1 # default: 0
35+
# password_secret_name: "app-user-secret" # secret must contain 'password' key
36+
# grants:
37+
# - "GRANT SELECT ON database.*"
3138

3239
# -- number of replicas. If greater than 1, keeper must be enabled
3340
# or a keeper host should be provided under clickhouse.keeper.host.

0 commit comments

Comments
 (0)