|
1 |
| -{{- if not .Values.hosts.usePaths }} |
2 |
| -apiVersion: networking.k8s.io/v1 |
3 |
| -kind: Ingress |
4 |
| -metadata: |
5 |
| - name: {{ tpl (.Values.ingress.instanceName | toString) . }} |
6 |
| - namespace: {{ .Release.Namespace }} |
7 |
| - annotations: |
8 |
| - {{- if not .Values.ingress.tls }} |
9 |
| - nginx.ingress.kubernetes.io/ssl-redirect: "false" |
10 |
| - {{- end }} |
11 |
| - {{- if .Values.ingress.addTLSSecretName }} |
12 |
| - {{- if .Values.ingress.certManagerAnnotations }} |
13 |
| - cert-manager.io/cluster-issuer: {{ tpl (.Values.ingress.clusterIssuer | toString) . }} |
14 |
| - {{- if .Values.ingress.theiaCloudCommonName }} |
15 |
| - cert-manager.io/common-name: "Theia Cloud" |
16 |
| - {{- end }} |
17 |
| - acme.cert-manager.io/http01-ingress-class: nginx |
18 |
| - {{- end }} |
19 |
| - {{- end }} |
20 |
| - nginx.ingress.kubernetes.io/proxy-buffer-size: "128k" |
21 |
| - nginx.ingress.kubernetes.io/rewrite-target: /$2 |
22 |
| - nginx.ingress.kubernetes.io/configuration-snippet: | |
23 |
| - proxy_set_header 'X-Forwarded-Uri' $request_uri; |
24 |
| - nginx.ingress.kubernetes.io/proxy-body-size: {{ tpl (.Values.ingress.proxyBodySize | toString) . }} |
25 |
| -spec: |
26 |
| - ingressClassName: nginx |
27 |
| - {{- if .Values.ingress.tls }} |
28 |
| - tls: |
29 |
| - - hosts: |
30 |
| - - {{ tpl (printf "%s.%s" .Values.hosts.configuration.instance .Values.hosts.configuration.baseHost | toString) . }} |
31 |
| - {{- if .Values.ingress.addTLSSecretName }} |
32 |
| - {{- range $wildcard := .Values.hosts.allWildcardInstances }} |
33 |
| - {{- if (not (hasKey $.Values.ingress.allWildcardSecretNames $wildcard)) }} |
34 |
| - - {{ printf "%s%s.%s" (tpl . $) (tpl $.Values.hosts.configuration.instance $) (tpl $.Values.hosts.configuration.baseHost $) | quote }} |
35 |
| - {{- end }} |
36 |
| - {{- end }} |
37 |
| - secretName: ws-cert-secret |
38 |
| - {{- end }} |
39 |
| - {{- end }} |
40 |
| - |
41 |
| - {{- range $wildcard := .Values.hosts.allWildcardInstances }} |
42 |
| - {{- if hasKey $.Values.ingress.allWildcardSecretNames $wildcard }} |
43 |
| - {{- $secretName := get $.Values.ingress.allWildcardSecretNames $wildcard }} |
44 |
| - - hosts: |
45 |
| - - {{ printf "%s%s.%s" (tpl $wildcard $) (tpl $.Values.hosts.configuration.instance $) (tpl $.Values.hosts.configuration.baseHost $) | quote }} |
46 |
| - secretName: {{ tpl $secretName $ | quote }} |
47 |
| - {{- end }} |
48 |
| - {{- end }} |
49 |
| - |
50 |
| - {{- if not (lookup "networking.k8s.io/v1" "Ingress" .Release.Namespace (tpl (.Values.ingress.instanceName | toString) .) ) }} |
51 |
| - rules: |
52 |
| - - host: {{ printf "%s.%s" (tpl .Values.hosts.configuration.instance .) (tpl .Values.hosts.configuration.baseHost .) }} |
53 |
| - http: |
54 |
| - {{- range .Values.hosts.allWildcardInstances }} |
55 |
| - - host: {{ printf "%s%s.%s" (tpl . $) (tpl $.Values.hosts.configuration.instance $) (tpl $.Values.hosts.configuration.baseHost $) | quote }} |
56 |
| - http: |
57 |
| - {{- end }} |
58 |
| - {{- else }} |
59 |
| - rules: |
60 |
| - {{ range $rule := (lookup "networking.k8s.io/v1" "Ingress" .Release.Namespace (tpl (.Values.ingress.instanceName | toString) .)).spec.rules }} |
61 |
| - - host: {{ .host | quote }} |
62 |
| - {{ if .http }} |
63 |
| - http: |
64 |
| - paths: |
65 |
| - {{ with index .http.paths 0 }} |
66 |
| - - path: {{ .path }} |
67 |
| - pathType: Prefix |
68 |
| - backend: |
69 |
| - service: |
70 |
| - name: {{ .backend.service.name }} |
71 |
| - port: |
72 |
| - number: {{ .backend.service.port.number }} |
73 |
| - {{- end }} |
74 |
| - {{ end }} |
75 |
| - {{- end }} |
76 |
| - {{- end }} |
77 |
| -{{- end }} |
| 1 | +{{- if not .Values.hosts.usePaths }} |
| 2 | +apiVersion: networking.k8s.io/v1 |
| 3 | +kind: Ingress |
| 4 | +metadata: |
| 5 | + name: {{ tpl (.Values.ingress.instanceName | toString) . }} |
| 6 | + namespace: {{ .Release.Namespace }} |
| 7 | + annotations: |
| 8 | + {{- if not .Values.ingress.tls }} |
| 9 | + nginx.ingress.kubernetes.io/ssl-redirect: "false" |
| 10 | + {{- end }} |
| 11 | + {{- if .Values.ingress.addTLSSecretName }} |
| 12 | + {{- if .Values.ingress.certManagerAnnotations }} |
| 13 | + cert-manager.io/cluster-issuer: {{ tpl (.Values.ingress.clusterIssuer | toString) . }} |
| 14 | + {{- if .Values.ingress.theiaCloudCommonName }} |
| 15 | + cert-manager.io/common-name: "Theia Cloud" |
| 16 | + {{- end }} |
| 17 | + acme.cert-manager.io/http01-ingress-class: nginx |
| 18 | + {{- end }} |
| 19 | + {{- end }} |
| 20 | + nginx.ingress.kubernetes.io/proxy-buffer-size: "128k" |
| 21 | + nginx.ingress.kubernetes.io/rewrite-target: /$2 |
| 22 | + nginx.ingress.kubernetes.io/configuration-snippet: | |
| 23 | + proxy_set_header 'X-Forwarded-Uri' $request_uri; |
| 24 | + nginx.ingress.kubernetes.io/proxy-body-size: {{ tpl (.Values.ingress.proxyBodySize | toString) . }} |
| 25 | +spec: |
| 26 | + ingressClassName: nginx |
| 27 | + {{- if .Values.ingress.tls }} |
| 28 | + tls: |
| 29 | + - hosts: |
| 30 | + - {{ tpl (printf "%s.%s" .Values.hosts.configuration.instance .Values.hosts.configuration.baseHost | toString) . }} |
| 31 | + {{- if .Values.ingress.addTLSSecretName }} |
| 32 | + {{- range $wildcard := .Values.hosts.allWildcardInstances }} |
| 33 | + {{- if (not (hasKey $.Values.ingress.allWildcardSecretNames $wildcard)) }} |
| 34 | + - {{ printf "%s%s.%s" (tpl . $) (tpl $.Values.hosts.configuration.instance $) (tpl $.Values.hosts.configuration.baseHost $) | quote }} |
| 35 | + {{- end }} |
| 36 | + {{- end }} |
| 37 | + secretName: ws-cert-secret |
| 38 | + {{- end }} |
| 39 | + {{- end }} |
| 40 | + |
| 41 | + {{- range $wildcard := .Values.hosts.allWildcardInstances }} |
| 42 | + {{- if hasKey $.Values.ingress.allWildcardSecretNames $wildcard }} |
| 43 | + {{- $secretName := get $.Values.ingress.allWildcardSecretNames $wildcard }} |
| 44 | + - hosts: |
| 45 | + - {{ printf "%s%s.%s" (tpl $wildcard $) (tpl $.Values.hosts.configuration.instance $) (tpl $.Values.hosts.configuration.baseHost $) | quote }} |
| 46 | + secretName: {{ tpl $secretName $ | quote }} |
| 47 | + {{- end }} |
| 48 | + {{- end }} |
| 49 | + |
| 50 | + {{- if not (lookup "networking.k8s.io/v1" "Ingress" .Release.Namespace (tpl (.Values.ingress.instanceName | toString) .) ) }} |
| 51 | + rules: |
| 52 | + - host: {{ printf "%s.%s" (tpl .Values.hosts.configuration.instance .) (tpl .Values.hosts.configuration.baseHost .) }} |
| 53 | + http: |
| 54 | + {{- range .Values.hosts.allWildcardInstances }} |
| 55 | + - host: {{ printf "%s%s.%s" (tpl . $) (tpl $.Values.hosts.configuration.instance $) (tpl $.Values.hosts.configuration.baseHost $) | quote }} |
| 56 | + http: |
| 57 | + {{- end }} |
| 58 | + {{- else }} |
| 59 | + rules: |
| 60 | + {{ range $rule := (lookup "networking.k8s.io/v1" "Ingress" .Release.Namespace (tpl (.Values.ingress.instanceName | toString) .)).spec.rules }} |
| 61 | + - host: {{ .host | quote }} |
| 62 | + {{ if .http }} |
| 63 | + http: |
| 64 | + paths: |
| 65 | + {{ with index .http.paths 0 }} |
| 66 | + - path: {{ .path }} |
| 67 | + pathType: Prefix |
| 68 | + backend: |
| 69 | + service: |
| 70 | + name: {{ .backend.service.name }} |
| 71 | + port: |
| 72 | + number: {{ .backend.service.port.number }} |
| 73 | + {{- end }} |
| 74 | + {{ end }} |
| 75 | + {{- end }} |
| 76 | + {{- end }} |
| 77 | +{{- end }} |
0 commit comments