Skip to content

Commit 000384b

Browse files
committed
Address comments
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
1 parent ef8fdeb commit 000384b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/client/client.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ import (
3838
"sigs.k8s.io/controller-runtime/pkg/log"
3939
)
4040

41+
// KcpClusterDiscoveryCacheSize is the size of the cache for cluster discovery
42+
// information backing the client's REST mapper.
43+
var KcpClusterDiscoveryCacheSize = 1000
44+
4145
// Options are creation options for a Client.
4246
type Options struct {
4347
// HTTPClient is the HTTP client to use for requests.
@@ -188,7 +192,7 @@ func newClient(config *rest.Config, options Options) (*client, error) {
188192
mapper: options.MapperWithContext,
189193
codecs: serializer.NewCodecFactory(options.Scheme),
190194
}
191-
cr, err := lru.New[logicalcluster.Path, clusterResources](1000)
195+
cr, err := lru.New[logicalcluster.Path, clusterResources](KcpClusterDiscoveryCacheSize)
192196
if err != nil {
193197
return nil, err
194198
}
@@ -215,7 +219,7 @@ func newClient(config *rest.Config, options Options) (*client, error) {
215219
scheme: options.Scheme,
216220
mapper: options.Mapper,
217221
}
218-
mapperCache, err := lru.New[logicalcluster.Name, meta.RESTMapper](1000)
222+
mapperCache, err := lru.New[logicalcluster.Name, meta.RESTMapper](KcpClusterDiscoveryCacheSize)
219223
if err != nil {
220224
return nil, err
221225
}

0 commit comments

Comments
 (0)