From d6f8602a86a51a4f60fd193a94e84797225d464b Mon Sep 17 00:00:00 2001 From: jerryzhuang Date: Fri, 6 Dec 2024 13:01:50 +1100 Subject: [PATCH] fix: chart tpl when rendering feature gate flag (#760) k=v pair should be joint by comma. --------- Signed-off-by: jerryzhuang --- charts/kaito/workspace/README.md | 2 +- charts/kaito/workspace/templates/_helpers.tpl | 11 +++++++++++ charts/kaito/workspace/templates/deployment.yaml | 2 +- goreleaser.yml | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/charts/kaito/workspace/README.md b/charts/kaito/workspace/README.md index 4b86ddf70..3983421a5 100644 --- a/charts/kaito/workspace/README.md +++ b/charts/kaito/workspace/README.md @@ -7,7 +7,7 @@ export REGISTRY=mcr.microsoft.com/aks/kaito export IMG_NAME=workspace export IMG_TAG=0.4.0 helm install workspace ./charts/kaito/workspace \ ---set image.repository=${REGISTRY}/$(IMG_NAME) --set image.tag=$(IMG_TAG) \ +--set image.repository=${REGISTRY}/${IMG_NAME} --set image.tag=${IMG_TAG} \ --namespace kaito-workspace --create-namespace ``` diff --git a/charts/kaito/workspace/templates/_helpers.tpl b/charts/kaito/workspace/templates/_helpers.tpl index 86d30a8ef..b1d92afba 100644 --- a/charts/kaito/workspace/templates/_helpers.tpl +++ b/charts/kaito/workspace/templates/_helpers.tpl @@ -50,3 +50,14 @@ Selector labels app.kubernetes.io/name: {{ include "kaito.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} + +{{/* +Utils function +*/}} +{{- define "utils.joinKeyValuePairs" -}} +{{- $pairs := list -}} +{{- range $key, $value := . -}} +{{- $pairs = append $pairs (printf "%s=%s" $key $value) -}} +{{- end -}} +{{- join "," $pairs -}} +{{- end -}} diff --git a/charts/kaito/workspace/templates/deployment.yaml b/charts/kaito/workspace/templates/deployment.yaml index 92989f6a9..4c39375c8 100644 --- a/charts/kaito/workspace/templates/deployment.yaml +++ b/charts/kaito/workspace/templates/deployment.yaml @@ -33,7 +33,7 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} args: - - --feature-gates={{- range $k, $v := .Values.featureGates }}{{ $k }}={{ $v}}{{- end }} + - --feature-gates={{ include "utils.joinKeyValuePairs" .Values.featureGates }} env: - name: WEBHOOK_SERVICE value: {{ include "kaito.fullname" . }} diff --git a/goreleaser.yml b/goreleaser.yml index 67d5ebdfc..7bea566b1 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -5,7 +5,7 @@ before: - go mod tidy builds: - id: kaito - main: ./cmd + main: ./cmd/workspace/ binary: bin/kaito goos: - linux