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.
This commit is contained in:
Kubernetes Submit Queue 2017-08-02 19:11:13 -07:00 committed by GitHub
commit cba21511bd

View File

@ -390,9 +390,10 @@ func (gc *GarbageCollector) attemptToDeleteItem(item *node) error {
switch {
case len(solid) != 0:
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 {
glog.V(2).Infof("remove dangling references %#v and waiting references %#v for object %s", dangling, waitingForDependentsDeletion, item.identity)
if len(dangling) == 0 && len(waitingForDependentsDeletion) == 0 {
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
// ownerReferences, otherwise the referenced objects will be stuck with
// the FinalizerDeletingDependents and never get deleted.