Skip to content

Commit

Permalink
k8s: bump Ingress apiVersion to v1 if capability exist (k8s 1.19+)
Browse files Browse the repository at this point in the history
  • Loading branch information
consideRatio committed Jan 14, 2021
1 parent b8622ef commit e01292c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions jupyterhub/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{- if .Values.ingress.enabled -}}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else }}
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1beta1
{{- end }}
kind: Ingress
metadata:
Expand All @@ -22,9 +22,18 @@ spec:
http:
paths:
- path: {{ $.Values.hub.baseUrl }}{{ $.Values.ingress.pathSuffix }}
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
pathType: Prefix
backend:
service:
name: proxy-public
port:
name: http
{{- else }}
backend:
serviceName: proxy-public
servicePort: 80
{{- end }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
Expand Down

0 comments on commit e01292c

Please sign in to comment.