Skip to content

Commit d3a8cea

Browse files
committed
openshift: return an error if no control plane machine was found
When getting the subnet from machines, let's return an error if no control plane machine was found. This will make it clearer when debugging.
1 parent f012e62 commit d3a8cea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

openshift/pkg/infraclustercontroller/openstackcluster.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ func (r *OpenShiftClusterReconciler) getDefaultSubnetFromMachines(ctx context.Co
355355
return nil, fmt.Errorf("listing control plane machines: %w", err)
356356
}
357357

358+
if len(mapiMachines.Items) == 0 {
359+
return nil, fmt.Errorf("no control plane machines found")
360+
}
361+
358362
apiServerInternalIPs := make([]net.IP, len(platformStatus.APIServerInternalIPs))
359363
for i, ipStr := range platformStatus.APIServerInternalIPs {
360364
apiServerInternalIPs[i] = net.ParseIP(ipStr)

0 commit comments

Comments
 (0)