mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 19:58:17 +00:00
Allow changing discovery QPS with cli-runtime
This commit is contained in:
@@ -120,6 +120,9 @@ type ConfigFlags struct {
|
|||||||
// Allows increasing burst used for discovery, this is useful
|
// Allows increasing burst used for discovery, this is useful
|
||||||
// in clusters with many registered resources
|
// in clusters with many registered resources
|
||||||
discoveryBurst int
|
discoveryBurst int
|
||||||
|
// Allows increasing qps used for discovery, this is useful
|
||||||
|
// in clusters with many registered resources
|
||||||
|
discoveryQPS float32
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToRESTConfig implements RESTClientGetter.
|
// ToRESTConfig implements RESTClientGetter.
|
||||||
@@ -269,6 +272,7 @@ func (f *ConfigFlags) toDiscoveryClient() (discovery.CachedDiscoveryInterface, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.Burst = f.discoveryBurst
|
config.Burst = f.discoveryBurst
|
||||||
|
config.QPS = f.discoveryQPS
|
||||||
|
|
||||||
cacheDir := defaultCacheDir
|
cacheDir := defaultCacheDir
|
||||||
|
|
||||||
@@ -393,6 +397,12 @@ func (f *ConfigFlags) WithDiscoveryBurst(discoveryBurst int) *ConfigFlags {
|
|||||||
return f
|
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.
|
// WithWrapConfigFn allows providing a wrapper function for the client Config.
|
||||||
func (f *ConfigFlags) WithWrapConfigFn(wrapConfigFn func(*rest.Config) *rest.Config) *ConfigFlags {
|
func (f *ConfigFlags) WithWrapConfigFn(wrapConfigFn func(*rest.Config) *rest.Config) *ConfigFlags {
|
||||||
f.WrapConfigFn = wrapConfigFn
|
f.WrapConfigFn = wrapConfigFn
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ func NewKubectlCommand(o KubectlOptions) *cobra.Command {
|
|||||||
|
|
||||||
kubeConfigFlags := o.ConfigFlags
|
kubeConfigFlags := o.ConfigFlags
|
||||||
if kubeConfigFlags == nil {
|
if kubeConfigFlags == nil {
|
||||||
kubeConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300)
|
kubeConfigFlags = genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag().WithDiscoveryBurst(300).WithDiscoveryQPS(50.0)
|
||||||
}
|
}
|
||||||
kubeConfigFlags.AddFlags(flags)
|
kubeConfigFlags.AddFlags(flags)
|
||||||
matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)
|
matchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(kubeConfigFlags)
|
||||||
|
|||||||
Reference in New Issue
Block a user