Skip to content

Commit

Permalink
cli-runtime: expose option to set discovery burst
Browse files Browse the repository at this point in the history
  • Loading branch information
soltysh committed Nov 20, 2020
1 parent 7d72ddc commit 32bdf7f
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ type ConfigFlags struct {
// propagate the config to the places that need it, rather than
// loading the config multiple times
usePersistentConfig bool
// Allows increasing burst used for discovery, this is useful
// in clusters with many registered resources
discoveryBurst int
}

// ToRESTConfig implements RESTClientGetter.
Expand Down Expand Up @@ -224,7 +227,7 @@ func (f *ConfigFlags) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, e
// 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 = 100
config.Burst = f.discoveryBurst

cacheDir := defaultCacheDir

Expand Down Expand Up @@ -320,6 +323,12 @@ func (f *ConfigFlags) WithDeprecatedPasswordFlag() *ConfigFlags {
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
func NewConfigFlags(usePersistentConfig bool) *ConfigFlags {
impersonateGroup := []string{}
Expand All @@ -345,6 +354,10 @@ func NewConfigFlags(usePersistentConfig bool) *ConfigFlags {
ImpersonateGroup: &impersonateGroup,

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,
}
}

Expand Down

0 comments on commit 32bdf7f

Please sign in to comment.