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

⚠️ webhook: prevent changes to an already set VSphereVM.spec.biosUUID #2146

Conversation

chrischdi
Copy link
Member

What this PR does / why we need it:

This PR improves the validation for VSphereVM objects by adjusting the webhook to:

  • only allow changes to VSphereVM.spec.biosUUID if it is not already set
  • prevent updates which try to change the biosUUID.

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

Identified during discussions around #2102

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 3, 2023
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 3, 2023
@chrischdi chrischdi force-pushed the pr-vspherevm-biosuuid-webhook-change branch from 76478c5 to 16c421b Compare August 3, 2023 05:06
Copy link
Contributor

@zhanggbj zhanggbj left a comment

Choose a reason for hiding this comment

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

@chrischdi
Code change looks good to me, only got a question here, is there any possibility that user may need to update the biosUUID, for instance, after the VM is moved to another host maybe due to disaster recovery, and the VM will get a new biosUUID as described https://docs.vmware.com/en/VMware-Workstation-Pro/17/com.vmware.ws.using.doc/GUID-533B2C4F-7BD5-41EB-8392-2B9FE687AE50.html#GUID-533B2C4F-7BD5-41EB-8392-2B9FE687AE50

@sbueringer
Copy link
Member

@chrischdi Code change looks good to me, only got a question here, is there any possibility that user may need to update the biosUUID, for instance, after the VM is moved to another host maybe due to disaster recovery, and the VM will get a new biosUUID as described docs.vmware.com/en/VMware-Workstation-Pro/17/com.vmware.ws.using.doc/GUID-533B2C4F-7BD5-41EB-8392-2B9FE687AE50.html#GUID-533B2C4F-7BD5-41EB-8392-2B9FE687AE50

Good point. We were thinking that nobody should mess with this field when discussing it.

@randomvariable @srm09 @yastij ?

@chrischdi chrischdi force-pushed the pr-vspherevm-biosuuid-webhook-change branch from 16c421b to 6c9436b Compare August 3, 2023 07:51
@chrischdi
Copy link
Member Author

@chrischdi Code change looks good to me, only got a question here, is there any possibility that user may need to update the biosUUID, for instance, after the VM is moved to another host maybe due to disaster recovery, and the VM will get a new biosUUID as described docs.vmware.com/en/VMware-Workstation-Pro/17/com.vmware.ws.using.doc/GUID-533B2C4F-7BD5-41EB-8392-2B9FE687AE50.html#GUID-533B2C4F-7BD5-41EB-8392-2B9FE687AE50

Good point. We were thinking that nobody should mess with this field when discussing it.

@randomvariable @srm09 @yastij ?

The linked doc is for vmware workstation, which is not the target platform. Also it states

When you power on a virtual machine that was moved or copied to a new location, you are prompted to specify whether you moved or copied the virtual machine. If you indicate that you copied the virtual machine, the virtual machine receives a new UUID.

So this only applies if explicitly "copied" got selected.

However in the vCenter / esx case: Moving to another host does not change the UUID (otherwise e.g. vMotion would be broken). So from my perspective the uuid should not get changed, also not in disaster recovery (except if you have to recreate the vmx file, because the biosUUID is stored there).

/hold

To wait for other opinions on this.

@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 Aug 3, 2023
@sbueringer
Copy link
Member

sbueringer commented Aug 3, 2023

Thx for the additional context. Sounds fine to me

Probably good enough to for now play it safe and then potentially change the webhook if new use cases emerge (assuming we are not already aware of some)

@chrischdi chrischdi force-pushed the pr-vspherevm-biosuuid-webhook-change branch from 6c9436b to 5d20500 Compare August 3, 2023 11:12
@sbueringer
Copy link
Member

/lgtm
/approve

Let's keep the hold a bit for the discussion

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

LGTM label has been added.

Git tree hash: e0635c9509dd1de883fb145d891692b498db4241

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Aug 3, 2023
@randomvariable
Copy link
Member

For all intent purposes, a new UUID constitutes a new machine identity, and we should treat that as a new machine. I'm therefore OK with this change.

@randomvariable
Copy link
Member

/unhold

@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 Aug 3, 2023
@k8s-ci-robot k8s-ci-robot merged commit b80d1c1 into kubernetes-sigs:main Aug 3, 2023
4 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.8 milestone Aug 3, 2023
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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants