File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ func init() {
48
48
// If --kubeconfig is set, will use the kubeconfig file at that location. Otherwise will assume running
49
49
// in cluster and use the cluster provided kubeconfig.
50
50
//
51
+ // It also applies saner defaults for QPS and burst based on the Kubernetes
52
+ // controller manager defaults (20 QPS, 30 burst)
53
+ //
51
54
// Config precedence
52
55
//
53
56
// * --kubeconfig flag pointing at a file
@@ -58,6 +61,21 @@ func init() {
58
61
//
59
62
// * $HOME/.kube/config if exists
60
63
func GetConfig () (* rest.Config , error ) {
64
+ cfg , err := loadConfig ()
65
+ if err != nil {
66
+ return nil , err
67
+ }
68
+
69
+ if cfg .QPS == 0.0 {
70
+ cfg .QPS = 20.0
71
+ cfg .Burst = 30.0
72
+ }
73
+
74
+ return cfg , nil
75
+ }
76
+
77
+ // loadConfig loads a REST Config as per the rules specified in GetConfig
78
+ func loadConfig () (* rest.Config , error ) {
61
79
// If a flag is specified with the config location, use that
62
80
if len (kubeconfig ) > 0 {
63
81
return clientcmd .BuildConfigFromFlags (apiServerURL , kubeconfig )
Original file line number Diff line number Diff line change @@ -169,6 +169,9 @@ func (te *Environment) Start() (*rest.Config, error) {
169
169
// Create the *rest.Config for creating new clients
170
170
te .Config = & rest.Config {
171
171
Host : te .ControlPlane .APIURL ().Host ,
172
+ // gotta go fast during tests -- we don't really care about overwhelming our test API server
173
+ QPS : 1000.0 ,
174
+ Burst : 2000.0 ,
172
175
}
173
176
}
174
177
You can’t perform that action at this time.
0 commit comments