From c7e8906ad2f8e55866e0e1392500ed5b9e51c574 Mon Sep 17 00:00:00 2001 From: Gregor Tudan Date: Thu, 27 Jun 2024 17:02:50 +0200 Subject: [PATCH] Helm-Chart: clean up image handling (#5720) Clean up the image computation to make it consistent with the values file --- k8s/charts/seaweedfs/templates/_helpers.tpl | 45 +++++++-------------- k8s/charts/seaweedfs/values.yaml | 13 +----- 2 files changed, 15 insertions(+), 43 deletions(-) diff --git a/k8s/charts/seaweedfs/templates/_helpers.tpl b/k8s/charts/seaweedfs/templates/_helpers.tpl index f6f7b8991..d8261eb32 100644 --- a/k8s/charts/seaweedfs/templates/_helpers.tpl +++ b/k8s/charts/seaweedfs/templates/_helpers.tpl @@ -49,25 +49,7 @@ Inject extra environment vars in the format key:value, if populated {{- $imageOverride := .Values.filer.imageOverride -}} {{- printf "%s" $imageOverride -}} {{- else -}} -{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} -{{- $repositoryName := .Values.image.repository | toString -}} -{{- $name := .Values.global.imageName | toString -}} -{{- $tag := .Chart.AppVersion | toString -}} -{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} -{{- end -}} -{{- end -}} - -{{/* Return the proper dbSchema image */}} -{{- define "filer.dbSchema.image" -}} -{{- if .Values.filer.dbSchema.imageOverride -}} -{{- $imageOverride := .Values.filer.dbSchema.imageOverride -}} -{{- printf "%s" $imageOverride -}} -{{- else -}} -{{- $registryName := default .Values.global.registry .Values.global.localRegistry | toString -}} -{{- $repositoryName := .Values.global.repository | toString -}} -{{- $name := .Values.filer.dbSchema.imageName | toString -}} -{{- $tag := .Values.filer.dbSchema.imageTag | toString -}} -{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} +{{- include "common.image" . }} {{- end -}} {{- end -}} @@ -77,11 +59,7 @@ Inject extra environment vars in the format key:value, if populated {{- $imageOverride := .Values.master.imageOverride -}} {{- printf "%s" $imageOverride -}} {{- else -}} -{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} -{{- $repositoryName := .Values.image.repository | toString -}} -{{- $name := .Values.global.imageName | toString -}} -{{- $tag := .Chart.AppVersion | toString -}} -{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} +{{- include "common.image" . }} {{- end -}} {{- end -}} @@ -91,11 +69,7 @@ Inject extra environment vars in the format key:value, if populated {{- $imageOverride := .Values.s3.imageOverride -}} {{- printf "%s" $imageOverride -}} {{- else -}} -{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} -{{- $repositoryName := .Values.image.repository | toString -}} -{{- $name := .Values.global.imageName | toString -}} -{{- $tag := .Chart.AppVersion | toString -}} -{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} +{{- include "common.image" . }} {{- end -}} {{- end -}} @@ -105,11 +79,20 @@ Inject extra environment vars in the format key:value, if populated {{- $imageOverride := .Values.volume.imageOverride -}} {{- printf "%s" $imageOverride -}} {{- else -}} -{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}} +{{- include "common.image" . }} +{{- end -}} +{{- end -}} + +{{/* Computes the container image name for all components (if they are not overridden) */}} +{{- define "common.image" -}} +{{- $registryName := default .Values.image.registry .Values.global.registry | toString -}} {{- $repositoryName := .Values.image.repository | toString -}} {{- $name := .Values.global.imageName | toString -}} {{- $tag := .Chart.AppVersion | toString -}} -{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}} +{{- if $registryName -}} +{{- printf "%s/%s%s:%s" $registryName $repositoryName $name $tag -}} +{{- else -}} +{{- printf "%s%s:%s" $repositoryName $name $tag -}} {{- end -}} {{- end -}} diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index e275a90d3..53385779e 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -48,9 +48,6 @@ image: master: enabled: true - repository: null - imageName: null - imageTag: null imageOverride: null restartPolicy: null replicas: 1 @@ -256,9 +253,6 @@ master: volume: enabled: true - repository: null - imageName: null - imageTag: null imageOverride: null restartPolicy: null port: 8080 @@ -473,9 +467,6 @@ volume: filer: enabled: true - repository: null - imageName: null - imageTag: null imageOverride: null restartPolicy: null replicas: 1 @@ -740,9 +731,7 @@ filer: s3: enabled: false - repository: null - imageName: null - imageTag: null + imageOverride: null restartPolicy: null replicas: 1 bindAddress: 0.0.0.0