Skip to content

Commit

Permalink
Add support for image registry and digest
Browse files Browse the repository at this point in the history
  • Loading branch information
zltyfsh committed Feb 27, 2024
1 parent 2c1d97b commit c42bd2e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
23 changes: 23 additions & 0 deletions charts/trino/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,26 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Return the proper image name
{{ include "trino.image" . }}

Code is inspired from bitnami/common

*/}}
{{- define "trino.image" -}}
{{- $registryName := .Values.image.registry -}}
{{- $repositoryName := .Values.image.repository -}}
{{- $separator := ":" -}}
{{- $termination := (default .Chart.AppVersion .Values.image.tag) | toString -}}
{{- if .Values.image.digest }}
{{- $separator = "@" -}}
{{- $termination = .Values.image.digest | toString -}}
{{- end -}}
{{- if $registryName }}
{{- printf "%s/%s%s%s" $registryName $repositoryName $separator $termination -}}
{{- else -}}
{{- printf "%s%s%s" $repositoryName $separator $termination -}}
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ spec:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-coordinator
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: {{ include "trino.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- toYaml .Values.env | nindent 12 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/trino/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ spec:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
containers:
- name: {{ .Chart.Name }}-worker
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: {{ include "trino.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- toYaml .Values.env | nindent 12 }}
Expand Down
8 changes: 5 additions & 3 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
# Declare variables to be passed into your templates.

image:
repository: trinodb/trino
pullPolicy: IfNotPresent
registry: "" # Trino image registry
repository: trinodb/trino # Trind image repository
# Overrides the image tag whose default is the chart version.
# Same value as Chart.yaml#appVersion
tag: 432
tag: "" # Trino image tag. Default is appVersion from Chart.yaml
digest: "" # Trino image digest as `sha256:abcd...`. Please note this parameter, if set, will override the tag
pullPolicy: IfNotPresent

imagePullSecrets:
- name: registry-credentials
Expand Down

0 comments on commit c42bd2e

Please sign in to comment.