@@ -422,31 +422,37 @@ ClickHouse hostname
422422{{/*
423423ClickHouse URL for application (with secure parameter)
424424
425- Note on the external+existingSecret branch : the password is expanded via
426- Kubernetes' `$(VAR)` syntax, not shell `${VAR}`. Kubelet substitutes
427- `$(CLICKHOUSE_PASSWORD)` at container-creation time from the
425+ Note on the deploy and external+existingSecret branches : the password is
426+ expanded via Kubernetes' `$(VAR)` syntax, not shell `${VAR}`. Kubelet
427+ substitutes `$(CLICKHOUSE_PASSWORD)` at container-creation time from the
428428CLICKHOUSE_PASSWORD env var declared just before CLICKHOUSE_URL in
429429webapp.yaml. Shell-style `${...}` does not work here because
430430`docker/scripts/entrypoint.sh` assigns CLICKHOUSE_URL to GOOSE_DBSTRING
431431with a single-pass expansion (`export GOOSE_DBSTRING="$CLICKHOUSE_URL"`),
432432so any inner `${...}` reaches goose verbatim and fails URL parsing.
433433
434434CLICKHOUSE_PASSWORD must contain only URL-userinfo-safe characters — the
435- value is substituted verbatim, so `@ : / ? # [ ] %` break the URL. Use a
436- hex-encoded password or percent-encode before storing in the Secret.
435+ value is substituted verbatim, so `@ : / ? # [ ] %` break the URL. The
436+ chart-generated datastore password is hex, which is safe; a pinned
437+ auth.password or external Secret value must be URL-safe too.
438+
439+ Inline credentials (usernames and the external plain password) are
440+ percent-encoded via urlquery, so special characters are safe there —
441+ except spaces, which urlquery encodes as `+` and userinfo decoding keeps
442+ literal.
437443*/ }}
438444{{- define " trigger-v4.clickhouse.url" -}}
439445{{- if .Values.clickhouse.deploy -}}
440446{{- $protocol := ternary " https" " http" .Values.clickhouse.secure -}}
441447{{- $secure := ternary " true" " false" .Values.clickhouse.secure -}}
442- {{ $protocol }}://{{ .Values.clickhouse.auth.username }}:$ (CLICKHOUSE_PASSWORD)@{{ include " trigger-v4.clickhouse.hostname" . }}:{{ .Values.clickhouse.service.ports.http }}?secure= {{ $secure }}
448+ {{ $protocol }}://{{ .Values.clickhouse.auth.username | urlquery }}:$ (CLICKHOUSE_PASSWORD)@{{ include " trigger-v4.clickhouse.hostname" . }}:{{ .Values.clickhouse.service.ports.http }}?secure= {{ $secure }}
443449{{- else if .Values.clickhouse.external.host -}}
444450{{- $protocol := ternary " https" " http" .Values.clickhouse.external.secure -}}
445451{{- $secure := ternary " true" " false" .Values.clickhouse.external.secure -}}
446452{{- if .Values.clickhouse.external.existingSecret -}}
447- {{ $protocol }}://{{ .Values.clickhouse.external.username }}:$ (CLICKHOUSE_PASSWORD)@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}?secure= {{ $secure }}
453+ {{ $protocol }}://{{ .Values.clickhouse.external.username | urlquery }}:$ (CLICKHOUSE_PASSWORD)@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}?secure= {{ $secure }}
448454{{- else -}}
449- {{ $protocol }}://{{ .Values.clickhouse.external.username }}:{{ .Values.clickhouse.external.password }}@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}?secure= {{ $secure }}
455+ {{ $protocol }}://{{ .Values.clickhouse.external.username | urlquery }}:{{ .Values.clickhouse.external.password | urlquery }}@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}?secure= {{ $secure }}
450456{{- end -}}
451457{{- end -}}
452458{{- end }}
@@ -460,13 +466,13 @@ applies to the replication URL.
460466{{- define " trigger-v4.clickhouse.replication.url" -}}
461467{{- if .Values.clickhouse.deploy -}}
462468{{- $protocol := ternary " https" " http" .Values.clickhouse.secure -}}
463- {{ $protocol }}://{{ .Values.clickhouse.auth.username }}:$ (CLICKHOUSE_PASSWORD)@{{ include " trigger-v4.clickhouse.hostname" . }}:{{ .Values.clickhouse.service.ports.http }}
469+ {{ $protocol }}://{{ .Values.clickhouse.auth.username | urlquery }}:$ (CLICKHOUSE_PASSWORD)@{{ include " trigger-v4.clickhouse.hostname" . }}:{{ .Values.clickhouse.service.ports.http }}
464470{{- else if .Values.clickhouse.external.host -}}
465471{{- $protocol := ternary " https" " http" .Values.clickhouse.external.secure -}}
466472{{- if .Values.clickhouse.external.existingSecret -}}
467- {{ $protocol }}://{{ .Values.clickhouse.external.username }}:$ (CLICKHOUSE_PASSWORD)@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}
473+ {{ $protocol }}://{{ .Values.clickhouse.external.username | urlquery }}:$ (CLICKHOUSE_PASSWORD)@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}
468474{{- else -}}
469- {{ $protocol }}://{{ .Values.clickhouse.external.username }}:{{ .Values.clickhouse.external.password }}@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}
475+ {{ $protocol }}://{{ .Values.clickhouse.external.username | urlquery }}:{{ .Values.clickhouse.external.password | urlquery }}@{{ .Values.clickhouse.external.host }}:{{ .Values.clickhouse.external.httpPort | default 8123 }}
470476{{- end -}}
471477{{- end -}}
472478{{- end }}
0 commit comments