Skip to content

Commit ad97dc5

Browse files
authored
Merge pull request kubernetes-sigs#10903 from fabriziopandini/revert-changes-to-cluster-provisioned
🌱 Partially revert changes for ":bug: Cluster should be provisoned when cpRef and endpoint is set"
2 parents ff54cbf + 41ee33a commit ad97dc5

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

api/v1beta1/cluster_phase_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ const (
3333
// Cluster API Cluster controller after being created.
3434
ClusterPhasePending = ClusterPhase("Pending")
3535

36-
// ClusterPhaseProvisioning is the state when the Cluster has a provider infrastructure
37-
// object associated and can start provisioning.
36+
// ClusterPhaseProvisioning is the state when the Cluster has a infrastructure
37+
// object or a control plane object that can start provisioning the control plane endpoint.
3838
ClusterPhaseProvisioning = ClusterPhase("Provisioning")
3939

40-
// ClusterPhaseProvisioned is the state when its
41-
// infrastructure has been created and configured.
40+
// ClusterPhaseProvisioned is the state when its control plane endpoint has been created and configured
41+
// and the infrastructure object is ready (if defined).
42+
// Note: When a cluster reaches this phase parts of the control plane or worker machines might be still provisioning.
4243
ClusterPhaseProvisioned = ClusterPhase("Provisioned")
4344

4445
// ClusterPhaseDeleting is the Cluster state when a delete

internal/controllers/cluster/cluster_controller_phases.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ func (r *Reconciler) reconcilePhase(_ context.Context, cluster *clusterv1.Cluste
5252
cluster.Status.SetTypedPhase(clusterv1.ClusterPhaseProvisioning)
5353
}
5454

55-
if (cluster.Spec.InfrastructureRef == nil || cluster.Status.InfrastructureReady) &&
56-
(cluster.Spec.ControlPlaneRef == nil || cluster.Status.ControlPlaneReady) &&
57-
cluster.Spec.ControlPlaneEndpoint.IsValid() {
55+
if cluster.Status.InfrastructureReady && cluster.Spec.ControlPlaneEndpoint.IsValid() {
5856
cluster.Status.SetTypedPhase(clusterv1.ClusterPhaseProvisioned)
5957
}
6058

internal/controllers/cluster/cluster_controller_phases_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,14 @@ func TestClusterReconciler_reconcilePhase(t *testing.T) {
573573
Name: "test-cluster",
574574
},
575575
Spec: clusterv1.ClusterSpec{
576-
ControlPlaneEndpoint: clusterv1.APIEndpoint{
576+
ControlPlaneEndpoint: clusterv1.APIEndpoint{ // This is set by the control plane ref controller when the cluster endpoint is available.
577577
Host: "1.2.3.4",
578578
Port: 8443,
579579
},
580580
ControlPlaneRef: &corev1.ObjectReference{},
581581
},
582582
Status: clusterv1.ClusterStatus{
583-
ControlPlaneReady: true,
583+
InfrastructureReady: true, // Note, this is automatically set when there is no cluster infrastructure (no-op).
584584
},
585585
},
586586

0 commit comments

Comments
 (0)