diff --git a/charts/common/templates/_helpers.tpl b/charts/common/templates/_helpers.tpl index efc1177..24ea469 100644 --- a/charts/common/templates/_helpers.tpl +++ b/charts/common/templates/_helpers.tpl @@ -6,5 +6,5 @@ Create robustName that can be used as Kubernetes resource name, and as subdomain \W – all but \w . */}} {{- define "common.robustName" -}} -{{ regexReplaceAll "[^0-9A-Za-z_\\.]+" . "-" | replace "_" "-" | lower | trunc 63 | trimSuffix "-" | trimPrefix "-" }} +{{ regexReplaceAll "\\W+" . "-" | replace "_" "-" | lower | trunc 63 | trimSuffix "-" }} {{- end }} diff --git a/charts/cron-job/charts/common-0.1.0.tgz b/charts/cron-job/charts/common-0.1.0.tgz index c9f6ba2..47fc1a7 100644 Binary files a/charts/cron-job/charts/common-0.1.0.tgz and b/charts/cron-job/charts/common-0.1.0.tgz differ diff --git a/charts/onechart/charts/common-0.1.0.tgz b/charts/onechart/charts/common-0.1.0.tgz index 9425a52..7a08785 100644 Binary files a/charts/onechart/charts/common-0.1.0.tgz and b/charts/onechart/charts/common-0.1.0.tgz differ diff --git a/charts/onechart/templates/_helpers.tpl b/charts/onechart/templates/_helpers.tpl index c0c138d..9c5df3c 100644 --- a/charts/onechart/templates/_helpers.tpl +++ b/charts/onechart/templates/_helpers.tpl @@ -68,5 +68,5 @@ Create robustName that can be used as Kubernetes resource name, and as subdomain \W – all but \w . */}} {{- define "robustName" -}} -{{ regexReplaceAll "[^0-9A-Za-z_\\.]+" . "-" | replace "_" "-" | lower | trunc 63 | trimSuffix "-" | trimPrefix "-" }} +{{ regexReplaceAll "\\W+" . "-" | replace "_" "-" | lower | trunc 63 | trimSuffix "-" }} {{- end }} diff --git a/charts/onechart/templates/ingress.yaml b/charts/onechart/templates/ingress.yaml index f7e952a..56248bd 100644 --- a/charts/onechart/templates/ingress.yaml +++ b/charts/onechart/templates/ingress.yaml @@ -29,11 +29,11 @@ spec: {{- if default false .ingress.tlsEnabled }} tls: - hosts: - - {{ template "robustName" .ingress.host | quote }} + - {{ .ingress.host | quote }} secretName: {{ printf "tls-%s" $resourceName }} {{- end }} rules: - - host: {{ template "robustName" .ingress.host | quote }} + - host: {{ .ingress.host | quote }} http: paths: - backend: diff --git a/charts/onechart/tests/ingress_domain_test.yaml b/charts/onechart/tests/ingress_domain_test.yaml index cb011b5..df420b6 100644 --- a/charts/onechart/tests/ingress_domain_test.yaml +++ b/charts/onechart/tests/ingress_domain_test.yaml @@ -23,7 +23,7 @@ tests: - backend: serviceName: release-name servicePort: 80 - - it: Should conform to DNS names + - it: Should pass ingress host name as is, user must sanitize it set: ingress: host: feature/my_branch.local @@ -33,12 +33,12 @@ tests: path: spec.tls value: - hosts: - - feature-my-branch.local + - feature/my_branch.local secretName: tls-release-name - equal: path: spec.rules value: - - host: feature-my-branch.local + - host: feature/my_branch.local http: paths: - backend: @@ -100,4 +100,4 @@ tests: value: - hosts: - chart-example.local - secretName: tls-release-name-chart-example.local + secretName: tls-release-name-chart-example-local