Skip to content

Commit acd0ba9

Browse files
committed
fix(helm): fix http ingress
1 parent 85ddaad commit acd0ba9

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed
Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
{{- if .Values.ingress.http.enabled -}}
22
{{- $fullName := include "app.fullname" . -}}
3+
{{- $svcName := $fullName -}}
34
{{- $svcPort := .Values.service.port.http -}}
4-
{{- if and .Values.ingress.http.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5-
{{- if not (hasKey .Values.ingress.http.annotations "kubernetes.io/ingress.class") }}
6-
{{- $_ := set .Values.ingress.http.annotations "kubernetes.io/ingress.class" .Values.ingress.http.className}}
7-
{{- end }}
8-
{{- end }}
5+
{{- $ingressPath := .Values.ingress.http.path -}}
6+
{{- $ingressPathType := .Values.ingress.http.pathType -}}
97
apiVersion: networking.k8s.io/v1
108
kind: Ingress
119
metadata:
@@ -20,31 +18,22 @@ spec:
2018
{{- if .Values.ingress.http.className }}
2119
ingressClassName: {{ .Values.ingress.http.className }}
2220
{{- end }}
23-
{{- if .Values.ingress.http.tls }}
24-
tls:
25-
{{- range .Values.ingress.http.tls }}
26-
- hosts:
27-
{{- range .hosts }}
28-
- {{ . | quote }}
29-
{{- end }}
30-
secretName: {{ .secretName }}
31-
{{- end }}
32-
{{- end }}
3321
rules:
34-
{{- range .Values.ingress.http.hosts }}
35-
- host: {{ .host | quote }}
22+
{{- range $host := .Values.ingress.http.hosts }}
23+
- host: {{ $host | quote }}
3624
http:
3725
paths:
38-
{{- range .paths }}
39-
- path: {{ .path }}
40-
{{- if .pathType }}
41-
pathType: {{ .pathType }}
42-
{{- end }}
26+
- path: {{ $ingressPath }}
27+
pathType: {{ $ingressPathType }}
4328
backend:
4429
service:
45-
name: {{ $fullName }}
30+
name: {{ $svcName }}
4631
port:
4732
number: {{ $svcPort }}
48-
{{- end }}
4933
{{- end }}
34+
35+
{{- if .Values.ingress.http.tls }}
36+
tls:
37+
{{ toYaml .Values.ingress.http.tls | indent 4 }}
38+
{{- end }}
5039
{{- end }}

helm/src/main/helm/values.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ ingress:
4343
annotations:
4444
kubernetes.io/ingress.class: nginx
4545

46+
path: /
47+
pathType: Prefix
4648
hosts:
4749
- host: chart-example.local
48-
paths:
49-
- path: /
50-
pathType: Prefix
5150
tls: []
5251

5352
resources: {}

0 commit comments

Comments
 (0)