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

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

Closed
caesarxuchao opened this issue May 15, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@caesarxuchao
Copy link
Member

commented May 15, 2019

For most built-in resources, if the object deletion is blocked by finalizers, the Update request that removes the last pending finalizer causes the apiserver to delete the object.

The logic is enforced by the generic storage's Update() function, specifically, by the shouldDeleteDuringUpdate function. It checks if finalizers are deleted, and if the metadata.deletionGracefulPeriods was set to 0 (by the first Delete request).

Namepaces and CRD storage overrides the generics storage's Delete() function. They don't set the deletionGracefulPeriods, so namespaces and CRDs do not have this delete-on-update behavior.

I can think of two alternative fixes.

  1. Relaxing the shouldDeleteDuringUpdate

    • Let shouldDeleteDuringUpdate return true if (finalizers are removed by the update) && (deletionGracefulSeconds was set to 0 or was nil) && (deletionTimestamp was not nil).
    • We would also need to override the namespace storage's Update() function, to let it additionally check the namespace.spec.finalizers in its shouldDeleteDuringUpdate.
  2. Only fixing the behavior of CRDs. Let the Delete() function of the CRD storage sets CRD's deletionGracefulPeriod to 0 on first Delete. We'll leave namespaces alone, as its behavior has been like that for years.

cc @liggitt
ref #76346 (comment)
/sig api-machinery

@liggitt

This comment has been minimized.

Copy link
Member

commented May 15, 2019

Let shouldDeleteDuringUpdate return true if (finalizers are removed by the update) && (deletionGracefulSeconds was set to 0 or was nil) && (deletionTimestamp was not nil).

That matches my expectations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.