From 375f7432c45cd217513fd32cf97ed67d2f0ff452 Mon Sep 17 00:00:00 2001 From: Antoni Zawodny Date: Thu, 25 Jul 2024 11:47:21 +0200 Subject: [PATCH] feat: make cluster cache target the watch cache instead of etcd Signed-off-by: Antoni Zawodny --- pkg/cache/cluster.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/cache/cluster.go b/pkg/cache/cluster.go index 3f662effc..497d8374a 100644 --- a/pkg/cache/cluster.go +++ b/pkg/cache/cluster.go @@ -553,6 +553,10 @@ func (c *clusterCache) listResources(ctx context.Context, resClient dynamic.Reso } listRetry.Steps = int(c.listRetryLimit) + // We set the resource version to 0 below to proactively prevent the + // list API call from reaching etcd and make the server fetch the data + // from the watch cache instead. + opts.ResourceVersion = "0" err := retry.OnError(listRetry, c.listRetryFunc, func() error { var ierr error res, ierr = resClient.List(ctx, opts)