diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index 934226e4..a671011a 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -43,10 +43,16 @@ Create image name that is used in the deployment */}} {{- define "nextcloud.image" -}} {{- if .Values.image.tag -}} -{{- printf "%s/%s:%s" (coalesce .Values.global.image.registry .Values.image.registry) .Values.image.repository .Values.image.tag -}} +{{- printf "%s/%s:%s" (coalesce .Values.global.image.registry .Values.image.registry) .Values.image.repository (include "nextcloud.version" .) -}} {{- else -}} -{{- printf "%s/%s:%s-%s" (coalesce .Values.global.image.registry .Values.image.registry) .Values.image.repository .Chart.AppVersion .Values.image.flavor -}} +{{- printf "%s/%s:%s-%s" (coalesce .Values.global.image.registry .Values.image.registry) .Values.image.repository (include "nextcloud.version" .) .Values.image.flavor -}} {{- end -}} + +{{/* +Return Nextcloud version from either image tag or AppVersion +*/}} +{{- define "nextcloud.version" -}} +{{- .Values.image.tag | default .Chart.AppVersion }} {{- end -}} @@ -445,7 +451,7 @@ Parameters: {{ include "nextcloud.selectorLabels" ( dict "component" .component "rootContext" .rootContext) }} helm.sh/chart: {{ include "nextcloud.chart" .rootContext }} app.kubernetes.io/managed-by: {{ .rootContext.Release.Service }} -{{- with .rootContext.Chart.AppVersion }} +{{- with (include "nextcloud.version" .rootContext) }} app.kubernetes.io/version: {{ quote . }} {{- end }} {{- end -}}