diff --git a/charts/fleet/templates/_helpers.tpl b/charts/fleet/templates/_helpers.tpl index f6c41ef3fb..fd0cfffbf9 100644 --- a/charts/fleet/templates/_helpers.tpl +++ b/charts/fleet/templates/_helpers.tpl @@ -23,6 +23,11 @@ If release name contains chart name it will be used as a full name. {{- end }} {{- end }} +{{- define "fleet.servicename" -}} +{{- $fullName := include "fleet.fullname" . -}} +{{- printf "%s-service" $fullName }} +{{- end }} + {{/* Create chart name and version as used by the chart label. */}} diff --git a/charts/fleet/templates/ingress.yaml b/charts/fleet/templates/ingress.yaml index 0a7326d995..1a3e758a29 100644 --- a/charts/fleet/templates/ingress.yaml +++ b/charts/fleet/templates/ingress.yaml @@ -1,5 +1,6 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "fleet.fullname" . -}} +{{- $serviceName := include "fleet.servicename" . -}} {{- $svcPort := ternary .Values.fleet.listenPort .Values.fleet.servicePort (eq .Values.fleet.servicePort nil) -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} @@ -49,11 +50,11 @@ spec: backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ $fullName }} + name: {{ $serviceName }} port: number: {{ $svcPort }} {{- else }} - serviceName: {{ $fullName }} + serviceName: {{ $serviceName }} servicePort: {{ $svcPort }} {{- end }} {{- end }} diff --git a/charts/fleet/templates/service.yaml b/charts/fleet/templates/service.yaml index 1a22e48fc0..fa1c13a94d 100644 --- a/charts/fleet/templates/service.yaml +++ b/charts/fleet/templates/service.yaml @@ -1,3 +1,4 @@ +{{- $serviceName := include "fleet.servicename" . -}} apiVersion: v1 kind: Service metadata: @@ -6,7 +7,7 @@ metadata: chart: fleet heritage: {{ .Release.Service }} release: {{ .Release.Name }} - name: fleet + name: {{ $serviceName }} namespace: {{ .Release.Namespace }} spec: {{- if .Values.gke.ingress.useGKEIngress }}