Skip to content

Commit

Permalink
enhancement(helm): Allow an image digest to be provided instead of a …
Browse files Browse the repository at this point in the history
…tag (#1735)

Signed-off-by: Andrew Haines <haines@cerbos.dev>
  • Loading branch information
haines committed Aug 8, 2023
1 parent c7c5f37 commit 3fbd95e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions deploy/charts/cerbos/templates/_helpers.tpl
Expand Up @@ -154,3 +154,16 @@ Detect if bundle driver is used with default config
{{- $isDefaultCache := (eq (dig "config" "storage" "bundle" "remote" "cacheDir" "<not_defined>" .Values.cerbos) "<not_defined>") -}}
{{- if (and $isBundleDriver $isDefaultTmp $isDefaultCache) -}}yes{{- else -}}no{{- end -}}
{{- end }}

{{/*
The image reference to use in pods
*/}}
{{- define "cerbos.image" -}}
"{{ .Values.image.repository }}
{{- with .Values.image.digest -}}
@{{ . }}
{{- else -}}
:{{ .Values.image.tag | default .Chart.AppVersion }}
{{- end -}}
"
{{- end }}
2 changes: 1 addition & 1 deletion deploy/charts/cerbos/templates/deployment.yaml
Expand Up @@ -45,7 +45,7 @@ spec:
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
image: {{ include "cerbos.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "server"
Expand Down
2 changes: 2 additions & 0 deletions deploy/charts/cerbos/values.yaml
Expand Up @@ -12,6 +12,8 @@ replicaCount: 1
image:
repository: ghcr.io/cerbos/cerbos
pullPolicy: IfNotPresent
# Image digest to use. Takes precedence over tag if specified.
digest: ""
# Image tag to use. Defaults to the chart appVersion.
tag: ""

Expand Down

0 comments on commit 3fbd95e

Please sign in to comment.