From 8f0418719995acb6e8baacf26dec9c83d9ebf817 Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Tue, 14 Nov 2023 15:24:43 +0100
Subject: [PATCH] clean the hostname also in NOTES.txt

---
 shiny-server/Chart.yaml             | 2 +-
 shiny-server/templates/NOTES.txt    | 2 +-
 shiny-server/templates/_helpers.tpl | 4 ++++
 shiny-server/templates/ingress.yaml | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/shiny-server/Chart.yaml b/shiny-server/Chart.yaml
index 51c05cd..b5a3deb 100644
--- a/shiny-server/Chart.yaml
+++ b/shiny-server/Chart.yaml
@@ -15,7 +15,7 @@ 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.6.0
+version: 0.6.1
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application. Versions are not expected to
diff --git a/shiny-server/templates/NOTES.txt b/shiny-server/templates/NOTES.txt
index 486150d..468b45c 100644
--- a/shiny-server/templates/NOTES.txt
+++ b/shiny-server/templates/NOTES.txt
@@ -1,6 +1,6 @@
 The application will be up shortly at:
 
-https://{{ .Values.ingress.hostname }}
+https://{{ include "chart.hostnameCleaned" . }}
 
 Settings:
 - Image used: {{ .Values.imageFullNameAndTag }}
diff --git a/shiny-server/templates/_helpers.tpl b/shiny-server/templates/_helpers.tpl
index b4c3802..3413fdd 100644
--- a/shiny-server/templates/_helpers.tpl
+++ b/shiny-server/templates/_helpers.tpl
@@ -49,3 +49,7 @@ Selector labels
 app.kubernetes.io/name: {{ include "chart.name" . }}
 app.kubernetes.io/instance: {{ .Release.Name }}
 {{- end }}
+
+{{- define "chart.hostnameCleaned" -}}
+{{- .Values.ingress.hostname | replace "_" "-" | replace "--" "-" | quote }}
+{{- end }}
\ No newline at end of file
diff --git a/shiny-server/templates/ingress.yaml b/shiny-server/templates/ingress.yaml
index 2ec83c9..d1391c2 100644
--- a/shiny-server/templates/ingress.yaml
+++ b/shiny-server/templates/ingress.yaml
@@ -8,7 +8,7 @@ metadata:
 spec:
   ingressClassName:  {{ .Values.ingress.className | quote }}
   rules:
-  - host: {{ .Values.ingress.hostname | replace "_" "-" | replace "--" "-" | quote }}
+  - host: {{ include "chart.hostnameCleaned" . }}
     http:
       paths:
       - path: /
-- 
GitLab