Skip to content

Commit

Permalink
Update the helm chart to use the stable ingress apis if supported
Browse files Browse the repository at this point in the history
  • Loading branch information
halkeye committed Jan 3, 2022
1 parent 3a4a15f commit 1026af7
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion deploy/helm/wg-access-server/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "wg-access-server.fullname" . -}}
{{- if semverCompare ">=1.19-0" $kubeTargetVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" $kubeTargetVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: {{ .Values.controller.ingress.apiVersion }}
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand All @@ -11,6 +18,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
Expand All @@ -28,7 +38,15 @@ spec:
paths:
- path: /
backend:
{{- if semverCompare ">=1.19-0" $kubeTargetVersion }}
service:
name: {{ $fullName }}-web
port:
number: 80
pathType: Prefix
{{- else -}}
serviceName: {{ $fullName }}-web
servicePort: 80
servicePort: http
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 1026af7

Please sign in to comment.