From 34387058949cb2a00e5acc8abaa41a6fa394e479 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Wed, 17 Nov 2021 19:51:42 +0000 Subject: [PATCH 1/3] Strip devurl suffixs --- templates/ingress.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/ingress.yaml b/templates/ingress.yaml index 122de63c..4cecfe23 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -433,7 +433,8 @@ spec: name: {{ include "coder.serviceName" . }} port: name: tcp-{{ include "coder.serviceName" . }} - - host: {{ merge .Values dict | dig "coderd" "devurlsHost" "" | quote }} + {{ $devURLHost := merge .Values dict | dig "coderd" "devurlsHost" "" }} + - host: {{ regexReplaceAll "\\*[^.]*(\\..*)" $devURLHost "*${1}" | quote }} http: paths: - path: / From 86deff974b3432967af49a37ab6f53e639a81338 Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Wed, 17 Nov 2021 20:02:43 +0000 Subject: [PATCH 2/3] Add docs to regex --- templates/ingress.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/templates/ingress.yaml b/templates/ingress.yaml index 4cecfe23..b632ac91 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -434,6 +434,13 @@ spec: port: name: tcp-{{ include "coder.serviceName" . }} {{ $devURLHost := merge .Values dict | dig "coderd" "devurlsHost" "" }} + # Regex docs on '*-suffix.example.com' + # - '\\*' Starts with '*' + # - '[^.]*' Suffix is 0 or more characters, '-suffix' + # - '(' Start domain capture grp + # - '\\.' The domain should be separated with a '.' from the subdomain + # - '.*' Rest of the domain. + # - ')' $1 is the ''.example.com' - host: {{ regexReplaceAll "\\*[^.]*(\\..*)" $devURLHost "*${1}" | quote }} http: paths: From 9d7fa103105facbf5bb662fbf4aa9d48fceafa2a Mon Sep 17 00:00:00 2001 From: Steven Masley Date: Thu, 18 Nov 2021 18:36:12 +0000 Subject: [PATCH 3/3] Add some comments --- templates/ingress.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/ingress.yaml b/templates/ingress.yaml index b632ac91..d1dddcbb 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -434,7 +434,8 @@ spec: port: name: tcp-{{ include "coder.serviceName" . }} {{ $devURLHost := merge .Values dict | dig "coderd" "devurlsHost" "" }} - # Regex docs on '*-suffix.example.com' + # 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 suffic, and keep the wildcard '*'. # - '\\*' Starts with '*' # - '[^.]*' Suffix is 0 or more characters, '-suffix' # - '(' Start domain capture grp