@@ -67,6 +67,14 @@ type AdapterBase struct {
67
67
// DiscoveryInterval specifies the interval at which to recheck discovery
68
68
// information for the discovery RESTMapper. It's set from a flag.
69
69
DiscoveryInterval time.Duration
70
+ // ClientQPS specifies the maximum QPS for the client-side throttle. It's set from a flag.
71
+ ClientQPS float32
72
+ // ClientBurst specifies the maximum QPS burst for client-side throttle. It's set from a flag.
73
+ ClientBurst int
74
+
75
+ // MarkQPSFlagHidden specifies whether to hide the client-qps and client-burst flags.
76
+ // If you want to use other flags, you can hide them.
77
+ MarkQPSFlagHidden bool
70
78
71
79
// FlagSet is the flagset to add flags to.
72
80
// It defaults to the normal CommandLine flags
@@ -110,7 +118,14 @@ func (b *AdapterBase) InstallFlags() {
110
118
"kubeconfig file pointing at the 'core' kubernetes server with enough rights to list " +
111
119
"any described objects" )
112
120
b .FlagSet .DurationVar (& b .DiscoveryInterval , "discovery-interval" , b .DiscoveryInterval ,
113
- "interval at which to refresh API discovery information" )
121
+ "Interval at which to refresh API discovery information" )
122
+ b .FlagSet .Float32Var (& b .ClientQPS , "client-qps" , rest .DefaultQPS , "Maximum QPS for client-side throttle" )
123
+ b .FlagSet .IntVar (& b .ClientBurst , "client-burst" , rest .DefaultBurst , "Maximum QPS burst for client-side throttle" )
124
+
125
+ if b .MarkQPSFlagHidden {
126
+ b .FlagSet .MarkHidden ("client-qps" )
127
+ b .FlagSet .MarkHidden ("client-burst" )
128
+ }
114
129
})
115
130
}
116
131
@@ -153,6 +168,13 @@ func (b *AdapterBase) ClientConfig() (*rest.Config, error) {
153
168
}
154
169
b .clientConfig = clientConfig
155
170
}
171
+
172
+ if b .ClientQPS > 0 {
173
+ b .clientConfig .QPS = b .ClientQPS
174
+ }
175
+ if b .ClientBurst > 0 {
176
+ b .clientConfig .Burst = b .ClientBurst
177
+ }
156
178
return b .clientConfig , nil
157
179
}
158
180
0 commit comments