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

Set network interface name with cloud-init set-name #707

Merged

Conversation

MnrGreg
Copy link
Contributor

@MnrGreg MnrGreg commented Dec 23, 2019

/kind bug
/assign @akutz

What this PR does / why we need it:
Cloud-Init Network Config Version 2 fails to use Predictable Network Interface Names. Instead it uses the Cloud-Init Device Configuration ID as the interface name. Bug #1855945

As a workaround, this PR adds SetName as an optional parameter to the NetworkDeviceSpec. When SetName is not specified, cloud-init metadata is configured with set-name: "eth*" where * equals the Device ID index. When SetName is specified, cloud-init set-name uses this value.

Summary:

  • Adds SetName to NetworkDeviceSpec
  • Adds SetName to vspheremachines and vspheremachinetemplates CRDs
  • Adds templating for set-name to pkg/util/constants.go
  • Adds & updates tests in machines_tests.go
  • Updates troubleshooting.md documentation

Which issue(s) this PR fixes
Fixes #583

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

Ability to configure Network Interface names

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 23, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @MnrGreg. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@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 Dec 23, 2019
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 23, 2019
@MnrGreg
Copy link
Contributor Author

MnrGreg commented Dec 23, 2019

/assign @frapposelli

@frapposelli
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 23, 2019
@akutz
Copy link
Contributor

akutz commented Dec 23, 2019

Hi @MnrGreg,

Thank you very much for this PR! Here's my suggestion:

  1. Pull out any references to the v1a3 types
  2. Run make generate before resending the PR
  3. Retarget this PR at release-0.5

Currently e2e is broken on master. If you can get it passing against the release-05 branch (v1a2), then we know this works as expected.

docs/troubleshooting.md Outdated Show resolved Hide resolved
docs/troubleshooting.md Outdated Show resolved Hide resolved
api/v1alpha2/types.go Outdated Show resolved Hide resolved
Signed-off-by: Greg May <[email protected]>
@MnrGreg MnrGreg force-pushed the using_cloudinit_set-name branch from ed55708 to 72c11dd Compare December 24, 2019 20:08
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 24, 2019
@MnrGreg MnrGreg changed the base branch from master to release-0.5 December 24, 2019 20:09
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 24, 2019
@MnrGreg
Copy link
Contributor Author

MnrGreg commented Dec 24, 2019

/retest

@MnrGreg
Copy link
Contributor Author

MnrGreg commented Dec 24, 2019

/test pull-cluster-api-provider-vsphere-verify-shell

@MnrGreg
Copy link
Contributor Author

MnrGreg commented Dec 24, 2019

@akutz could you review when you have a moment

Copy link
Contributor

@akutz akutz left a comment

Choose a reason for hiding this comment

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

Hi @MnrGreg,

This looks great. I had one small nit about the casing of a comment. Finally, I'm sorry for this, but I'm wondering if the property shouldn't be DeviceName? For example:

// DeviceName may be used to explicitly assign a name to the network device
// as it exists in the guest operating system.
// +optional
DeviceName string `json:"deviceName,omitempty"`

Obviously the generated cloud-init metadata would still use set-name (since that is the name of the field from cloud-init's point-of-view), but I'm thinking that SetName makes far less sense in the NetworkDeviceSpec than something like DeviceName. What do you think?

// setName can be used to give the device a more specific/desirable/nicer
// name than the default from udev’s ifnames
// +optional
SetName string `json:"setName,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @MnrGreg,

The GoDoc comment should reflect the name/casing of the field, not the JSON property. So the comment should be:

// SetName can...

And if I might recommend?

// SetName may be used to explicitly assign a name to the network device
// as it exists in the guest operating system.

@akutz
Copy link
Contributor

akutz commented Dec 24, 2019

Hi @MnrGreg,

I'm placing a hold on this until you have a chance to respond to the suggestion re: DeviceName. Even GuestDeviceName is appropriate IMO. I think both provide a nicer UX than SetName inside of the NetworkDeviceSpec.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 24, 2019
@akutz
Copy link
Contributor

akutz commented Dec 24, 2019

/hold cancel

Looks good to me. Please ping me when it passes the CRD check, and I’ll lgtm it. I’d do so now, but it will just get removed when you rebase.

Also, I will cherry pick this (or you can) over to Master once this merges.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 24, 2019
@akutz
Copy link
Contributor

akutz commented Dec 24, 2019

/lgtm
/approve

Thank you again! Once this merges I or you can cherry pick this to master.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 24, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akutz, MnrGreg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 24, 2019
@k8s-ci-robot k8s-ci-robot merged commit d7f1a21 into kubernetes-sigs:release-0.5 Dec 24, 2019
@MnrGreg MnrGreg deleted the using_cloudinit_set-name branch December 30, 2019 22:51
jayunit100 pushed a commit to jayunit100/cluster-api-provider-vsphere that referenced this pull request Feb 26, 2020
The pointers were not working as expected so the API is changing
to be more functional and leverage kubernetes' DeepCopy function.
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. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

4 participants