diff --git a/internal/store/builder.go b/internal/store/builder.go index ff8deb78a1..c815d56f6f 100644 --- a/internal/store/builder.go +++ b/internal/store/builder.go @@ -538,8 +538,7 @@ func (b *Builder) buildStores( if b.fieldSelectorFilter != "" { klog.InfoS("FieldSelector is used", "fieldSelector", b.fieldSelectorFilter) } - kubeClient := b.kubeClient - listWatcher := listWatchFunc(kubeClient, v1.NamespaceAll, b.fieldSelectorFilter) + listWatcher := listWatchFunc(b.kubeClient, v1.NamespaceAll, b.fieldSelectorFilter) b.startReflector(expectedType, store, listWatcher, useAPIServerCache) return []cache.Store{store} } diff --git a/pkg/sharding/listwatch_test.go b/pkg/sharding/listwatch_test.go index 85f82563f3..cc7f8698e7 100644 --- a/pkg/sharding/listwatch_test.go +++ b/pkg/sharding/listwatch_test.go @@ -27,7 +27,7 @@ import ( func TestSharding(t *testing.T) { cm := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ - Name: "configmap1", + Name: "pod1", Namespace: "ns1", UID: types.UID("test_uid"), },