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

Fixes #40819 and Fixes #33114 #40892

Merged
merged 1 commit into from
Feb 10, 2017

Conversation

robdaemon
Copy link

@robdaemon robdaemon commented Feb 2, 2017

What this PR does / why we need it:

Start looking up the virtual machine by it's UUID in vSphere again. Looking up by IP address is problematic and can either not return a VM entirely, or could return the wrong VM.

Retrieves the VM's UUID in one of two methods - either by a vm-uuid entry in the cloud config file on the VM, or via sysfs. The sysfs route requires root access, but restores the previous functionality.

Multiple VMs in a vCenter cluster can share an IP address - for example, if you have multiple VM networks, but they're all isolated and use the same address range. Additionally, flannel network address ranges can overlap.

vSphere seems to have a limitation of reporting no more than 16 interfaces from a virtual machine, so it's possible that the IP address list on a VM is completely untrustworthy anyhow - it can either be empty (because the 16 interfaces it found were veth interfaces with no IP address), or it can report the flannel IP.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Fixes #40819
Fixes #33114

Special notes for your reviewer:

Release note:

Reverts to looking up the current VM in vSphere using the machine's UUID, either obtained via sysfs or via the `vm-uuid` parameter in the cloud configuration file.

@k8s-ci-robot
Copy link
Contributor

Hi @robdaemon. 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 @k8s-bot 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.

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 2, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 2, 2017
@roberthbailey
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2017
@kerneltime
Copy link

CC @BaluDontu @divyenpatel

@kerneltime
Copy link

kerneltime commented Feb 2, 2017

@kerneltime
Copy link

@@ -42,6 +41,8 @@ import (
"github.com/vmware/govmomi/vim25/types"
"golang.org/x/net/context"

"io/ioutil"

Choose a reason for hiding this comment

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

Can this be moved along with other golang imports

Copy link
Author

Choose a reason for hiding this comment

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

done

if cfg.Global.VMUUID != "" {
vmUUID = cfg.Global.VMUUID
} else {
vmUUIDbytes, err := ioutil.ReadFile("/sys/devices/virtual/dmi/id/product_uuid")

Choose a reason for hiding this comment

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

Add a comment that this needs appropriate privilidges

Copy link
Author

Choose a reason for hiding this comment

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

done

@kerneltime
Copy link

Apart from unit testing were any other tests performed? Would be good to know.

@@ -122,12 +123,15 @@ type VSphereConfig struct {
WorkingDir string `gcfg:"working-dir"`
// Soap round tripper count (retries = RoundTripper - 1)
RoundTripperCount uint `gcfg:"soap-roundtrip-count"`
// VMUUID is the virtual machine's UUID. If not set, will be fetched from the machine.

Choose a reason for hiding this comment

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

We have many UUIDs! How about following;

// VM Instance UUID of virtual machine which can be retrieved from instanceUuid property in VmConfigInfo, or also set as vc.uuid in VMX file) ?

Copy link
Author

Choose a reason for hiding this comment

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

done - merged your comment with the existing one.

if cfg.Global.VMUUID != "" {
vmUUID = cfg.Global.VMUUID
} else {
vmUUIDbytes, err := ioutil.ReadFile("/sys/devices/virtual/dmi/id/product_uuid")

Choose a reason for hiding this comment

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

Can this path change in different linux distros?

Copy link
Author

Choose a reason for hiding this comment

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

Not that I'm aware of. sysfs is kernel-level, not distro-level. Someone please correct me if I'm wrong :)

@kerneltime
Copy link

Fixes #33114
Hopefully Github will pick up the issue else can you extend the fixes line on your initial comment to include #33114

@MrTrustor
Copy link

Thank you for the fix! Does this have any chance to be backported in the 1.5 branch?
cc @cvauvarin

@robdaemon robdaemon changed the title Fixes #40819 Fixes #40819 and Fixes #33114 Feb 3, 2017
@robdaemon
Copy link
Author

@kerneltime - I tested this on a vSphere 6.0 cluster - both by specifying the ID in the config, by running it without that (as root) and running it as non-root. It behaves as expected.

@robdaemon
Copy link
Author

@kerneltime Docs PR is kubernetes/website#2416

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 3, 2017
@kerneltime
Copy link

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

@kerneltime: you can't LGTM a PR unless you are an assignee.

In response to this comment:

/lgtm
/approve

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-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 3, 2017
vmUUID = cfg.Global.VMUUID
} else {
// This needs root privileges on the host, and will fail otherwise.
vmUUIDbytes, err := ioutil.ReadFile("/sys/devices/virtual/dmi/id/product_uuid")

Choose a reason for hiding this comment

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

This path can be made configurable and defaulted to this value. This way any distro specific concerns can be addressed by an optional item in the config passed in.

@kerneltime
Copy link

@k8s-bot ok to test

@kerneltime
Copy link

@roberthbailey this needs a LGTM

@robdaemon
Copy link
Author

That failure looks unrelated to my change?

@kerneltime
Copy link

@k8s-bot gci gce e2e test this

@roberthbailey
Copy link
Contributor

@kerneltime - I added you as an assignee so you should be able to lgtm now

@roberthbailey
Copy link
Contributor

@robdaemon - we generally ask folks to squash their commits after addressing review feedback. If you feel this is ready to merge please squash it into a single commit.

Start looking up the virtual machine by it's UUID in vSphere again. Looking up by IP address is problematic and can either not return a VM entirely, or could return the wrong VM.

Retrieves the VM's UUID in one of two methods - either by a `vm-uuid` entry in the cloud config file on the VM, or via sysfs. The sysfs route requires root access, but restores the previous functionality.

Multiple VMs in a vCenter cluster can share an IP address - for example, if you have multiple VM networks, but they're all isolated and use the same address range. Additionally, flannel network address ranges can overlap.

vSphere seems to have a limitation of reporting no more than 16 interfaces from a virtual machine, so it's possible that the IP address list on a VM is completely untrustworthy anyhow - it can either be empty (because the 16 interfaces it found were veth interfaces with no IP address), or it can report the flannel IP.
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

The following people have approved this PR: kerneltime, robdaemon

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

@robdaemon
Copy link
Author

@roberthbailey - squashed! Thanks!

@kerneltime
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 10, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 41223, 40892, 41220, 41207, 41242)

@k8s-github-robot k8s-github-robot merged commit 93bd6b3 into kubernetes:master Feb 10, 2017
k8s-github-robot pushed a commit that referenced this pull request Feb 11, 2017
…-k8s-release-1.5

Automatic merge from submit-queue

Automated cherry pick of #40892

Cherry pick of #40892 on release-1.5.

#40892: Fixes #40819
jessfraz added a commit that referenced this pull request Feb 23, 2017
tailnode pushed a commit to tailnode/kubernetes.github.io that referenced this pull request Feb 23, 2017
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. 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.

Wrong VM name is retrieved by the vSphere Cloud Provider vSphere Cloud Provider invalid server name
8 participants