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

Commit

Permalink
made apiVersion depended on the k8s version
Browse files Browse the repository at this point in the history
Signed-off-by: Ildar Valiullin <[email protected]>
  • Loading branch information
preved911 committed Mar 16, 2023
1 parent 1080bc2 commit 1e06dc6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
27 changes: 26 additions & 1 deletion deploy/charts/kube-oidc-proxy/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "kube-oidc-proxy.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- 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}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -11,6 +23,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
Expand All @@ -27,10 +42,20 @@ spec:
http:
paths:
{{- range .paths }}
- path: {{ . }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
name: https
{{- else }}
serviceName: {{ $fullName }}
servicePort: https
{{- end }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion deploy/charts/kube-oidc-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ ingress:
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
paths:
- path: /
pathType: Prefix

tls: []
# - secretName: chart-example-tls
Expand Down

0 comments on commit 1e06dc6

Please sign in to comment.