From 10c3178d5461c5001c4cd581759b9030e52bd295 Mon Sep 17 00:00:00 2001 From: Dev Jadeja Date: Tue, 18 Mar 2025 19:25:44 +0530 Subject: [PATCH] added default value used when staticServiceName is absent --- charts/py-app/templates/_helpers.tpl | 7 +++++++ charts/py-app/templates/static-service.yaml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/charts/py-app/templates/_helpers.tpl b/charts/py-app/templates/_helpers.tpl index 3857c41..34ee528 100644 --- a/charts/py-app/templates/_helpers.tpl +++ b/charts/py-app/templates/_helpers.tpl @@ -83,3 +83,10 @@ envFrom: {{- end }} {{- end }} {{ end -}} + +{{/* +Create staticServiceName, same for all environments +*/}} +{{- define "py-app.staticServiceName" -}} +{{- .Values.service.staticServiceName | default (printf "%s-%s" .Values.nameOverride "static-svc") }} +{{- end }} diff --git a/charts/py-app/templates/static-service.yaml b/charts/py-app/templates/static-service.yaml index b2c6155..d3dddbd 100644 --- a/charts/py-app/templates/static-service.yaml +++ b/charts/py-app/templates/static-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Values.service.staticServiceName }} + name: {{ include "py-app.staticServiceName" . }} labels: {{- include "py-app.labels" . | nindent 4 }} spec: