From 13f2606c9b33675d6368218141533b5673117d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Fern=C3=A1ndez?= Date: Wed, 11 Oct 2023 23:48:58 -0500 Subject: [PATCH] fix: subdomain (#197) --- internal/services/services.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/services/services.go b/internal/services/services.go index 1cf493a6..382b1903 100644 --- a/internal/services/services.go +++ b/internal/services/services.go @@ -85,6 +85,13 @@ func CreateService(cl *pkgtypes.Cluster, serviceName string, appDef *types.Gitop kcfg = k8s.CreateKubeConfig(inCluster, fmt.Sprintf("%s/kubeconfig", tmpGitopsDir)) + var fullDomainName string + if cl.SubdomainName != "" { + fullDomainName = fmt.Sprintf("%s.%s", cl.SubdomainName, cl.DomainName) + } else { + fullDomainName = cl.DomainName + } + // If there are secret values, create a vault secret if len(req.SecretKeys) > 0 { log.Infof("cluster %s - application %s has secrets, creating vault values", cl.ClusterName, appDef.Name) @@ -102,7 +109,7 @@ func CreateService(cl *pkgtypes.Cluster, serviceName string, appDef *types.Gitop } vaultClient, err := vaultapi.NewClient(&vaultapi.Config{ - Address: fmt.Sprintf("https://vault.%s", cl.DomainName), + Address: fmt.Sprintf("https://vault.%s", fullDomainName), }) if err != nil { return fmt.Errorf("cluster %s - error initializing vault client: %s", cl.ClusterName, err) @@ -188,7 +195,7 @@ func CreateService(cl *pkgtypes.Cluster, serviceName string, appDef *types.Gitop } // Sync registry - argoCDHost := fmt.Sprintf("https://argocd.%s", cl.DomainName) + argoCDHost := fmt.Sprintf("https://argocd.%s", fullDomainName) if cl.CloudProvider == "k3d" { argoCDHost = "http://argocd-server.argocd.svc.cluster.local" }