mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: allow suffix after wildcard in wildcard access URL (#4524)
This commit is contained in:
+1
-1
@@ -14,5 +14,5 @@ lint: lint/helm
|
||||
.PHONY: lint
|
||||
|
||||
lint/helm:
|
||||
helm lint --strict .
|
||||
helm lint --strict --set coder.image.tag=v0.0.1 .
|
||||
.PHONY: lint/helm
|
||||
|
||||
@@ -138,6 +138,24 @@ Coder TLS environment variables.
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Coder ingress wildcard hostname with the wildcard suffix stripped.
|
||||
*/}}
|
||||
{{- define "coder.ingressWildcardHost" -}}
|
||||
{{/* This regex replace 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'
|
||||
*/}}
|
||||
{{- regexReplaceAll "\\*[^.]*(\\..*)" .Values.coder.ingress.wildcardHost "*${1}" -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Fail on fully deprecated values or deprecated value combinations. This is
|
||||
included at the top of coder.yaml.
|
||||
|
||||
@@ -26,8 +26,9 @@ spec:
|
||||
name: coder
|
||||
port:
|
||||
name: {{ include "coder.portName" . | quote }}
|
||||
|
||||
{{- if .Values.coder.ingress.wildcardHost }}
|
||||
- host: {{ .Values.coder.ingress.wildcardHost | quote }}
|
||||
- host: {{ include "coder.ingressWildcardHost" . | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
@@ -46,7 +47,7 @@ spec:
|
||||
secretName: {{ .Values.coder.ingress.tls.secretName | quote}}
|
||||
{{- if .Values.coder.ingress.tls.wildcardSecretName }}
|
||||
- hosts:
|
||||
- {{ .Values.coder.ingress.wildcardHost | quote }}
|
||||
- {{ include "coder.ingressWildcardHost" . | quote }}
|
||||
secretName: {{ .Values.coder.ingress.tls.wildcardSecretName | quote}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
+4
-2
@@ -101,8 +101,10 @@ coder:
|
||||
# coder.ingress.host -- The hostname to match on.
|
||||
host: ""
|
||||
# coder.ingress.wildcardHost -- The wildcard hostname to match on. Should be
|
||||
# in the form "*.example.com". Optional if not using applications over
|
||||
# subdomains.
|
||||
# in the form "*.example.com" or "*-suffix.example.com". If you are using a
|
||||
# suffix after the wildcard, the suffix will be stripped from the created
|
||||
# ingress to ensure that it is a legal ingress host. Optional if not using
|
||||
# applications over subdomains.
|
||||
wildcardHost: ""
|
||||
# coder.ingress.annotations -- The ingress annotations.
|
||||
annotations: {}
|
||||
|
||||
Reference in New Issue
Block a user