-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathingress.yaml
67 lines (67 loc) · 2.27 KB
/
ingress.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{{- if .Values.ingress.enabled -}}
{{- $svcPort := .Values.service.port -}}
{{- range .Values.users }}
{{ $user := . }}
{{ $data := dict "values" $.Values "release" $.Release "chart" $.Chart "user" $user }}
{{- $fullName := include "code-server.fullname" $data -}}
{{- 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 }}
namespace: {{ $.Release.Namespace }}
{{- with $.Values.ingress.annotations }}
annotations:
{{- 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 }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range $.Values.ingress.hosts }}
- host: "code-{{ $user }}-bonfim.devscope.net"
http:
paths:
{{- range .paths }}
{{ $pathType := .pathType }}
{{ $path := printf "%s" .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:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}