fix missing support for .Values.global.repository (#7195)

* fix missing support for .Values.global.repository

* rework based on gemini feedback to handle repository+imageName more cleanly

* use base rather than last + splitList
This commit is contained in:
Benjamin Reed
2025-09-05 01:28:21 -04:00
committed by GitHub
parent cd78e653e1
commit b3b1316b54
2 changed files with 7 additions and 3 deletions

View File

@@ -96,13 +96,16 @@ Inject extra environment vars in the format key:value, if populated
{{/* Computes the container image name for all components (if they are not overridden) */}} {{/* Computes the container image name for all components (if they are not overridden) */}}
{{- define "common.image" -}} {{- define "common.image" -}}
{{- $registryName := default .Values.image.registry .Values.global.registry | toString -}} {{- $registryName := default .Values.image.registry .Values.global.registry | toString -}}
{{- $repositoryName := .Values.image.repository | toString -}} {{- $repositoryName := default .Values.image.repository .Values.global.repository | toString -}}
{{- $name := .Values.global.imageName | toString -}} {{- $name := .Values.global.imageName | toString -}}
{{- $tag := default .Chart.AppVersion .Values.image.tag | toString -}} {{- $tag := default .Chart.AppVersion .Values.image.tag | toString -}}
{{- if $repositoryName -}}
{{- $name = printf "%s/%s" (trimSuffix "/" $repositoryName) (base $name) -}}
{{- end -}}
{{- if $registryName -}} {{- if $registryName -}}
{{- printf "%s/%s%s:%s" $registryName $repositoryName $name $tag -}} {{- printf "%s/%s:%s" $registryName $name $tag -}}
{{- else -}} {{- else -}}
{{- printf "%s%s:%s" $repositoryName $name $tag -}} {{- printf "%s:%s" $name $tag -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}

View File

@@ -3,6 +3,7 @@
global: global:
createClusterRole: true createClusterRole: true
registry: "" registry: ""
# if repository is set, it overrides the namespace part of imageName
repository: "" repository: ""
imageName: chrislusf/seaweedfs imageName: chrislusf/seaweedfs
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent