-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add finalizer with webhook instead of controllers #2080
Add finalizer with webhook instead of controllers #2080
Conversation
I tested this PR by deploying an updated longhorn-manager and creating/editing/deleting resources. Generally, each resource should have a finalizer added on creation. It should be impossible to remove the finalizer while the resource's deletion timestamp is not set, and the resource should still clean up as normal. See specific results below:
Note: any time we edit a resource to remove its finalizer but don't delete it, we should see something like the following in the longhorn-manager logs:
|
bbcfedb
to
3df83ef
Compare
3df83ef
to
562e029
Compare
These tests were originally failing due to a mistake I made in the volume controller webhook:
Fixed and passing at: |
Signed-off-by: Eric Weber <eric.weber@suse.com>
562e029
to
f87d716
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
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.
In general LGTM.
Can we make sure add this uninstallation test plan:
- Install Longhorn with all possible CRDs (volumes, snapshot, backups, backing image, recurring jobs, ...)
- Make sure Uninstallation is ok
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.
An idle question / whine, but LGTM.
Signed-off-by: Eric Weber <eric.weber@suse.com>
Signed-off-by: Eric Weber <eric.weber@suse.com>
f87d716
to
0a0fd7d
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
longhorn/longhorn#4872
This work was started in #1535. In that PR, we ensured that the webhook only added the finalizer during CREATE operations and not during UPDATE operations to avoid resources that cannot be deleted (e.g. we attempt to remove a resource's finalizer, but the finalizer is added back when we do so). After reading some discussion on the internet and thinking on it a bit, I decided a better approach would be for the webhook to always add the finalizer on both CREATE and UPDATE except when the deletion timestamp is set. After reviewing our code, every time longhorn-manager removes the finalizer, the deletion timestamp has already been set on an object. This approach has two benefits:
Otherwise, I also tried to clean up the webhook resources slightly. Code was organized differently between resources and some code was duplicated. Since I was already doing a webhook refactor, I spent some time (hopefully) improving this.
Keeping this as a draft until regression tests pass: https://ci.longhorn.io/job/private/job/longhorn-tests-regression/4596/console.