fix: handle empty port in HCP mode LoadBalancer URL parsing

Assisted-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Enrico Candino
2026-08-12 16:41:47 +02:00
parent 80f0938148
commit ac2a1a5400
+5 -2
View File
@@ -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
}