Skip to content
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

Fix setNodeAddress when a node IP and a cloud provider are set #49202

Merged
merged 1 commit into from
Sep 7, 2017

Conversation

cbonte
Copy link
Contributor

@cbonte cbonte commented Jul 19, 2017

What this PR does / why we need it:
When a node IP is set and a cloud provider returns the same address with
several types, only the first address was accepted. With the changes made
in PR #45201, the vSphere cloud provider returned the ExternalIP first,
which led to a node without any InternalIP.

The behaviour is modified to return all the address types for the
specified node IP.

Which issue this PR fixes: fixes #48760

Special notes for your reviewer:

  • I'm not a golang expert, is it possible to mock kubelet.validateNodeIP() to avoid the need of real host interface addresses in the test ?
  • It would be great to have it backported for a next 1.6.8 release.

Release note:

Fix for Nodes in vSphere lacking an InternalIP. (#48760)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 19, 2017
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. labels Jul 19, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @cbonte. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

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-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 19, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 19, 2017
@spxtr
Copy link
Contributor

spxtr commented Jul 19, 2017

/lint

Copy link
Contributor

@k8s-ci-robot k8s-ci-robot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spxtr: no lint warnings.

In response to this:

/lint

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.

@dims
Copy link
Member

dims commented Aug 9, 2017

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 9, 2017
@cbonte
Copy link
Contributor Author

cbonte commented Aug 10, 2017

/retest

@cbonte
Copy link
Contributor Author

cbonte commented Aug 10, 2017

/assign @Random-Liu

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 16, 2017
@cbonte cbonte force-pushed the node-addresses branch 2 times, most recently from b7e7da4 to 9749d4b Compare August 28, 2017 09:56
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 28, 2017
@cbonte
Copy link
Contributor Author

cbonte commented Aug 28, 2017

/retest

@cbonte
Copy link
Contributor Author

cbonte commented Aug 28, 2017

PR has been rebased according to current master branch.

@jhorwit2
Copy link
Contributor

Does this issue also occur in the cloud controller manager?

@jhorwit2
Copy link
Contributor

cc @wlan0 @luxas

@wlan0
Copy link
Member

wlan0 commented Aug 28, 2017

@cbonte Thanks for the PR.

It LGTM, except for the part where host IP addresses are used.

I'm not a golang expert, is it possible to mock kubelet.validateNodeIP() to avoid the need of real host interface addresses in the test ?

I don't think there is a simple answer to this. You could "inject" a interface here - https://github.com/cbonte/kubernetes/blob/25767ae38906ca7dc00c6c6a2935de583c12eaa5/pkg/kubelet/kubelet.go#L846

and in the test, while creating the kubelet object (newTestKubelet method), pass a mock struct to that interface. This is quite a bit of refactoring!

Tbh, I'm not entirely sure that relying on the host IP addresses is a bad idea. If that is ok, then we don't need any of this refactoring, and the current tests will suffice.

@luxas what would you suggest?

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 28, 2017
@cbonte
Copy link
Contributor Author

cbonte commented Aug 29, 2017

Tbh, I'm not entirely sure that relying on the host IP addresses is a bad idea. If that is ok, then we don't need any of this refactoring, and the current tests will suffice.

I tend to agree.

Note : I'm currently rebasing the PR again, as some changes since yesterday introduce new conflicts.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 29, 2017
@calebamiles calebamiles added this to the v1.8 milestone Sep 5, 2017
@calebamiles
Copy link
Contributor

@luxas, sorry this was a bulk remove from the milestone since the PR was unmergable at the time of code freeze (missing either, lgtm, or approve, or had test failures). Added the PR back to the milestone but the PR itself is still unmergable

@calebamiles
Copy link
Contributor

/retest

@liggitt
Copy link
Member

liggitt commented Sep 5, 2017

flake on #50695
/test pull-kubernetes-e2e-gce-etcd3

@dims
Copy link
Member

dims commented Sep 6, 2017

/test pull-kubernetes-e2e-gce-etcd3

@liggitt
Copy link
Member

liggitt commented Sep 6, 2017

/retest

@dims
Copy link
Member

dims commented Sep 6, 2017

@Random-Liu @vishh @tallclair @dchen1107 - Can one of you please approve?

Copy link
Member

@cheftako cheftako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Spec: v1.NodeSpec{},
}

// TODO : is it possible to mock kubelet.validateNodeIP() to avoid relying on the host interface addresses ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at validateNodeIP() and there is nothing to prevent it from being a standalone function. I think that'd make testing much easier.

@yujuhong
Copy link
Contributor

yujuhong commented Sep 7, 2017

/approve

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cbonte, cheftako, liggitt, yujuhong

Associated issue: 45201

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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 7, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 51728, 49202)

@k8s-github-robot k8s-github-robot merged commit a51eb2a into kubernetes:master Sep 7, 2017
@cbonte
Copy link
Contributor Author

cbonte commented Sep 7, 2017

Hi @yujuhong, is it possible to make this PR as a cherry-pick candidate for release-1.6 ?
Thanks !

@yujuhong
Copy link
Contributor

yujuhong commented Sep 7, 2017

@cbonte you can submit a cherrypick PR.

@enisoc enisoc added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Sep 8, 2017
k8s-github-robot pushed a commit that referenced this pull request Sep 11, 2017
…-upstream-release-1.6

Automatic merge from submit-queue

Automated cherry pick of #49202

Cherry pick of #49202 on release-1.6.

#49202: Fix setNodeAddress when a node IP and a cloud provider are
@wojtek-t wojtek-t modified the milestones: v1.8, v1.7 Oct 3, 2017
@wojtek-t wojtek-t added cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. cherrypick-candidate labels Oct 3, 2017
k8s-github-robot pushed a commit that referenced this pull request Oct 3, 2017
…-upstream-release-1.7

Automatic merge from submit-queue.

Automated cherry pick of #49202

Cherry pick of #49202 on release-1.7.

#49202: Fix setNodeAddress when a node IP and a cloud provider are
@k8s-cherrypick-bot
Copy link

Commit found in the "release-1.7" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cloudprovider cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/node Categorizes an issue or PR as relevant to SIG Node. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No InternalIP when upgrading to kubernetes >= 1.6.5 with VSphere Cloud Provider