Skip to content

Commit a48c76b

Browse files
committed
Revert "clustercache: Prevent concurrent map read/write when creating a cache"
This reverts commit 3aa7711.
1 parent 376b85e commit a48c76b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

controllers/clustercache/cluster_accessor_client.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package clustercache
1919
import (
2020
"context"
2121
"fmt"
22-
"maps"
2322
"net/http"
2423
"sync"
2524
"time"
@@ -214,19 +213,13 @@ func createUncachedClient(scheme *runtime.Scheme, config *rest.Config, httpClien
214213

215214
// createCachedClient creates a cached client for the given cluster, based on the rest.Config.
216215
func createCachedClient(ctx context.Context, clusterAccessorConfig *clusterAccessorConfig, config *rest.Config, httpClient *http.Client, mapper meta.RESTMapper) (client.Client, *stoppableCache, error) {
217-
// The byObject map needs to be cloned to not hit concurrent read/writes on the Namespaces map.
218-
byObject := maps.Clone(clusterAccessorConfig.Cache.ByObject)
219-
for k, v := range byObject {
220-
v.Namespaces = maps.Clone(v.Namespaces)
221-
byObject[k] = v
222-
}
223-
216+
// Create the cache for the cluster.
224217
cacheOptions := cache.Options{
225218
HTTPClient: httpClient,
226219
Scheme: clusterAccessorConfig.Scheme,
227220
Mapper: mapper,
228221
SyncPeriod: clusterAccessorConfig.Cache.SyncPeriod,
229-
ByObject: byObject,
222+
ByObject: clusterAccessorConfig.Cache.ByObject,
230223
}
231224
remoteCache, err := cache.New(config, cacheOptions)
232225
if err != nil {

0 commit comments

Comments
 (0)