Merge pull request #105520 from soltysh/bump_burst

Bump discovery burst for kubectl to 300
This commit is contained in:
Kubernetes Prow Robot 2021-11-16 18:45:53 -08:00 committed by GitHub
commit 0c476690d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -120,6 +120,9 @@ type ConfigFlags struct {
// Allows increasing burst used for discovery, this is useful
// in clusters with many registered resources
discoveryBurst int
// Allows increasing qps used for discovery, this is useful
// in clusters with many registered resources
discoveryQPS float32
}
// ToRESTConfig implements RESTClientGetter.
@ -268,10 +271,8 @@ func (f *ConfigFlags) toDiscoveryClient() (discovery.CachedDiscoveryInterface, e
return nil, err
}
// The more groups you have, the more discovery requests you need to make.
// given 25 groups (our groups + a few custom resources) with one-ish version each, discovery needs to make 50 requests
// double it just so we don't end up here again for a while. This config is only used for discovery.
config.Burst = f.discoveryBurst
config.QPS = f.discoveryQPS
cacheDir := defaultCacheDir
@ -396,6 +397,12 @@ func (f *ConfigFlags) WithDiscoveryBurst(discoveryBurst int) *ConfigFlags {
return f
}
// WithDiscoveryBurst sets the RESTClient burst for discovery.
func (f *ConfigFlags) WithDiscoveryQPS(discoveryQPS float32) *ConfigFlags {
f.discoveryQPS = discoveryQPS
return f
}
// WithWrapConfigFn allows providing a wrapper function for the client Config.
func (f *ConfigFlags) WithWrapConfigFn(wrapConfigFn func(*rest.Config) *rest.Config) *ConfigFlags {
f.WrapConfigFn = wrapConfigFn

View File

@ -294,7 +294,7 @@ func NewKubectlCommand(o KubectlOptions) *cobra.Command {
kubeConfigFlags := o.ConfigFlags
if kubeConfigFlags == nil {
kubeConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag()
kubeConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300).WithDiscoveryQPS(50.0)
}
kubeConfigFlags.AddFlags(flags)
matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)