mirror of
https://github.com/kubernetes/client-go.git
synced 2025-06-27 07:28:14 +00:00
Bump default burst limit for discovery client to 300
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com> Kubernetes-commit: 534427f5d3134189f49e6811a7642b86cf92c55a
This commit is contained in:
parent
b2097e607c
commit
ed7d154cc2
@ -52,6 +52,9 @@ const (
|
|||||||
// defaultTimeout is the maximum amount of time per request when no timeout has been set on a RESTClient.
|
// defaultTimeout is the maximum amount of time per request when no timeout has been set on a RESTClient.
|
||||||
// Defaults to 32s in order to have a distinguishable length of time, relative to other timeouts that exist.
|
// Defaults to 32s in order to have a distinguishable length of time, relative to other timeouts that exist.
|
||||||
defaultTimeout = 32 * time.Second
|
defaultTimeout = 32 * time.Second
|
||||||
|
|
||||||
|
// defaultBurst is the default burst to be used with the discovery client's token bucket rate limiter
|
||||||
|
defaultBurst = 300
|
||||||
)
|
)
|
||||||
|
|
||||||
// DiscoveryInterface holds the methods that discover server-supported API groups,
|
// DiscoveryInterface holds the methods that discover server-supported API groups,
|
||||||
@ -456,12 +459,14 @@ func setDiscoveryDefaults(config *restclient.Config) error {
|
|||||||
if config.Timeout == 0 {
|
if config.Timeout == 0 {
|
||||||
config.Timeout = defaultTimeout
|
config.Timeout = defaultTimeout
|
||||||
}
|
}
|
||||||
if config.Burst == 0 && config.QPS < 100 {
|
// if a burst limit is not already configured and
|
||||||
|
// an avg. rate of `defaultBurst` qps is not already configured
|
||||||
|
if config.Burst == 0 && config.QPS < defaultBurst {
|
||||||
// discovery is expected to be bursty, increase the default burst
|
// discovery is expected to be bursty, increase the default burst
|
||||||
// to accommodate looking up resource info for many API groups.
|
// to accommodate looking up resource info for many API groups.
|
||||||
// matches burst set by ConfigFlags#ToDiscoveryClient().
|
// matches burst set by ConfigFlags#ToDiscoveryClient().
|
||||||
// see https://issue.k8s.io/86149
|
// see https://issue.k8s.io/86149
|
||||||
config.Burst = 100
|
config.Burst = defaultBurst
|
||||||
}
|
}
|
||||||
codec := runtime.NoopEncoder{Decoder: scheme.Codecs.UniversalDecoder()}
|
codec := runtime.NoopEncoder{Decoder: scheme.Codecs.UniversalDecoder()}
|
||||||
config.NegotiatedSerializer = serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{Serializer: codec})
|
config.NegotiatedSerializer = serializer.NegotiatedSerializerWrapper(runtime.SerializerInfo{Serializer: codec})
|
||||||
|
Loading…
Reference in New Issue
Block a user