From a19df144bbd5a633aa1ed33853d7345a917ff067 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Sat, 23 Dec 2023 22:27:41 +0100 Subject: [PATCH] fix(homepage): use servicename, port and svc suffix, via targetselector, to connect to chart --- .../templates/lib/ingress/integrations/_homepage.tpl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/common/templates/lib/ingress/integrations/_homepage.tpl b/library/common/templates/lib/ingress/integrations/_homepage.tpl index 1cac834d..0eb3b2c6 100644 --- a/library/common/templates/lib/ingress/integrations/_homepage.tpl +++ b/library/common/templates/lib/ingress/integrations/_homepage.tpl @@ -9,6 +9,7 @@ {{- end -}} {{- include "tc.v1.common.lib.ingress.integration.homepage.validation" (dict "objectData" $objectData) -}} + {{- $svcData := (include "tc.v1.common.lib.ingress.targetSelector" (dict "rootCtx" $rootCtx "objectData" $objectData) | fromYaml) -}} {{- $name := $homepage.name | default ($rootCtx.Chart.Name | camelcase) -}} {{- $desc := $homepage.description | default $rootCtx.Chart.Description -}} @@ -23,7 +24,14 @@ {{- $host := tpl $fHost.host $rootCtx -}} {{- $path := tpl $fPath.path $rootCtx -}} - {{- $href = printf "https://%s/%s/" $host ($path | trimPrefix "/") -}} + {{- $href = printf "https://%s/%s" $host ($path | trimPrefix "/") -}} + {{- end -}} + + {{- if not $url -}} + {{- $svc := $svcData.name -}} + {{- $port := $svcData.port -}} + + {{- $url = printf "http://%s.svc:%s" $svc $port -}} {{- end -}} {{- $_ := set $objectData.annotations "gethomepage.dev/enabled" "true" -}}