Skip to content

Commit

Permalink
Merge pull request #461 from furkatgofurov7/cherry-pick-460
Browse files Browse the repository at this point in the history
Fix: remove pre-terminate drain hook for legacy CP
  • Loading branch information
furkatgofurov7 authored Oct 9, 2024
2 parents 455f090 + 667fbf0 commit 7bd5ca7
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1000,13 +1000,12 @@ func (r *RKE2ControlPlaneReconciler) reconcilePreTerminateHook(ctx context.Conte

// The following will execute and remove the pre-terminate hook from the Machine.

// Skip leader change for legacy CP
_, found := controlPlane.RCP.Annotations[controlplanev1.LegacyRKE2ControlPlane]

// If we have more than 1 Machine and etcd is managed we forward etcd leadership and remove the member
// to keep the etcd cluster healthy.
if controlPlane.Machines.Len() > 1 {
if _, found := controlPlane.RCP.Annotations[controlplanev1.LegacyRKE2ControlPlane]; found {
return ctrl.Result{}, nil
}

if controlPlane.Machines.Len() > 1 && !found {
workloadCluster, err := r.GetWorkloadCluster(ctx, controlPlane)
if err != nil {
return ctrl.Result{}, errors.Wrapf(err,
Expand Down

0 comments on commit 7bd5ca7

Please sign in to comment.