Skip to content

Commit

Permalink
allow configuring port name
Browse files Browse the repository at this point in the history
  • Loading branch information
Timtech4u committed Oct 11, 2023
1 parent 1ce8151 commit c69ead0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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}}
Expand Down Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ service:
ingress:
enabled: false
className: ""
servicePortName: ""
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
Expand All @@ -106,7 +107,6 @@ ingress:
paths:
- path: /
pathType: ImplementationSpecific
pathServiceName: ""
tls: []
# - secretName: chart-example-tls
# hosts:
Expand Down

0 comments on commit c69ead0

Please sign in to comment.