@@ -32,6 +32,8 @@ func NewInClusterRESTClientGetter(cfg *rest.Config, namespace string) genericcli
32
32
flags .BearerToken = & cfg .BearerToken
33
33
flags .CAFile = & cfg .CAFile
34
34
flags .Namespace = & namespace
35
+ flags .WithDiscoveryBurst (cfg .Burst )
36
+ flags .WithDiscoveryQPS (cfg .QPS )
35
37
if sa := cfg .Impersonate .UserName ; sa != "" {
36
38
flags .Impersonate = & sa
37
39
}
@@ -45,13 +47,17 @@ type MemoryRESTClientGetter struct {
45
47
kubeConfig []byte
46
48
namespace string
47
49
impersonateAccount string
50
+ qps float32
51
+ burst int
48
52
}
49
53
50
- func NewMemoryRESTClientGetter (kubeConfig []byte , namespace string , impersonateAccount string ) genericclioptions.RESTClientGetter {
54
+ func NewMemoryRESTClientGetter (kubeConfig []byte , namespace string , impersonateAccount string , qps float32 , burst int ) genericclioptions.RESTClientGetter {
51
55
return & MemoryRESTClientGetter {
52
56
kubeConfig : kubeConfig ,
53
57
namespace : namespace ,
54
58
impersonateAccount : impersonateAccount ,
59
+ qps : qps ,
60
+ burst : burst ,
55
61
}
56
62
}
57
63
@@ -76,10 +82,8 @@ func (c *MemoryRESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryI
76
82
config .Impersonate = rest.ImpersonationConfig {UserName : c .impersonateAccount }
77
83
}
78
84
79
- // The more groups you have, the more discovery requests you need to make.
80
- // given 25 groups (our groups + a few custom resources) with one-ish version each, discovery needs to make 50 requests
81
- // double it just so we don't end up here again for a while. This config is only used for discovery.
82
- config .Burst = 100
85
+ config .QPS = c .qps
86
+ config .Burst = c .burst
83
87
84
88
discoveryClient , _ := discovery .NewDiscoveryClientForConfig (config )
85
89
return memory .NewMemCacheClient (discoveryClient ), nil
0 commit comments