cluster-api-provider-vsphere icon indicating copy to clipboard operation
cluster-api-provider-vsphere copied to clipboard

:sparkles: Allow using moid

Open rikatz opened this issue 1 year ago • 11 comments
trafficstars

What this PR does / why we need it: Allow users passing MOID as part of the spec

In some cases, passing the name of an object may not be enough. There may be disambiguation problems on name usage, or special characters that are accepted by vSphere but not properly encoded to be used during VM provisioning.

This change allows users that can rely on passing MOID (eg.: automation, terraform, vSphere UI) to pass the MOID of an object instead of passing the canonical name

Note: This change doesn't cover yet Network Name and the Failure Domain fields, that can be either covered by this same change, or on a follow up PR.

rikatz avatar Oct 21 '24 19:10 rikatz

/test help

chrischdi avatar Oct 22 '24 06:10 chrischdi

@chrischdi: The specified target(s) for /test were not found. The following commands are available to trigger required jobs:

  • /test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main
  • /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main
  • /test pull-cluster-api-provider-vsphere-test-main
  • /test pull-cluster-api-provider-vsphere-verify-main

The following commands are available to trigger optional jobs:

  • /test pull-cluster-api-provider-vsphere-apidiff-main

Use /test all to run the following jobs that were automatically triggered:

  • pull-cluster-api-provider-vsphere-apidiff-main
  • pull-cluster-api-provider-vsphere-test-main
  • pull-cluster-api-provider-vsphere-verify-main

In response to this:

/test help

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-sigs/prow repository.

k8s-ci-robot avatar Oct 22 '24 06:10 k8s-ci-robot

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

chrischdi avatar Oct 22 '24 06:10 chrischdi

/cc @lubronzhan

neolit123 avatar Oct 22 '24 07:10 neolit123

/retest

chrischdi avatar Oct 22 '24 07:10 chrischdi

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

chrischdi avatar Oct 22 '24 19:10 chrischdi

I will add the api docs as well, didn't finished taking care of all the comments yet :)

rikatz avatar Oct 22 '24 20:10 rikatz

I will try to get to this PR soon, but currently trying to finish some work in CAPI first; in the meantime it will be great if we can add an E2E test to this PR.

e.g. we can take this E2E test, duplicate it, write code that resolve names in env vars into Moid, then sets env vars with the Moid so the test will use them

fabriziopandini avatar Oct 23 '24 13:10 fabriziopandini

sorry folks, last 2 days were really busy. I will come back to this tomorrow as my first task :)

rikatz avatar Oct 23 '24 18:10 rikatz

https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/pull/3235

will rebase over this one for the logging comments.

Then add some e2e tests as proposed by Fabrizio

rikatz avatar Oct 24 '24 13:10 rikatz

@fabriziopandini just an update. Setting the e2e here is showing to be harder than I though, because in "theory" my e2e suite cannot access vcsim, which is running as a Pod on my cluster.

I am not sure we are expecting this to be possible or not, but in this case I will need to, instead of making my e2e test go to vcsim and get the MOIDs, make the vcsim envvar controller to add on its status the moid instead of the name.

wdyt? Which one should I follow?

rikatz avatar Oct 28 '24 19:10 rikatz

~hum, weird this error, it passes locally. Will have to check the issue~

ra, running the file test errors, maybe I am using some global that is nullified after it, should check tomorrow

rikatz avatar Oct 29 '24 02:10 rikatz

ok was able to fix e2e 🥳

Now just need to check the issue on unit test and we are good to go

rikatz avatar Oct 29 '24 17:10 rikatz

/hold

I want to wait for https://github.com/vmware/govmomi/pull/3609 to be merged and a new release made, so instead we can bump govmomi here and rely on the new behavior of being able to search by name or moid directly from the library

rikatz avatar Nov 05 '24 12:11 rikatz

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

rikatz avatar Nov 06 '24 14:11 rikatz

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

rikatz avatar Nov 06 '24 16:11 rikatz

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

rikatz avatar Nov 06 '24 18:11 rikatz

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

/hold cancel

rikatz avatar Nov 07 '24 13:11 rikatz

This is validated on my tests, works fine :)

@sbueringer @fabriziopandini @chrischdi for final review :)

Thanks!

rikatz avatar Nov 07 '24 14:11 rikatz

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

rikatz avatar Nov 07 '24 23:11 rikatz

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

rikatz avatar Nov 07 '24 23:11 rikatz

/test pull-cluster-api-provider-vsphere-e2e-vcsim-govmomi-main /test pull-cluster-api-provider-vsphere-e2e-vcsim-supervisor-main

rikatz avatar Nov 12 '24 18:11 rikatz

Thank you very much!!

Feel free to merge once tests are green

/lgtm /approve /hold

sbueringer avatar Nov 12 '24 18:11 sbueringer

LGTM label has been added.

Git tree hash: e1d5181ace36378d168c423d67fad302276b36f4

k8s-ci-robot avatar Nov 12 '24 18:11 k8s-ci-robot

[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 avatar Nov 12 '24 18:11 k8s-ci-robot

All tests passing, removing hold

Thanks all /hold cancel

rikatz avatar Nov 12 '24 19:11 rikatz