From 6a21d06820a38a58b837d08f6bf852fb52d0118f Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Wed, 10 Feb 2021 15:22:17 +0100 Subject: [PATCH] Add robustness in ingress domain --- charts/onechart/templates/ingress.yaml | 2 +- charts/onechart/tests/ingress_domain_test.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/onechart/templates/ingress.yaml b/charts/onechart/templates/ingress.yaml index 91b3fa2..696ee9b 100644 --- a/charts/onechart/templates/ingress.yaml +++ b/charts/onechart/templates/ingress.yaml @@ -24,7 +24,7 @@ spec: secretName: {{ printf "tls-%s" $.Release.Name }} {{- end }} rules: - - host: {{ .host | quote }} + - host: {{ .host | trunc 63 | trimSuffix "-" | replace "/" "-" | replace "_" "-" | quote }} http: paths: - backend: diff --git a/charts/onechart/tests/ingress_domain_test.yaml b/charts/onechart/tests/ingress_domain_test.yaml index ab5d564..334e40a 100644 --- a/charts/onechart/tests/ingress_domain_test.yaml +++ b/charts/onechart/tests/ingress_domain_test.yaml @@ -17,6 +17,7 @@ tests: - it: Should set Ingress annotation set: ingress: + host: chart-example.local annotations: kubernetes.io/ingress.class: nginx asserts: