fix(namespaces): increase QPS and burst rate limits #147
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR increases the rate limits (QPS and burst) of the namespace switching component. This fixes the issue of the namespace switcher timing out while fetching the namespaces from a cluster due to cache discovery of the kubernetes API / client-go taking too long on clusters with lots of CRDs. This is a known issue, cf. this blog post from 2022 and other users have also reported issues for similar timeouts in #127.
I've updated QPS to
50.0
and burst to300
from the defaults specified inkubeswitch/vendor/k8s.io/client-go/rest/config.go
Lines 43 to 46 in a6981cf
The default burst for cache discovery is set in
kubeswitch/vendor/k8s.io/client-go/discovery/discovery_client.go
Line 688 in a6981cf
300
, but I'm not sure if it really is being properly propagated here.Anyway, the new values
50
/300
are based on the defaults in the kubectl code found in https://github.com/kubernetes/kubernetes/blob/5f594f42159f2ee84f805d382638f77dd5967177/staging/src/k8s.io/kubectl/pkg/cmd/cmd.go#L95-L97Setting this substantially increased the responsiveness and I haven't since seen this issue on clusters with ~350 CRDs where the namespacer switcher previously was not able to grab namespaces at all.