-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Support status.hostIP in downward API #42717
Support status.hostIP in downward API #42717
Conversation
Hi @andrewsykim. 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 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. |
@@ -41,11 +41,6 @@ func FormatMap(m map[string]string) (fmtStr string) { | |||
// ExtractFieldPathAsString extracts the field from the given object | |||
// and returns it as a string. The object must be a pointer to an | |||
// API type. | |||
// | |||
// Currently, this API is limited to supporting the fieldpaths: |
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.
Seemed out of date
@k8s-bot ok to test |
5570bdc
to
22d72ab
Compare
@thockin seems like HOST_IP="" in the e2e test 🤔. Any ideas why? |
Possible that there's a race between kubelet starting the pod and writing back the status? |
At a quick glance of the kubelet code it seems like the Do you know if kubelet for E2E tests run on standalone mode (seems unlikely that it would)? It seems like the kubelet skips setting HostIP in PodStatus in standalone mode. https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L1175-L1185 |
^ I'll temporarily skip the check to verify |
This is probably similar to the original problems we had with podIP, but
I'm not positive that hostIP is set until after the first status is
calculated.
…On Thu, Mar 16, 2017 at 12:34 AM, Andrew Sy Kim ***@***.***> wrote:
At a quick glance of the kubelet code it seems like the PodIP update
should happen on the same UpdateStatus call as the HostIP, the PodIP is
defined in the e2e tests so race condition seems unlikely, you definitely
know the code better than me so correct me if I'm wrong please :).
Do you know if kubelet for E2E tests run on standalone mode? It seems like
the kubelet skips setting HostIP in PodStatus in standalone mode.
https://github.com/kubernetes/kubernetes/blob/master/pkg/
kubelet/kubelet_pods.go#L1175-L1185
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#42717 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pydvSR8r2LWPLYHFcvdhzPUQsKIEks5rmLvlgaJpZM4MWgj2>
.
|
@smarterclayton this seems relevant to what you're referring to. |
2b282cc
to
22d72ab
Compare
Oh God, what rabbit hole have I gotten myself into 🤦♂️ 😛 |
I dug into the code a bit more and have a better idea of what to do. If we stick with the way podIP is passed into kubelet's runtime it'll avoid any big refactoring at the cost of adding more cruft to the kubelet code (mostly passing in hostIP along with podIP). If we're OK with this I can have the kubelet code updated soon. Let me know what you think @smarterclayton @thockin @pmorie |
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.
With the new commit, the PR looks much cleaner.
pkg/kubelet/kubelet_pods.go
Outdated
@@ -617,6 +617,13 @@ func (kl *Kubelet) podFieldSelectorRuntimeValue(fs *v1.ObjectFieldSelector, pod | |||
return pod.Spec.NodeName, nil | |||
case "spec.serviceAccountName": | |||
return pod.Spec.ServiceAccountName, nil | |||
case "status.hostIP": | |||
hostIP, err := kl.GetHostIP() |
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.
Use kl.getHostIPAnyWay()
to make sure we can always get the host IP, even if kubelet hasn't registered yet.
pkg/kubelet/kubelet_pods.go
Outdated
if err != nil { | ||
return "", err | ||
} | ||
|
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: remove the extra line.
/lgtm |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: andrewsykim, yujuhong
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue |
Any chance we can get this cherry picked into the next 1.6 release? |
@andrewsykim, supporting hostIP in the downward API is a feature. We usually cherry-pick bug fixes. |
So what is the target release version for this? |
1.7 |
Reintroduce auto-registration flow on VDSC container. Get the external engine address fetching the CN field on the TLS cert got connecting the engine on its service address. Get the node address using kubernetes Environment Variables since status.hostIP will be available within downward volume API only with kubernetes 1.7 (see kubernetes/kubernetes#42717 ). Since the registration command it's running in a systemd unit we have to get its env directly from /proc/1/environ Change-Id: I4ff7b7999d089aa581b44bf031f62f10fbbaa3cb Signed-off-by: Simone Tiraboschi <[email protected]>
Reintroduce auto-registration flow on VDSC container. Get the external engine address fetching the CN field on the TLS cert got connecting the engine on its service address. Get the node address using kubernetes Environment Variables since status.hostIP will be available within downward volume API only with kubernetes 1.7 (see kubernetes/kubernetes#42717 ). Since the registration command it's running in a systemd unit we have to get its env directly from /proc/1/environ Change-Id: I4ff7b7999d089aa581b44bf031f62f10fbbaa3cb Signed-off-by: Simone Tiraboschi <[email protected]>
@@ -74,10 +74,20 @@ var _ = framework.KubeDescribe("Downward API", func() { | |||
}, | |||
}, | |||
}, | |||
{ | |||
Name: "HOST_IP", |
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.
You added a new field to an existing check without a version block check.
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.
ping @andrewsykim , seems you left a bug to fix here :)
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.
@timothysc @resouer Thanks for bringing this to my attention :), will try to fix it this week. Is this blocking someones PR from getting in?
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.
Seems odd that this would come up as a problem after 6 months
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 don't think this is a blocker
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.
PR to fix in 1.8.1 is here - #53673
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.
Thanks Tim, it seems we also version blocked pod IP e2e test for > v1.8 but it was added way back, was that intentional?
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.
@andrewsykim I don't think we want to version block pod IP e2e test. I send PR #53772 to split the test case :)
Automatic merge from submit-queue (batch tested with PRs 53507, 53772, 52903, 53543). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Split downward API e2e test case for pod/host IP into two **What this PR does / why we need it**: Split the test case in order to avoid version block pod IP e2e test. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # ref: #42717 (comment) **Special notes for your reviewer**: /cc @timothysc @andrewsykim
Hi -- any word on this? Just tested
Thanks. |
What this PR does / why we need it:
Exposes pod's hostIP (node IP) via downward API.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged):fixes #24657
Special notes for your reviewer:
Not sure if there's more documentation that's needed, please point me in the right direction and I will add some :)