From 5d5a0cf34bff47b670ae4942a5601d9ca26b607f Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Tue, 7 Mar 2023 19:09:35 +0200 Subject: [PATCH] split port from host if it exists Signed-off-by: Noam Gal --- cmd/commands/repo.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/commands/repo.go b/cmd/commands/repo.go index 90848650..1de1a4f5 100644 --- a/cmd/commands/repo.go +++ b/cmd/commands/repo.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "net" "net/url" "os" "path" @@ -728,13 +729,21 @@ func createBootstrapKustomization(namespace, appSpecifier string, cloneOpts *git return nil, err } + host := u.Host + if strings.Contains(host, ":") { + host, _, err = net.SplitHostPort(host) + if err != nil { + return nil, err + } + } + k.ConfigMapGenerator = append(k.ConfigMapGenerator, kusttypes.ConfigMapArgs{ GeneratorArgs: kusttypes.GeneratorArgs{ Name: "argocd-tls-certs-cm", Behavior: kusttypes.BehaviorMerge.String(), KvPairSources: kusttypes.KvPairSources{ LiteralSources: []string{ - u.Host + "=" + string(cert), + host + "=" + string(cert), }, }, },