Skip to content
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

✨ Implement deletion lifecycle hooks #3273

Conversation

michaelgugino
Copy link
Contributor

What this PR does / why we need it:

Implements Deletion Lifecycle Hooks: #3132

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 1, 2020
@k8s-ci-robot k8s-ci-robot requested review from benmoss and vincepri July 1, 2020 03:19
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 1, 2020
@michaelgugino michaelgugino force-pushed the machine-deletion-hooks-impl branch 2 times, most recently from fcd4bc6 to 3d1d833 Compare July 1, 2020 03:58
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass LGTM
Should we wait for the CAEP to merge?


// PreDrainDeleteHookAnnotionPrefix annotation specifies the prefix we
// search each annotation for during the pre-drain.delete lifecycle hook
// to pause reconciliation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// to pause reconciliation.
// to pause deletion.

to avoid confusion with the pause reconciliation at cluster/object level

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are in effect pausing reconciliation, not just deletion. Returning empty, nil results in the object not being reconciled further. Makes more sense to me anyway :)

@vincepri
Copy link
Member

vincepri commented Jul 1, 2020

+1 to wait for the proposal to merge, I know I haven't had any time to review it yet given. @ncdc also had some comments on the hooking design.

@michaelgugino
Copy link
Contributor Author

+1 to wait for the proposal to merge, I know I haven't had any time to review it yet given. @ncdc also had some comments on the hooking design.

Pretty much what I assumed to be the case. But I wanted to get the PR up so people can see what the implementation might look like. From the machine-controller perspective, this implementation is quite trivial.

api/v1alpha3/machine_types.go Outdated Show resolved Hide resolved
api/v1alpha3/machine_types.go Outdated Show resolved Hide resolved
@michaelgugino michaelgugino force-pushed the machine-deletion-hooks-impl branch from 3d1d833 to d5646a9 Compare July 6, 2020 13:31
@michaelgugino michaelgugino force-pushed the machine-deletion-hooks-impl branch from d5646a9 to 7f720c7 Compare August 7, 2020 15:20
@@ -301,6 +307,12 @@ func (r *MachineReconciler) reconcileDelete(ctx context.Context, cluster *cluste
}
}

// pre-term.delete lifecycle hook
// Return early without error, will requeue if/when the Hook is removed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Return early without error, will requeue if/when the Hook is removed.
// Return early without error, will requeue if/when the hook owner removes the annotation.

@michaelgugino michaelgugino force-pushed the machine-deletion-hooks-impl branch from 7f720c7 to a53412e Compare August 12, 2020 00:39
@detiber
Copy link
Member

detiber commented Aug 12, 2020

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 12, 2020
@ncdc
Copy link
Contributor

ncdc commented Aug 24, 2020

I haven't looked at the unit tests in a while - is it possible to add/update the tests to make sure hooks are handled appropriately?

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michaelgugino Do you have time to add some tests?

@ncdc
Copy link
Contributor

ncdc commented Aug 26, 2020

I'm not sure how easy it will be... if @michaelgugino takes a look and it doesn't seem possible to do it easily/quickly, I think I'm fine merging this as-is and following up with unit tests later if/when we are able to do a more comprehensive set around deleted Machines.

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get it merged! We can follow-up with an issue and cover some unit tests

/approve

@vincepri
Copy link
Member

/milestone v0.3.9

@k8s-ci-robot k8s-ci-robot added this to the v0.3.9 milestone Aug 26, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 26, 2020
@k8s-ci-robot k8s-ci-robot merged commit 7e445a1 into kubernetes-sigs:master Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants