mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Allow changing discovery QPS with cli-runtime
This commit is contained in:
parent
e944d2c365
commit
2fe968deb6
@ -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.
|
||||
@ -269,6 +272,7 @@ func (f *ConfigFlags) toDiscoveryClient() (discovery.CachedDiscoveryInterface, e
|
||||
}
|
||||
|
||||
config.Burst = f.discoveryBurst
|
||||
config.QPS = f.discoveryQPS
|
||||
|
||||
cacheDir := defaultCacheDir
|
||||
|
||||
@ -393,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
|
||||
|
@ -294,7 +294,7 @@ func NewKubectlCommand(o KubectlOptions) *cobra.Command {
|
||||
|
||||
kubeConfigFlags := o.ConfigFlags
|
||||
if kubeConfigFlags == nil {
|
||||
kubeConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300)
|
||||
kubeConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300).WithDiscoveryQPS(50.0)
|
||||
}
|
||||
kubeConfigFlags.AddFlags(flags)
|
||||
matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)
|
||||
|
Loading…
Reference in New Issue
Block a user