mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
cli-runtime: expose option to set discovery burst
This commit is contained in:
parent
7d72ddca6e
commit
32bdf7feaa
@ -105,6 +105,9 @@ type ConfigFlags struct {
|
|||||||
// propagate the config to the places that need it, rather than
|
// propagate the config to the places that need it, rather than
|
||||||
// loading the config multiple times
|
// loading the config multiple times
|
||||||
usePersistentConfig bool
|
usePersistentConfig bool
|
||||||
|
// Allows increasing burst used for discovery, this is useful
|
||||||
|
// in clusters with many registered resources
|
||||||
|
discoveryBurst int
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToRESTConfig implements RESTClientGetter.
|
// ToRESTConfig implements RESTClientGetter.
|
||||||
@ -224,7 +227,7 @@ func (f *ConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, e
|
|||||||
// The more groups you have, the more discovery requests you need to make.
|
// 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
|
// 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.
|
// double it just so we don't end up here again for a while. This config is only used for discovery.
|
||||||
config.Burst = 100
|
config.Burst = f.discoveryBurst
|
||||||
|
|
||||||
cacheDir := defaultCacheDir
|
cacheDir := defaultCacheDir
|
||||||
|
|
||||||
@ -320,6 +323,12 @@ func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags {
|
|||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithDiscoveryBurst sets the RESTClient burst for discovery.
|
||||||
|
func (f *ConfigFlags) WithDiscoveryBurst(discoveryBurst int) *ConfigFlags {
|
||||||
|
f.discoveryBurst = discoveryBurst
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
// NewConfigFlags returns ConfigFlags with default values set
|
// NewConfigFlags returns ConfigFlags with default values set
|
||||||
func NewConfigFlags(usePersistentConfig bool) *ConfigFlags {
|
func NewConfigFlags(usePersistentConfig bool) *ConfigFlags {
|
||||||
impersonateGroup := []string{}
|
impersonateGroup := []string{}
|
||||||
@ -345,6 +354,10 @@ func NewConfigFlags(usePersistentConfig bool) *ConfigFlags {
|
|||||||
ImpersonateGroup: &impersonateGroup,
|
ImpersonateGroup: &impersonateGroup,
|
||||||
|
|
||||||
usePersistentConfig: usePersistentConfig,
|
usePersistentConfig: usePersistentConfig,
|
||||||
|
// 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.
|
||||||
|
discoveryBurst: 100,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user