-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Set default User-Agent on http probe #47729
Conversation
Hi @paultyng. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@k8s-bot ok to test /lgtm |
/approve |
@@ -68,6 +69,14 @@ func DoHTTPProbe(url *url.URL, headers http.Header, client HTTPGetInterface) (pr | |||
// Convert errors into failures to catch timeouts. | |||
return probe.Failure, err.Error(), nil | |||
} | |||
if _, ok := headers["User-Agent"]; !ok { | |||
if headers == nil { |
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.
should this check be moved to L71?
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.
https://play.golang.org/p/Uob2yTGKhj
Unnecessary for a go map
If unspecified in probe definition, User-Agent will be set to `kube-probe/<version major.minor>` on httpGet probe types instead of the default Go User-Agent.
/retest |
@brendandburns minor update to fix bazel build |
This should be ready for another look, tests all succeeded. |
@brendandburns did you want any changes to this to put the lgtm back? |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brendandburns, paultyng Associated issue: 29025 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 47286, 47729) |
Set a default User-Agent on
httpGet
probes:Currently the default Go HTTP client sets a
User-Agent
specific to the language and version, but every Go client has the same one. In Kubernetes, users can override the User-Agent by setting a header in their probe definition, but its tedious to do this everywhere.This PR changes the default User-Agent only if not set (or removed) in the probe definition.
Which issue this PR fixes
fixes #29025
Special notes for your reviewer:
Release note: