Fix url in generated kubeconfig file

This commit is contained in:
Thomas Ferrandiz
2025-10-22 12:48:27 +00:00
parent 369722ba7f
commit 7489eea315

View File

@@ -21,6 +21,7 @@ import (
b64 "encoding/base64"
"encoding/json"
"fmt"
"net"
"os"
"path/filepath"
"strings"
@@ -225,7 +226,7 @@ func (o *Options) createKubeConfig(prevCAHash, prevSATokenHash []byte) ([]byte,
return nil, nil, fmt.Errorf("template parse error: %v", err)
}
templateData := map[string]string{
"KubeConfigHost": fmt.Sprintf("%s://[%s]:%s", kubeProtocol, kubeHost, kubePort),
"KubeConfigHost": fmt.Sprintf("%s://%s", kubeProtocol, net.JoinHostPort(kubeHost, kubePort)),
"KubeServerTLS": tlsConfig,
"KubeServiceAccountToken": string(saTokenByte),
}