Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 480eca8

Browse files
committed
made apiVersion depended on the k8s version
1 parent 1080bc2 commit 480eca8

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

deploy/charts/kube-oidc-proxy/templates/ingress.yaml

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $fullName := include "kube-oidc-proxy.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
5+
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
6+
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
7+
{{- end }}
8+
{{- end }}
9+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
10+
apiVersion: networking.k8s.io/v1
11+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
12+
apiVersion: networking.k8s.io/v1beta1
13+
{{- else -}}
314
apiVersion: extensions/v1beta1
15+
{{- end }}
416
kind: Ingress
517
metadata:
618
name: {{ $fullName }}
@@ -11,6 +23,9 @@ metadata:
1123
{{- toYaml . | nindent 4 }}
1224
{{- end }}
1325
spec:
26+
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingress.className }}
28+
{{- end }}
1429
{{- if .Values.ingress.tls }}
1530
tls:
1631
{{- range .Values.ingress.tls }}
@@ -27,10 +42,20 @@ spec:
2742
http:
2843
paths:
2944
{{- range .paths }}
30-
- path: {{ . }}
45+
- path: {{ .path }}
46+
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
47+
pathType: {{ .pathType }}
48+
{{- end }}
3149
backend:
50+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
51+
service:
52+
name: {{ $fullName }}
53+
port:
54+
name: https
55+
{{- else }}
3256
serviceName: {{ $fullName }}
3357
servicePort: https
58+
{{- end }}
3459
{{- end }}
3560
{{- end }}
3661
{{- end }}

deploy/charts/kube-oidc-proxy/values.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ ingress:
8484
# kubernetes.io/tls-acme: "true"
8585
hosts:
8686
- host: chart-example.local
87-
paths: []
87+
paths:
88+
- path: /
89+
pathType: Prefix
8890

8991
tls: []
9092
# - secretName: chart-example-tls

0 commit comments

Comments
 (0)