Skip to content

Commit 7362069

Browse files
committed
appVersion for image version
Signed-off-by: Hung Nguyen <me@hnguy.com>
1 parent 04c1ed7 commit 7362069

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

stable/anchore-admission-controller/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v1
22
name: anchore-admission-controller
3-
version: 0.8.3
3+
version: 0.8.4
44
appVersion: 0.8.3
55
description: A kubernetes admission controller for validating and mutating webhooks that operates against Anchore Engine to make access decisions and annotations
66
home: https://github.com/anchore/kubernetes-admission-controller

stable/anchore-admission-controller/templates/_helpers.tpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,20 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
3737
{{- end }}
3838
app.kubernetes.io/managed-by: {{ .Release.Service }}
3939
{{- end -}}
40+
41+
{{/*
42+
Resolve the image, replacing "latest" tag with AppVersion for the default upstream image.
43+
Existing customers pinning a specific tag are unaffected.
44+
*/}}
45+
{{- define "anchore-admission-controller.image" -}}
46+
{{- $parts := splitList ":" .Values.image -}}
47+
{{- $repo := first $parts -}}
48+
{{- $tag := last $parts -}}
49+
{{- $defaultRepo := "anchore/kubernetes-admission-controller" -}}
50+
{{- $isDefault := or (eq $repo $defaultRepo) (eq $repo (printf "docker.io/%s" $defaultRepo)) (eq $repo (printf "docker.io/library/%s" $defaultRepo)) -}}
51+
{{- if and $isDefault (or (eq $tag "latest") (eq $tag $repo)) -}}
52+
{{- printf "%s:v%s" $repo .Chart.AppVersion -}}
53+
{{- else -}}
54+
{{- .Values.image -}}
55+
{{- end -}}
56+
{{- end -}}

stable/anchore-admission-controller/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
{{- end }}
4545
containers:
4646
- name: {{ .Chart.Name }}
47-
image: "{{ .Values.image.repository }}:v{{ .Values.image.tag | default .Chart.AppVersion }}"
47+
image: {{ include "anchore-admission-controller.image" . }}
4848
imagePullPolicy: {{ .Values.imagePullPolicy }}
4949
{{- with .Values.containerSecurityContext }}
5050
securityContext: {{- toYaml . | nindent 10 }}

stable/anchore-admission-controller/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ fullnameOverride: Null
55
replicaCount: 1
66
logVerbosity: 3
77

8-
image: "anchore/kubernetes-admission-controller:v0.8.3"
8+
image: "anchore/kubernetes-admission-controller:latest"
99
imagePullPolicy: IfNotPresent
1010
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
1111
imagePullSecrets: []

0 commit comments

Comments
 (0)