From 1838d1f15574670dd1a69efc33028c040e769d8c Mon Sep 17 00:00:00 2001 From: Amit Sahastrabuddhe <33931378+AmitSahastra@users.noreply.github.com> Date: Wed, 6 Mar 2024 18:48:37 +0530 Subject: [PATCH] PCP-2585: MAAS cluster is stuck in provisioning if customEndpoint is present and customEndpointPort is not present (#140) --- pkg/maas/scope/cluster.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/maas/scope/cluster.go b/pkg/maas/scope/cluster.go index 0a7799f..78ff182 100644 --- a/pkg/maas/scope/cluster.go +++ b/pkg/maas/scope/cluster.go @@ -119,13 +119,14 @@ func (s *ClusterScope) Close() error { // APIServerPort returns the APIServerPort to use when creating the load balancer. func (s *ClusterScope) APIServerPort() int { - if s.Cluster.Spec.ClusterNetwork != nil && s.Cluster.Spec.ClusterNetwork.APIServerPort != nil { - return int(*s.Cluster.Spec.ClusterNetwork.APIServerPort) - } - if infrautil.IsCustomEndpointPresent(s.MaasCluster.GetAnnotations()) { + if infrautil.IsCustomEndpointPresent(s.MaasCluster.GetAnnotations()) && s.MaasCluster.Spec.ControlPlaneEndpoint.Port != 0 { return s.MaasCluster.Spec.ControlPlaneEndpoint.Port } + + if s.Cluster.Spec.ClusterNetwork != nil && s.Cluster.Spec.ClusterNetwork.APIServerPort != nil { + return int(*s.Cluster.Spec.ClusterNetwork.APIServerPort) + } return 6443 }