-
Notifications
You must be signed in to change notification settings - Fork 8
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
Added auto detection for kubelet client config #19
Conversation
…onfig cmd line arg
) | ||
|
||
var _ = flag.String(namespaces, "", "(optional, default '') Comma separated list of namespaces to discover pods on") | ||
var _ = flag.Bool(insecure, false, `(optional, default false, deprecated) Use insecure (non-ssl) connection. | ||
For backwards compatibility this flag takes precedence over 'tls')`) | ||
var _ = flag.Bool(autoConfig, false, "(optional, default false) fetch node info for configuration") | ||
var _ = flag.Int(timeout, 5000, "(optional, default 5000) timeout in ms") |
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 need to mention this new flag in PR description + release notes?
internal/http/client.go
Outdated
} | ||
|
||
buff, _ := ioutil.ReadAll(resp.Body) | ||
_ = resp.Body.Close() |
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.
why do we need this blank variable?
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.
It makes linters happy when you assign errors to a blank variable rather than just ignoring them.
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'm more concerned we don't check the error from ioutil.ReadAll
or at least make it part of the return on line 90.
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.
lgtm
return found | ||
} | ||
|
||
// IsAutoConfig returns true if no config parameter was provided as cmd line arg. |
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.
Cool 👍
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.
LGTM, thanks for making the HTTP changes as well.
This PR will add the capability to auto-detect the kubelet endpoint configuration by fetching the node information.
If this mechanism will be used only if no configuration is specified via cmd line args.
If this mechanism fails, the old behavior is use.
In addition to this, a new flag is added to be able to overwrite the hostname
--host (default localhost). If not specified the previous behavior is maintained.