From ac2a1a5400b8ccd91511696e33555f18b79d98a2 Mon Sep 17 00:00:00 2001 From: Enrico Candino Date: Wed, 12 Aug 2026 16:30:50 +0200 Subject: [PATCH] fix: handle empty port in HCP mode LoadBalancer URL parsing Assisted-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- pkg/controller/cluster/hcp.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/controller/cluster/hcp.go b/pkg/controller/cluster/hcp.go index 4cbe5679..f5e55730 100644 --- a/pkg/controller/cluster/hcp.go +++ b/pkg/controller/cluster/hcp.go @@ -1,6 +1,7 @@ package cluster import ( + "cmp" "context" "fmt" "net" @@ -55,7 +56,8 @@ func (c *ClusterReconciler) ensureHCPKubernetesEndpointSlice(ctx context.Context return err } - port, err := strconv.Atoi(url.Port()) + portStr := cmp.Or(url.Port(), "443") + port, err := strconv.Atoi(portStr) if err != nil { return err } @@ -148,7 +150,8 @@ func (c *ClusterReconciler) ensureHCPKubernetesEndpoints(ctx context.Context, cl }, } - port, err := strconv.Atoi(url.Port()) + portStr := cmp.Or(url.Port(), "443") + port, err := strconv.Atoi(portStr) if err != nil { return err }