Skip to content

Commit

Permalink
fix: mark control plane as initialized as soon as endpoints are ready
Browse files Browse the repository at this point in the history
This should resolve a problem when there's a "deadlock" between CAPI
core MachineController and CACPPT: CAPI core waits for the control plane
to be initialized to start watching workload cluster Nodes to pick up
`.spec.ProviderID` changes, while CACPPT relies on the MachineController
to update the Machine status.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Apr 19, 2022
1 parent 04b0570 commit 3cdfa0e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/taloscontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ func (r *TalosControlPlaneReconciler) updateStatus(ctx context.Context, tcp *con
return nil
}

// if we were able to fetch some resources via control plane endpoint,
// workload cluster control plane endpoint is available
tcp.Status.Initialized = true
conditions.MarkTrue(tcp, controlplanev1.AvailableCondition)

for _, node := range nodes.Items {
if util.IsNodeReady(&node) {
tcp.Status.ReadyReplicas++
Expand All @@ -560,11 +565,6 @@ func (r *TalosControlPlaneReconciler) updateStatus(ctx context.Context, tcp *con

tcp.Status.UnavailableReplicas = replicas - tcp.Status.ReadyReplicas

if len(nodes.Items) > 0 {
tcp.Status.Initialized = true
conditions.MarkTrue(tcp, controlplanev1.AvailableCondition)
}

if tcp.Status.ReadyReplicas > 0 {
tcp.Status.Ready = true
}
Expand Down

0 comments on commit 3cdfa0e

Please sign in to comment.