Skip to content

Commit

Permalink
fix: attempt etcd leave before deleting a Machine
Browse files Browse the repository at this point in the history
With Sidero Metal, deleting a machine leads to a super fast power down,
and etcd leave doesn't have time to run, which breaks scaling down
`2->1`.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Aug 25, 2023
1 parent 8b65387 commit 7f8e2be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controllers/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,14 @@ func (r *TalosControlPlaneReconciler) scaleDownControlPlane(

r.Log.Info("deleting machine", "machine", deleteMachine.Name, "node", node.Name)

leaveErr := r.gracefulEtcdLeave(ctx, c, util.ObjectKey(cluster), *deleteMachine)

err = r.Client.Delete(ctx, deleteMachine)
if err != nil {
return ctrl.Result{}, err
}

err = r.gracefulEtcdLeave(ctx, c, util.ObjectKey(cluster), *deleteMachine)
if err != nil {
if leaveErr != nil {
return ctrl.Result{}, err
}

Expand Down

0 comments on commit 7f8e2be

Please sign in to comment.