From c69ead020a6950bd58a9997a998799001aeb8c6f Mon Sep 17 00:00:00 2001 From: Timothy Olaleke Date: Wed, 11 Oct 2023 04:12:53 +0100 Subject: [PATCH] allow configuring port name --- templates/ingress.yaml | 10 +++++++--- values.yaml | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/templates/ingress.yaml b/templates/ingress.yaml index e95c27e..9090334 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -1,6 +1,7 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "microservice.fullname" . -}} {{- $svcPort := .Values.service.ports -}} +{{- $servicePortName := .Values.ingress.servicePortName -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} @@ -49,15 +50,18 @@ spec: backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: - name: {{ .pathServiceName | default $fullName }} {{- range $key, $value := $svcPort }} + name: {{ $fullName }} port: number: {{ .port }} + {{- if $servicePortName }} + name: {{ $servicePortName}} + {{- end }} {{- else }} - serviceName: {{ .pathServiceName | default $fullName }} + serviceName: {{ $fullName }} servicePort: {{ .port }} {{- end }} {{- end }} {{- end }} {{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index b60a347..cd19d60 100644 --- a/values.yaml +++ b/values.yaml @@ -98,6 +98,7 @@ service: ingress: enabled: false className: "" + servicePortName: "" annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" @@ -106,7 +107,6 @@ ingress: paths: - path: / pathType: ImplementationSpecific - pathServiceName: "" tls: [] # - secretName: chart-example-tls # hosts: