Fix duped watch in client-go/testing.

This commit fixes a bug in the client-go/testing fixture whereby a
watcher would fire twice for objects with no namespace.

Kubernetes-commit: bd268c9971efd4db46074a80e52ce765583e0787
This commit is contained in:
João Taveira Araújo
2018-11-19 09:50:17 -08:00
committed by Kubernetes Publisher
parent 117d288bbe
commit 93c815ca99
2 changed files with 41 additions and 14 deletions

View File

@@ -339,8 +339,10 @@ func (t *tracker) getWatches(gvr schema.GroupVersionResource, ns string) []*watc
if w := t.watchers[gvr][ns]; w != nil {
watches = append(watches, w...)
}
if w := t.watchers[gvr][""]; w != nil {
watches = append(watches, w...)
if ns != metav1.NamespaceAll {
if w := t.watchers[gvr][metav1.NamespaceAll]; w != nil {
watches = append(watches, w...)
}
}
}
return watches