-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Enable finalizers independent of GC enablement #51148
Enable finalizers independent of GC enablement #51148
Conversation
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes kubernetes#50528.
func (e *Store) shouldDeleteDuringUpdate(ctx genericapirequest.Context, key string, obj, existing runtime.Object) bool { | ||
if !e.EnableGarbageCollection { | ||
return false | ||
} |
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.
Please closely scrutinize this particular change to ensure there aren't some unintended consequences.
// | ||
// Because the finalizers created here are only cleared by the garbage | ||
// collector, deletionFinalizers always returns false when garbage collection is | ||
// disabled for the Store. | ||
func deletionFinalizers(e *Store, accessor metav1.Object, options *metav1.DeleteOptions) (bool, []string) { |
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.
rename to something like deletionFinalizersForGarbageCollection
?
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.
Renamed, and also attempted to make the godocs more clear.
/retest |
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.
lgtm.
} else { | ||
// TODO: remove the check on graceful, because we support no-op updates now. | ||
if graceful { | ||
err, ignoreNotFound, deleteImmediately, out, lastExisting = e.updateForGracefulDeletion(ctx, name, key, options, preconditions, obj) |
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.
We used to keep both functions to be able to turn off all finalizers. The finalizers feature has been stablized long enough to remove the redundant code.
if err != nil { | ||
t.Fatalf("Unexpected error: %v", err) | ||
} | ||
gcStates := []bool{true, false} |
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.
It looks like you didn't change the tests, you just added the case where gcStates=false, 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.
Yeah, ignoring white space (add ?w=1) made that clear. The diff was terrifying otherwise
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ironcladlou, liggitt Associated issue: 50528 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Please add a release note that finalizers on custom resources are now respected. Since this also affects external servers building on the generic store in the 1.7 timeframe (like service catalog) that had to disable garbage collection because GC didn't support discovered resources, I think we should pick this change to 1.7.x as well |
Automatic merge from submit-queue (batch tested with PRs 51148, 50816, 49741, 50858, 51223) |
@liggitt @caesarxuchao @ironcladlou - can you please add a user-friendly release note if you want this cherrypicked? |
done |
@liggitt, could you also add "finalizers are now respected even if the garbage collector is disabled via the apiserver flag --enable-garbage-collector"? |
done |
Automated cherrypick is resulting in some conficts. Can one of you please create the cherrypick? |
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes kubernetes#50528. Backport of kubernetes#51148.
1.7 backport PR is #51469 |
Automatic merge from submit-queue Enable finalizers independent of GC enablement Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of #51148. ```release-note Finalizers are now honored on custom resources, and on other resources even when garbage collection is disabled via the apiserver flag `--enable-garbage-collector=false` ``` /cc @kubernetes/sig-api-machinery-bugs /cc @caesarxuchao @liggitt @sttts @pmorie
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. Kubernetes-commit: 6a64a13f5ce573259d1c87ad752c39d9e253053a
Automatic merge from submit-queue Enable finalizers independent of GC enablement Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. ```release-note Finalizers are now honored on custom resources, and on other resources even when garbage collection is disabled via the apiserver flag `--enable-garbage-collector=false` ``` /cc @kubernetes/sig-api-machinery-bugs /cc @caesarxuchao @liggitt @sttts @pmorie Kubernetes-commit: 209ba5d0dccb1cfe087615964f28f497f05e52b0
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. Kubernetes-commit: 6a64a13f5ce573259d1c87ad752c39d9e253053a
Automatic merge from submit-queue Enable finalizers independent of GC enablement Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. ```release-note Finalizers are now honored on custom resources, and on other resources even when garbage collection is disabled via the apiserver flag `--enable-garbage-collector=false` ``` /cc @kubernetes/sig-api-machinery-bugs /cc @caesarxuchao @liggitt @sttts @pmorie Kubernetes-commit: 209ba5d0dccb1cfe087615964f28f497f05e52b0
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. Kubernetes-commit: 6a64a13f5ce573259d1c87ad752c39d9e253053a
Automatic merge from submit-queue Enable finalizers independent of GC enablement Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. ```release-note Finalizers are now honored on custom resources, and on other resources even when garbage collection is disabled via the apiserver flag `--enable-garbage-collector=false` ``` /cc @kubernetes/sig-api-machinery-bugs /cc @caesarxuchao @liggitt @sttts @pmorie Kubernetes-commit: 209ba5d0dccb1cfe087615964f28f497f05e52b0
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. :100644 100644 2dcea903a0... 2153c16c5b... M pkg/registry/generic/registry/store.go :100644 100644 fa61ac97b9... 096517a662... M pkg/registry/generic/registry/store_test.go
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. Kubernetes-commit: 6a64a13f5ce573259d1c87ad752c39d9e253053a
Automatic merge from submit-queue Enable finalizers independent of GC enablement Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. ```release-note Finalizers are now honored on custom resources, and on other resources even when garbage collection is disabled via the apiserver flag `--enable-garbage-collector=false` ``` /cc @kubernetes/sig-api-machinery-bugs /cc @caesarxuchao @liggitt @sttts @pmorie Kubernetes-commit: 209ba5d0dccb1cfe087615964f28f497f05e52b0
Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. Kubernetes-commit: 6a64a13f5ce573259d1c87ad752c39d9e253053a
Automatic merge from submit-queue Enable finalizers independent of GC enablement Decouple finalizer processing from garbage collection configuration. Finalizers should be effective even when garbage collection is disabled for a given store. Fixes #50528. Backport of kubernetes/kubernetes#51148. ```release-note Finalizers are now honored on custom resources, and on other resources even when garbage collection is disabled via the apiserver flag `--enable-garbage-collector=false` ``` /cc @kubernetes/sig-api-machinery-bugs /cc @caesarxuchao @liggitt @sttts @pmorie Kubernetes-commit: 209ba5d0dccb1cfe087615964f28f497f05e52b0
Decouple finalizer processing from garbage collection configuration.
Finalizers should be effective even when garbage collection is disabled
for a given store.
Fixes #50528.
/cc @kubernetes/sig-api-machinery-bugs
/cc @caesarxuchao @liggitt @sttts @pmorie