-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🌱 Improve Drain for control plane machines #11457
🌱 Improve Drain for control plane machines #11457
Conversation
f3bcb52
to
ccd4b9c
Compare
/test pull-cluster-api-e2e-main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@@ -634,6 +634,12 @@ func (r *Reconciler) reconcileDelete(ctx context.Context, s *scope) (ctrl.Result | |||
} | |||
|
|||
func (r *Reconciler) isNodeDrainAllowed(m *clusterv1.Machine) bool { | |||
if util.IsControlPlaneMachine(m) && util.HasOwner(m.GetOwnerReferences(), clusterv1.GroupVersion.String(), []string{"KubeadmControlPlane"}) { | |||
if _, exists := m.Annotations[clusterv1.PreTerminateDeleteHookAnnotationPrefix+"/kcp-cleanup"]; !exists { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: we don't want to import controlplanev1 to prevent the go dependency right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's correct.
We are trying to avoid having dependency from to core controller to KCP/CABPK
I made this more explicit like we do in other places
LGTM label has been added. Git tree hash: 86acea7722e6eb9f970b3ce68800e7a375dc4bbc
|
ccd4b9c
to
c3904f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
LGTM label has been added. Git tree hash: e2687ff82b475998fffb63a4710c539aa06f39b4
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrischdi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This PR prevents drain and detatch volume to happen for CP machines where KCP's PreTerminateDeleteHookAnnotation has been already removed.
This prevents drain and detach volume to spam the logs with error messages because at this stage kubelet on CP machines stops to works.
/area machine