Skip to content

Commit 6877f50

Browse files
committed
Adds k8s 1.22 support for Ingress
1 parent 61cc4be commit 6877f50

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

templates/ingress.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{{- if .Values.ingress.enabled }}
22
---
3+
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
4+
apiVersion: networking.k8s.io/v1
5+
{{- else }}
36
apiVersion: networking.k8s.io/v1beta1
7+
{{- end }}
48
kind: Ingress
59
metadata:
610
name: {{ .Release.Name }}-st2web-ingress
@@ -26,9 +30,18 @@ spec:
2630
paths:
2731
{{- range .paths }}
2832
- path: {{ default "/*" .path }}
33+
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
34+
pathType: Prefix
35+
backend:
36+
service:
37+
name: {{ .serviceName }}
38+
port:
39+
number: {{ .servicePort }}
40+
{{- else }}
2941
backend:
3042
serviceName: {{ .serviceName }}
3143
servicePort: {{ .servicePort }}
44+
{{- end }}
3245
{{- end }}
3346
{{- else }}
3447
{{- if required "Missing context '.Values.st2web.service.hostname'!" .Values.st2web.service.hostname }}
@@ -37,9 +50,18 @@ spec:
3750
http:
3851
paths:
3952
- path: "/"
53+
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
54+
pathType: Prefix
55+
backend:
56+
service:
57+
name: {{ .Release.Name }}-st2web
58+
port:
59+
number: 80
60+
{{- else }}
4061
backend:
4162
serviceName: {{ .Release.Name }}-st2web
4263
servicePort: 80
64+
{{- end }}
4365
{{- end }}
4466
{{- if .Values.ingress.tls }}
4567
tls:

0 commit comments

Comments
 (0)