Skip to content

Commit 34efe55

Browse files
feat(helm): allow specifying operator image digest (#146)
1 parent 89b4720 commit 34efe55

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

dist/chart/templates/_helpers.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,15 @@ Dynamically calculates safe truncation to ensure total name length <= 63 chars.
4848
{{- printf "%s-%s" $fullname $suffix | trunc 63 | trimSuffix "-" }}
4949
{{- end }}
5050
{{- end }}
51+
52+
{{/*
53+
Util function for generating the image URL based on the provided options.
54+
Cribbed from the cert-manager organization.
55+
*/}}
56+
{{- define "clickhouse-operator.image" -}}
57+
{{- $defaultTag := index . 1 -}}
58+
{{- with index . 0 -}}
59+
{{ printf .repository }}
60+
{{- if .digest -}}{{ printf "@%s" .digest }}{{- else -}}{{ printf ":%s" (default $defaultTag .tag) }}{{- end -}}
61+
{{- end }}
62+
{{- end }}

dist/chart/templates/manager/manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ spec:
6565
{{- $env = append $env (dict "name" "WATCH_NAMESPACE" "value" (join "," .Values.watchNamespaces)) }}
6666
{{- end }}
6767
env: {{ toYaml $env | nindent 22 }}
68-
image: "{{ .Values.manager.image.repository }}:{{ default .Chart.AppVersion .Values.manager.image.tag }}"
68+
image: "{{ include "clickhouse-operator.image" (tuple .Values.manager.image $.Chart.AppVersion) }}"
6969
imagePullPolicy: {{ .Values.manager.image.pullPolicy }}
7070
livenessProbe:
7171
httpGet:

dist/chart/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ manager:
1717

1818
image:
1919
repository: ghcr.io/clickhouse/clickhouse-operator
20+
## Digest of the image to use. Tag is used if unset.
21+
##
22+
## digest: sha256:abc123
2023
## Tag of the image to use. Defaults to the chart's appVersion if not set.
2124
##
2225
## tag: latest

0 commit comments

Comments
 (0)