-
Notifications
You must be signed in to change notification settings - Fork 15
/
ingress.yaml
67 lines (66 loc) · 2.42 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.enable }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: coderd-ingress
namespace: {{ .Release.Namespace | quote }}
labels:
app.kubernetes.io/name: {{ .Chart.Name }}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: {{ include "coder.serviceName" . }}
annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }}
spec:
{{- if .Values.ingress.className }}
{{/* If this is set to an empty string it fails validation on K8s */}}
ingressClassName: {{ .Values.ingress.className | quote }}
{{- end }}
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "coder.serviceName" . }}
port:
name: tcp-{{ include "coder.serviceName" . }}
{{/* Regex docs on '*-suffix.example.com'. This is required as the original
* input including the suffix is not a legal ingress host. We need to
* remove the suffix, and keep the wildcard '*'.
*
* - '\\*' Starts with '*'
* - '[^.]*' Suffix is 0 or more characters, '-suffix'
* - '(' Start domain capture group
* - '\\.' The domain should be separated with a '.' from the subdomain
* - '.*' Rest of the domain.
* - ')' $1 is the ''.example.com'
*/}}
- host: {{ regexReplaceAll "\\*[^.]*(\\..*)" .Values.coderd.devurlsHost "*${1}" | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "coder.serviceName" . }}
port:
name: tcp-{{ include "coder.serviceName" . }}
{{- if .Values.ingress.tls.enable }}
tls:
{{- if and .Values.ingress.host .Values.coderd.tls.hostSecretName }}
- hosts:
- {{ .Values.ingress.host | quote }}
secretName: {{ .Values.coderd.tls.hostSecretName | quote}}
{{- end }}
{{- if and .Values.coderd.devurlsHost .Values.coderd.tls.devurlsHostSecretName }}
- hosts:
- {{ .Values.coderd.devurlsHost | quote }}
secretName: {{ .Values.coderd.tls.devurlsHostSecretName | quote }}
{{- end }}
{{- end }}
{{- end }}