From 8349a1c750836da7acfd86bdccfbc38a8c0f64d3 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Sat, 10 Apr 2021 15:07:21 +0200 Subject: [PATCH] Add url option to portal configmap (#315) * Add url option to portal configmap It makes it easier to consume the portal url in other places, without all sorts of translation scripting * add portal-url test --- .tools/tests/charts/common-test_spec.rb | 2 ++ library/common/Chart.yaml | 2 +- library/common/templates/lib/resources/_portal_config.tpl | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.tools/tests/charts/common-test_spec.rb b/.tools/tests/charts/common-test_spec.rb index 69fca84b7f2..e0ae5e8f7e7 100644 --- a/.tools/tests/charts/common-test_spec.rb +++ b/.tools/tests/charts/common-test_spec.rb @@ -323,6 +323,7 @@ class Test < ChartTest defaultProtocol = "https" defaultHost = "$node_ip" defaultPort = "443" + defaulturl = "https://$node_ip:443" testNodePort = "666" testIngressPort = "888" it 'No portal (=configmap) is created by default' do @@ -340,6 +341,7 @@ class Test < ChartTest jq('.data.protocol', resource('ConfigMap')).must_equal defaultProtocol jq('.data.host', resource('ConfigMap')).must_equal defaultHost jq('.data.port', resource('ConfigMap')).must_equal defaultPort + jq('.data.url', resource('ConfigMap')).must_equal defaulturl end it 'portal port can be based on NodePort' do diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 41207e928c9..62f09101076 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 kubeVersion: ">=1.16.0-0" name: common -version: 2.0.2 +version: 2.0.3 # upstream_version: appVersion: none description: Function library for TrueCharts diff --git a/library/common/templates/lib/resources/_portal_config.tpl b/library/common/templates/lib/resources/_portal_config.tpl index 05006b9acdf..d92961a0f87 100644 --- a/library/common/templates/lib/resources/_portal_config.tpl +++ b/library/common/templates/lib/resources/_portal_config.tpl @@ -57,6 +57,7 @@ data: protocol: {{ $protocol }} host: {{ $host }} port: {{ $port | quote }} + url: {{ printf "%v%v%v%v%v" $protocol "://" $host ":" $port }} {{- end }} {{- end }}