Skip to content

Commit ffce697

Browse files
authored
feat: Strip devurl suffixs from input for host (#173)
- This allows devurls suffixs to be added
1 parent 1f3b16a commit ffce697

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

templates/ingress.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,16 @@ spec:
433433
name: {{ include "coder.serviceName" . }}
434434
port:
435435
name: tcp-{{ include "coder.serviceName" . }}
436-
- host: {{ merge .Values dict | dig "coderd" "devurlsHost" "" | quote }}
436+
{{ $devURLHost := merge .Values dict | dig "coderd" "devurlsHost" "" }}
437+
# Regex docs on '*-suffix.example.com'. This is required as the original input including the suffix is
438+
# not a legal ingress host. We need to remove the suffic, and keep the wildcard '*'.
439+
# - '\\*' Starts with '*'
440+
# - '[^.]*' Suffix is 0 or more characters, '-suffix'
441+
# - '(' Start domain capture grp
442+
# - '\\.' The domain should be separated with a '.' from the subdomain
443+
# - '.*' Rest of the domain.
444+
# - ')' $1 is the ''.example.com'
445+
- host: {{ regexReplaceAll "\\*[^.]*(\\..*)" $devURLHost "*${1}" | quote }}
437446
http:
438447
paths:
439448
- path: /

0 commit comments

Comments
 (0)