-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change client default value of qps and burst to constant #26756
Conversation
Define in constants? Otherwise I expect the comments will age and become misleading. |
What's this code: kubernetes/cmd/libs/go2idl/client-gen/generators/generator_for_group.go Lines 218 to 223 in f32f396
Do I need run some auto-gen program? Or do I just change it to some constant there? |
The code you linked to is template used by generator. You can change it to using a constant and then run hack/update-codegen.sh to update the generated clientsets. |
looks good. |
Looks good. As a side note, we should differentiate constants from variables in go2idl. |
@lavalamp @caesarxuchao |
I don't think this is a v1.3 issue. We can apply the lgtm but it won't be merged until the code freeze ends. Seems it's Jun 20 (https://github.com/kubernetes/kubernetes/wiki/Release-1.3#jun-20---jun-24). |
} | ||
if conf.Burst == 0 { | ||
conf.Burst = 10 | ||
conf.Burst = restclient.DefaultBurst |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this? Could we add this to RESTClientFor (if it doesn't already) and avoid putting this logic in every single generated client?
ee1ffa4
to
485af0b
Compare
GCE e2e build/test passed for commit 485af0b56cbaac7e3daf57251cfe3616054eb421. |
@lavalamp |
@caesarxuchao Can you review this? |
Sorry, we're really busy on 1.3 at the moment-- we'll cut the branch at the On Tue, Jun 7, 2016 at 9:20 AM, Hongchao Deng notifications@github.com
|
@caesarxuchao |
@@ -158,6 +163,12 @@ func RESTClientFor(config *Config) (*RESTClient, error) { | |||
if config.NegotiatedSerializer == nil { | |||
return nil, fmt.Errorf("NegotiatedSerializer is required when initializing a RESTClient") | |||
} | |||
if config.QPS == 0.0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest that not to modify the config. Caller of RESTClientFor
doesn't expect to get its config changed.
It seems the only place that uses config.QPS and config.Burst is NewRESTClient
, could you copy them to two local variables and pass them to NewRESTClient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what @lavalamp suggested. Could you two coordinate on final decision and ping again? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you copy them to two local variables and pass them to NewRESTClient?
This doesn't conflict with my recommendation to put this defaulting logic here. :) Not modifying config seems good.
@@ -93,10 +98,10 @@ type Config struct { | |||
// on top of the returned RoundTripper. | |||
WrapTransport func(rt http.RoundTripper) http.RoundTripper | |||
|
|||
// QPS indicates the maximum QPS to the master from this client. If zero, QPS is unlimited. | |||
// QPS indicates the maximum QPS to the master from this client. If zero, it will be set to DefaultQPS: 5. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "it will be set to DefaultQPS: 5" -> "the created RESTClient will use DefaultQPS: 5". The config doesn't get changed.
LGTM. Just two nits regarding the comments. Fix them if you can get to them before merge. |
Addressed. Thanks for the review. |
Thanks for contributing! |
GCE e2e build/test passed for commit 56fb1688ac5f49186e4083f5080fa1763c0f8cfc. |
GCE e2e build/test passed for commit 55d3597. |
GCE e2e build/test passed for commit 55d3597. |
@caesarxuchao |
I think the config is always supplied to |
@k8s-bot node e2e test this issue: #IGNORE |
GCE e2e build/test failed for commit 55d3597. Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake. |
@k8s-bot test this please, issue #IGNORE (Sorry, temporarily broke Jenkins.) |
GCE e2e build/test passed for commit 55d3597. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 55d3597. |
Automatic merge from submit-queue |
No description provided.