From 85319fd8d98966bac613b484b85db4b0fbfb4ffa Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Wed, 30 Jun 2021 15:31:48 +0200 Subject: [PATCH] patch common ingress service name bug (#625) --- charts/library/common/Chart.yaml | 2 +- charts/library/common/templates/_service.tpl | 2 +- .../common/templates/classes/_ingress.tpl | 21 ++++++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 01d13456368..15c8c6edb27 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -18,4 +18,4 @@ maintainers: name: common sources: type: library -version: 6.4.0 +version: 6.4.1 diff --git a/charts/library/common/templates/_service.tpl b/charts/library/common/templates/_service.tpl index 07e2a2a2b0a..35811938bf3 100644 --- a/charts/library/common/templates/_service.tpl +++ b/charts/library/common/templates/_service.tpl @@ -19,7 +19,7 @@ Renders the Service objects required by the chart. {{- end }} {{/* -Return the name of the primary service object +Return the primary service object */}} {{- define "common.service.primary" -}} {{- $enabledServices := dict -}} diff --git a/charts/library/common/templates/classes/_ingress.tpl b/charts/library/common/templates/classes/_ingress.tpl index 00dda2c7377..743894b1ebb 100644 --- a/charts/library/common/templates/classes/_ingress.tpl +++ b/charts/library/common/templates/classes/_ingress.tpl @@ -3,7 +3,8 @@ This template serves as a blueprint for all Ingress objects that are created within the common library. */}} {{- define "common.classes.ingress" -}} - {{- $ingressName := include "common.names.fullname" . -}} + {{- $fullName := include "common.names.fullname" . -}} + {{- $ingressName := $fullName -}} {{- $values := .Values.ingress -}} {{- if hasKey . "ObjectValues" -}} @@ -16,9 +17,13 @@ within the common library. {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} {{- end -}} - {{- $primaryService := get .Values.service (include "common.service.primary" .) }} - {{- $primaryPort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} - {{- $name := include "common.names.name" . -}} + {{- $primaryService := get .Values.service (include "common.service.primary" .) -}} + {{- $defaultServiceName := $fullName -}} + {{- if and (hasKey $primaryService "nameOverride") $primaryService.nameOverride -}} + {{- $defaultServiceName = printf "%v-%v" $defaultServiceName $primaryService.nameOverride -}} + {{- end -}} + {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} + {{- $isStable := include "common.capabilities.ingress.isStable" . }} {{- $fixedMiddlewares := "" }} @@ -79,11 +84,11 @@ spec: http: paths: {{- range .paths }} - {{- $service := $name -}} - {{- $port := $primaryPort.port -}} + {{- $service := $defaultServiceName -}} + {{- $port := $defaultServicePort.port -}} {{- if .service -}} - {{- $service = default $name .service.name -}} - {{- $port = default $primaryPort.port .service.port -}} + {{- $service = default $service .service.name -}} + {{- $port = default $port .service.port -}} {{- end }} - path: {{ tpl .path $ | quote }} {{- if $isStable }}