Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#10903 from fabriziopandini/revert-…
Browse files Browse the repository at this point in the history
…changes-to-cluster-provisioned

🌱 Partially revert changes for ":bug: Cluster should be provisoned when cpRef and endpoint is set"
  • Loading branch information
k8s-ci-robot authored Jul 18, 2024
2 parents ff54cbf + 41ee33a commit ad97dc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 5 additions & 4 deletions api/v1beta1/cluster_phase_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ const (
// Cluster API Cluster controller after being created.
ClusterPhasePending = ClusterPhase("Pending")

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

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

// ClusterPhaseDeleting is the Cluster state when a delete
Expand Down
4 changes: 1 addition & 3 deletions internal/controllers/cluster/cluster_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ func (r *Reconciler) reconcilePhase(_ context.Context, cluster *clusterv1.Cluste
cluster.Status.SetTypedPhase(clusterv1.ClusterPhaseProvisioning)
}

if (cluster.Spec.InfrastructureRef == nil || cluster.Status.InfrastructureReady) &&
(cluster.Spec.ControlPlaneRef == nil || cluster.Status.ControlPlaneReady) &&
cluster.Spec.ControlPlaneEndpoint.IsValid() {
if cluster.Status.InfrastructureReady && cluster.Spec.ControlPlaneEndpoint.IsValid() {
cluster.Status.SetTypedPhase(clusterv1.ClusterPhaseProvisioned)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,14 @@ func TestClusterReconciler_reconcilePhase(t *testing.T) {
Name: "test-cluster",
},
Spec: clusterv1.ClusterSpec{
ControlPlaneEndpoint: clusterv1.APIEndpoint{
ControlPlaneEndpoint: clusterv1.APIEndpoint{ // This is set by the control plane ref controller when the cluster endpoint is available.
Host: "1.2.3.4",
Port: 8443,
},
ControlPlaneRef: &corev1.ObjectReference{},
},
Status: clusterv1.ClusterStatus{
ControlPlaneReady: true,
InfrastructureReady: true, // Note, this is automatically set when there is no cluster infrastructure (no-op).
},
},

Expand Down

0 comments on commit ad97dc5

Please sign in to comment.