-
Notifications
You must be signed in to change notification settings - Fork 128
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
Use downward API to pass current spec.nodeName to pod #309
Use downward API to pass current spec.nodeName to pod #309
Conversation
Pull Request Test Coverage Report for Build 4436337857Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
afe0d54
to
059409b
Compare
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.
Conceptually, this makes total sense - this had slipped me by - full FQDNs will not work.
Thanks for catching.
Could you return an error instead, and throw in a couple of unit tests for this ?
... sorry for the lack of current tests in this package ...
@andreaskaris for the unit tests, you'll have to change the signature of whereabouts/cmd/controlloop/controlloop.go Line 109 in 87e95f1
K8S has a mock client set where you can provision it with the objects it would be able to retrieve: that way, you can write a negative and a positive test. EDIT: something like what we're doing here:
|
091f13b
to
888e459
Compare
The podInformerFactory uses filter key spec.nodeName to filter the pods that it should monitor. Up until now, this filter was set to the value of HOSTNAME. However, this is not reliable, as spec.nodeName can be overridden in kubernetes with --hostname-override and thus HOSTNAME and spec.nodeName do not necessarily always match. Instead, rely on a new custom environment variable NODENAME which is populated by the downward API. Signed-off-by: Andreas Karis <ak.karis@gmail.com>
888e459
to
ef409bb
Compare
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 good with the approach on the unit tests
Pass `spec.nodeName` via the new `NODENAME` enviorment variable. Introduced in whereabouts v0.6.2: k8snetworkplumbingwg/whereabouts#309 Signed-off-by: Michael Fritch <mfritch@suse.com>
Update DaemonSet to pass `spec.nodeName` via a new `NODENAME` environment variable. Introduced by whereabouts v0.6.2: k8snetworkplumbingwg/whereabouts#309 Signed-off-by: Michael Fritch <mfritch@suse.com>
The podInformerFactory uses filter key spec.nodeName to filter the pods that it should monitor. Up until now, this filter was set to the value of HOSTNAME. However, this is not reliable, as spec.nodeName can be overridden in kubernetes with --hostname-override and thus HOSTNAME and spec.nodeName do now necessarily always match. Instead, rely on a new custom environment variable NODENAME which is populated by the downward API.
Fixes https://issues.redhat.com/browse/OCPBUGS-10364