From 8b7f2e9ff4dafdf2b301ba65b2eee1c447fdf590 Mon Sep 17 00:00:00 2001 From: rustyclock Date: Wed, 13 Jan 2021 11:08:52 +0900 Subject: [PATCH] Fix APIEndpoint for IPv6 Signed-off-by: rustyclock --- api/v1alpha3/cluster_types.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/v1alpha3/cluster_types.go b/api/v1alpha3/cluster_types.go index 79eb71063219..7afa9d85d085 100644 --- a/api/v1alpha3/cluster_types.go +++ b/api/v1alpha3/cluster_types.go @@ -18,6 +18,7 @@ package v1alpha3 import ( "fmt" + "net" "strings" corev1 "k8s.io/api/core/v1" @@ -190,7 +191,7 @@ func (v APIEndpoint) IsValid() bool { // String returns a formatted version HOST:PORT of this APIEndpoint. func (v APIEndpoint) String() string { - return fmt.Sprintf("%s:%d", v.Host, v.Port) + return net.JoinHostPort(v.Host, fmt.Sprintf("%d", v.Port)) } // ANCHOR_END: APIEndpoint