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

Handle updates removing remaining finalizers on deleted objects #77952

Merged
merged 1 commit into from
May 17, 2019

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented May 15, 2019

What type of PR is this?
/kind bug

What this PR does / why we need it:
Avoids making all finalizer implementers do a separate delete after removing their finalizer

Which issue(s) this PR fixes:
Fixes #77944

Does this PR introduce a user-facing change?:

Updates that remove remaining `metadata.finalizers` from  an object that is pending deletion (non-nil metadata.deletionTimestamp) and has no graceful deletion pending (nil or 0 metadata.deletionGracePeriodSeconds) now results in immediate deletion of the object.

/sig api-machinery
/cc @caesarxuchao

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 15, 2019
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver labels May 15, 2019
@liggitt liggitt force-pushed the delete-on-update branch 2 times, most recently from c8a5399 to 7461b4a Compare May 15, 2019 19:38
@caesarxuchao
Copy link
Member

caesarxuchao commented May 15, 2019

The approach lgtm.

Please add a unit test to ensure the namespace delete behavior is correct.

We need to update namespace controller and crd finalizer logic, these lines should be redundant now:

if d.deleteNamespaceWhenDone && finalized(namespace) {
return d.deleteNamespace(namespace)
}

// and now issue another delete, which should clean it all up if no finalizers remain or no-op if they do
return c.crdClient.CustomResourceDefinitions().Delete(crd.Name, nil)

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/test sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 15, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt

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

@liggitt liggitt changed the title WIP - Handle updates removing remaining finalizers on deleted objects Handle updates removing remaining finalizers on deleted objects May 15, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 15, 2019
@liggitt
Copy link
Member Author

liggitt commented May 15, 2019

Please add a unit test to ensure the namespace delete behavior is correct.

done, added positive and negative unit tests for spec and metadata finalizers on namespace update and finalize storage

We need to update namespace controller and crd finalizer logic, these lines should be redundant now

added TODOs to remove redundant deletes in the next release (I'd rather be extra sure we don't block namespace or CRD cleanup in a controller/apiserver skew scenario)

@liggitt
Copy link
Member Author

liggitt commented May 15, 2019

/retest

@caesarxuchao
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 16, 2019
@liggitt
Copy link
Member Author

liggitt commented May 16, 2019

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 16, 2019
@k8s-ci-robot k8s-ci-robot merged commit 2741095 into kubernetes:master May 17, 2019
@liggitt liggitt deleted the delete-on-update branch May 17, 2019 15:11
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. area/apiserver area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Namespaces and CRD have inconsistent delete-on-update behavior than other built-in resources.
3 participants