Skip to content

Commit 3d7c21e

Browse files
Add support for external password secrets in ClickHouse Helm chart (#64)
- Add password_secret_name parameter to allow using existing K8s secrets - Update chi.yaml template to reference external secret when specified - Make credentials.yaml creation conditional based on external secret usage - Maintain backward compatibility with existing password configurations - Add documentation for new parameter in README and values.yaml
1 parent 0fd3958 commit 3d7c21e

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

charts/clickhouse/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ EOSQL
167167
| clickhouse.defaultUser.allowExternalAccess | bool | `false` | Allow the default user to access ClickHouse from any IP. If set, will override `hostIP` to always be `0.0.0.0/0`. |
168168
| clickhouse.defaultUser.hostIP | string | `"127.0.0.1/32"` | |
169169
| clickhouse.defaultUser.password | string | `""` | |
170+
| clickhouse.defaultUser.password_secret_name | string | `""` | Name of an existing Kubernetes secret containing the default user password. If set, the password will be read from the secret instead of using the password field. The secret should contain a key named 'password'. |
170171
| clickhouse.extraConfig | string | `"<clickhouse>\n</clickhouse>\n"` | Miscellanous config for ClickHouse (in xml format) |
171172
| clickhouse.extraUsers | string | `"<clickhouse>\n</clickhouse>\n"` | Additional users config for ClickHouse (in xml format) |
172173
| clickhouse.image.pullPolicy | string | `"IfNotPresent"` | |

charts/clickhouse/templates/chi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ spec:
128128
default/password:
129129
valueFrom:
130130
secretKeyRef:
131-
name: {{ include "clickhouse.credentialsName" . }}
131+
name: {{ .Values.clickhouse.defaultUser.password_secret_name | default (include "clickhouse.credentialsName" .) | quote }}
132132
key: password
133133
{{- range .Values.clickhouse.users }}
134134
{{ required "A user must have a name" .name }}/access_management: {{ .accessManagement | default 0}}

charts/clickhouse/templates/credentials.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if not .Values.clickhouse.defaultUser.password_secret_name }}
12
apiVersion: v1
23
kind: Secret
34
metadata:
@@ -6,3 +7,4 @@ type: Opaque
67
stringData:
78
user: "default"
89
password: "{{ .Values.clickhouse.defaultUser.password }}"
10+
{{- end }}

charts/clickhouse/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ namespaceDomainPattern: ""
1414
clickhouse:
1515
defaultUser:
1616
password: ""
17+
# -- Name of an existing Kubernetes secret containing the default user password.
18+
# If set, the password will be read from the secret instead of using the password field.
19+
# The secret should contain a key named 'password'.
20+
password_secret_name: ""
1721
# -- Allow the default user to access ClickHouse from any IP.
1822
# If set, will override `hostIP` to always be `0.0.0.0/0`.
1923
allowExternalAccess: false

0 commit comments

Comments
 (0)