Robust names truncated to k8s DNS length

This commit is contained in:
Laszlo Fogas
2021-02-24 14:49:52 +01:00
parent 7297798622
commit 1f43e1b478
7 changed files with 50 additions and 40 deletions
+1 -1
View File
@@ -15,4 +15,4 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.15.1
version: 0.15.2
+1 -1
View File
@@ -68,5 +68,5 @@ Create robustName that can be used as Kubernetes resource name, and as subdomain
\W all but \w .
*/}}
{{- define "robustName" -}}
{{ regexReplaceAll "\\W+" . "-" | replace "_" "-" | lower }}
{{ regexReplaceAll "\\W+" . "-" | replace "_" "-" | lower | trunc 63 | trimSuffix "-" }}
{{- end }}
+1 -1
View File
@@ -24,7 +24,7 @@ spec:
secretName: {{ printf "tls-%s" $.Release.Name }}
{{- end }}
rules:
- host: {{ .host | trunc 63 | trimSuffix "-" | replace "/" "-" | replace "_" "-" | quote }}
- host: {{ template "robustName" .host | quote }}
http:
paths:
- backend: