diff --git a/staging/src/k8s.io/client-go/util/certificate/csr/csr.go b/staging/src/k8s.io/client-go/util/certificate/csr/csr.go index 1cd996c02c5..6f99dcd24b0 100644 --- a/staging/src/k8s.io/client-go/util/certificate/csr/csr.go +++ b/staging/src/k8s.io/client-go/util/certificate/csr/csr.go @@ -178,14 +178,14 @@ func WaitForCertificate(ctx context.Context, client clientset.Interface, reqName fieldSelector := fields.OneTermEqualSelector("metadata.name", reqName).String() logger := klog.FromContext(ctx) - var lw *cache.ListWatch + var lw cache.ListerWatcher var obj runtime.Object for { // see if the v1 API is available if _, err := client.CertificatesV1().CertificateSigningRequests().List(ctx, metav1.ListOptions{FieldSelector: fieldSelector}); err == nil { // watch v1 objects obj = &certificatesv1.CertificateSigningRequest{} - lw = &cache.ListWatch{ + lw = cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector return client.CertificatesV1().CertificateSigningRequests().List(ctx, options) @@ -194,7 +194,7 @@ func WaitForCertificate(ctx context.Context, client clientset.Interface, reqName options.FieldSelector = fieldSelector return client.CertificatesV1().CertificateSigningRequests().Watch(ctx, options) }, - } + }, client) break } else { logger.V(2).Info("Error fetching v1 certificate signing request", "err", err) @@ -209,7 +209,7 @@ func WaitForCertificate(ctx context.Context, client clientset.Interface, reqName if _, err := client.CertificatesV1beta1().CertificateSigningRequests().List(ctx, metav1.ListOptions{FieldSelector: fieldSelector}); err == nil { // watch v1beta1 objects obj = &certificatesv1beta1.CertificateSigningRequest{} - lw = &cache.ListWatch{ + lw = cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector return client.CertificatesV1beta1().CertificateSigningRequests().List(ctx, options) @@ -218,7 +218,7 @@ func WaitForCertificate(ctx context.Context, client clientset.Interface, reqName options.FieldSelector = fieldSelector return client.CertificatesV1beta1().CertificateSigningRequests().Watch(ctx, options) }, - } + }, client) break } else { logger.V(2).Info("Error fetching v1beta1 certificate signing request", "err", err) diff --git a/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go index ea4169079a6..2ed43cf178f 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go @@ -452,7 +452,7 @@ func (c *Controller) initInformer(ctx context.Context) error { }, } informer := cache.NewSharedIndexInformer( - &cache.ListWatch{ + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { tweakListOptions(&options) slices, err := c.resourceClient.ResourceSlices().List(ctx, options) @@ -469,7 +469,7 @@ func (c *Controller) initInformer(ctx context.Context) error { logger.V(5).Info("Started watching ResourceSlices", "resourceAPI", c.resourceClient.CurrentAPI(), "err", err) return w, err }, - }, + }, c.resourceClient), &resourceapi.ResourceSlice{}, // No resync because all it would do is periodically trigger syncing pools // again by reporting all slices as updated with the object as old/new. diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go index 8248c9f1b6c..99563738537 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/rollout/rollout_status.go @@ -184,7 +184,7 @@ func (o *RolloutStatusOptions) Run() error { } fieldSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String() - lw := &cache.ListWatch{ + lw := cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(context.TODO(), options) @@ -193,7 +193,7 @@ func (o *RolloutStatusOptions) Run() error { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(context.TODO(), options) }, - } + }, o.DynamicClient) // if the rollout isn't done yet, keep watching deployment status ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), o.Timeout) diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/wait/condition.go b/staging/src/k8s.io/kubectl/pkg/cmd/wait/condition.go index 1f748d109f8..26e4b108080 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/wait/condition.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/wait/condition.go @@ -135,7 +135,7 @@ func getObjAndCheckCondition(ctx context.Context, info *resource.Info, o *WaitOp mapping := info.ResourceMapping() // used to pass back meaningful errors if object disappears fieldSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String() - lw := &cache.ListWatch{ + lw := cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(context.TODO(), options) @@ -144,7 +144,7 @@ func getObjAndCheckCondition(ctx context.Context, info *resource.Info, o *WaitOp options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(context.TODO(), options) }, - } + }, o.DynamicClient) // this function is used to refresh the cache to prevent timeout waits on resources that have disappeared preconditionFunc := func(store cache.Store) (bool, error) { diff --git a/staging/src/k8s.io/kubectl/pkg/cmd/wait/delete.go b/staging/src/k8s.io/kubectl/pkg/cmd/wait/delete.go index b2539647f87..a8ccd2fca7c 100644 --- a/staging/src/k8s.io/kubectl/pkg/cmd/wait/delete.go +++ b/staging/src/k8s.io/kubectl/pkg/cmd/wait/delete.go @@ -77,7 +77,7 @@ func IsDeleted(ctx context.Context, info *resource.Info, o *WaitOptions) (runtim } fieldSelector := fields.OneTermEqualSelector("metadata.name", info.Name).String() - lw := &cache.ListWatch{ + lw := cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).List(ctx, options) @@ -86,7 +86,7 @@ func IsDeleted(ctx context.Context, info *resource.Info, o *WaitOptions) (runtim options.FieldSelector = fieldSelector return o.DynamicClient.Resource(info.Mapping.Resource).Namespace(info.Namespace).Watch(ctx, options) }, - } + }, o.DynamicClient) // this function is used to refresh the cache to prevent timeout waits on resources that have disappeared preconditionFunc := func(store cache.Store) (bool, error) {