Commit cba21511 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #49980 from caesarxuchao/gc-minor

Automatic merge from submit-queue (batch tested with PRs 49237, 49656, 49980, 49841, 49899) GC shouldn't send empty patch The scope of the `if` statement was wrong, causing GC to sometimes send empty patch. Found this bug while investigating https://github.com/kubernetes/kubernetes/issues/49966.
parents 09388343 3060e925
...@@ -390,9 +390,10 @@ func (gc *GarbageCollector) attemptToDeleteItem(item *node) error { ...@@ -390,9 +390,10 @@ func (gc *GarbageCollector) attemptToDeleteItem(item *node) error {
switch { switch {
case len(solid) != 0: case len(solid) != 0:
glog.V(2).Infof("object %s has at least one existing owner: %#v, will not garbage collect", solid, item.identity) glog.V(2).Infof("object %s has at least one existing owner: %#v, will not garbage collect", solid, item.identity)
if len(dangling) != 0 || len(waitingForDependentsDeletion) != 0 { if len(dangling) == 0 && len(waitingForDependentsDeletion) == 0 {
glog.V(2).Infof("remove dangling references %#v and waiting references %#v for object %s", dangling, waitingForDependentsDeletion, item.identity) return nil
} }
glog.V(2).Infof("remove dangling references %#v and waiting references %#v for object %s", dangling, waitingForDependentsDeletion, item.identity)
// waitingForDependentsDeletion needs to be deleted from the // waitingForDependentsDeletion needs to be deleted from the
// ownerReferences, otherwise the referenced objects will be stuck with // ownerReferences, otherwise the referenced objects will be stuck with
// the FinalizerDeletingDependents and never get deleted. // the FinalizerDeletingDependents and never get deleted.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment