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

added vmware metadata provider, closes #3507 #3526

Merged
merged 1 commit into from
Mar 4, 2023
Merged

Conversation

brlbil
Copy link
Contributor

@brlbil brlbil commented May 15, 2020

cloud-init data from vmware guest info as it described in the link below
https://github.com/vmware/cloud-init-vmware-guestinfo

closes #3507

- What I did
Implemented a vmware metadata provider that leverages vmware guest info
- How I did it
Implemented Provider interface. Added provider_vmware file and added vmware to cdrom providers in main.go
- How to verify it
Guest info can be set for a vm using govc tool and can be tested in that vm as described.
https://github.com/vmware/cloud-init-vmware-guestinfo
- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Copy link
Member

@rn rn left a comment

Choose a reason for hiding this comment

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

A few nits, but you'd also need to add a signed-off-by line to the commit. See https://github.com/linuxkit/linuxkit/blob/master/CONTRIBUTING.md#sign-your-work

pkg/metadata/main.go Show resolved Hide resolved
pkg/metadata/provider_vmware.go Outdated Show resolved Hide resolved
@brlbil brlbil requested a review from rn January 6, 2021 23:59
@brlbil
Copy link
Contributor Author

brlbil commented Feb 5, 2021

I know it took a lot of time to fix missing bits and pieces. It seems all the checks are passing now, so can we merge this now?
@rn

@brlbil
Copy link
Contributor Author

brlbil commented Feb 15, 2021

I know everyone is busy and it is not realistic to expect things always go fast for opensource projects.
But I would like to see this included in k3os asap. So can anyone take a look at the PR and get it rolling, please?

@voima-eetu
Copy link

I know everyone is busy and it is not realistic to expect things always go fast for opensource projects.
But I would like to see this included in k3os asap. So can anyone take a look at the PR and get it rolling, please?

A bit off-topic; I built k3os image with this your merge request and deployed it to VMware virtual datacenter using vcloud director, so thanks for this patch!

But for some reason my k3os installation on latest version of VMware cloud director wasn't able to read 'vmware' provider. On boot K3OS wasn't able to read guest-properties that I had added('guestinfo.user-data') and gave me just message "No metadata/userdata found. Bye".

Have you got this provider working? If yes, with what platform and which guest-properties?

@brlbil
Copy link
Contributor Author

brlbil commented Feb 16, 2021

As you said I am sure we should discuss these issues here either. I think the problem is key should be set as guestinfo.userdata not guestinfo.user-data

@edvinerikson
Copy link
Contributor

What's blocking this to be merged?


// Probe checks if we are running on VMware
func (p *ProviderVMware) Probe() bool {
c, err := exec.LookPath("vmware-rpctool")
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this really be available if built with linuxkit? Wouldn't this tool only be available in the open-vm-tools image?

Choose a reason for hiding this comment

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

It will be available if open-vm-tools is intalled, which is sort of a requirement if you want to make RPC calls through VMCI to get guestinfo data.... I dont understand what is being requested.

This mirrors the functionality of vmware's cloud-init https://github.com/vmware/cloud-init-vmware-guestinfo/blob/master/DataSourceVMwareGuestInfo.py which functions the same way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since edvinerikson has brought it up I had checked if it would be possible not to use the command-line tool and use a library instead. It is possible to use this library. But this pull request has been idle for so long I am not sure maintainers have any interest in accepting it. I do not want to work on it if it is not going to be ignored.

Choose a reason for hiding this comment

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

I made a small PR to your source branch, as an example, with the said library 8 days ago: brlbil#1
This would give you the possibility of removing the vmware-rpctool

@thehedgefrog
Copy link

Any updates to this?

@observ3r
Copy link

observ3r commented Oct 25, 2021

Also looking for an update on this. Any thoughts? @rn

@chris93111
Copy link

Any updates to this?

@observ3r
Copy link

observ3r commented Feb 2, 2022

Hello @rn - could you review/approve this?

@observ3r
Copy link

observ3r commented Mar 9, 2022

@deitch Could you take a look at this?

@deitch
Copy link
Collaborator

deitch commented Mar 10, 2022

This looks pretty good, and you did address @rn's comments.

The only questions I have are:

  1. Can you get @robertkaelin 's proposed changes here in, so that you do not have the dependency on vmware-rpctool? That would also mean documenting it, showing how to ensure it is available, etc. etc. His library solution is much better.
  2. Is there any way to add a test for this? We only have a test for metadata on a CD here, so I can hardly be a stickler for it, but if it is possible, it would be good.

@deitch
Copy link
Collaborator

deitch commented Mar 10, 2022

Completely separately, I see several people interested here. How are you using this (linuxkit in general)?

@brlbil
Copy link
Contributor Author

brlbil commented Mar 10, 2022

@deitch originally I open this PR because linuxkit's metadata package is used in k3os

When it comes to your questions,

  1. Changes suggested by @robertkaelin make sense I can add them. In fact, we have been running a forked version of the metadata package with these changes for some time now.
  2. If we do the changes to use the VMware library then I do not know how can we add tests for it. It is meant to be run in a VMware virtual env. If it is run any other env it panics.

Since there is an interest I will make the changes and push them.

@deitch
Copy link
Collaborator

deitch commented Mar 10, 2022

Go for it.

And when done, please squash all of your commits.

@thehedgefrog
Copy link

Completely separately, I see several people interested here. How are you using this (linuxkit in general)?

I'm using K3os in a homelab environment. I deploy Packer images with Terraform, so the quick and easy way is to use the provider.

My current workaround is to use the File provisioner to write a config file at deployment, that K3os then loads to configure. This however does not leverage the capabilities of cloud-init.

@brlbil
Copy link
Contributor Author

brlbil commented Mar 11, 2022

I do not have access to a vcenter currently, so I will test the latest changes next week just to make sure everything works as expected.

@brlbil
Copy link
Contributor Author

brlbil commented Mar 15, 2022

@deitch I have tested the package on a VMWare VM, and it works as expected.
Also, rebase and squash my commits as requested.

deitch
deitch previously approved these changes Mar 21, 2022
Copy link
Collaborator

@deitch deitch left a comment

Choose a reason for hiding this comment

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

LGTM

@deitch
Copy link
Collaborator

deitch commented Mar 21, 2022

Looks fine to me. Let CI go green and we can merge in.

@deitch
Copy link
Collaborator

deitch commented Mar 21, 2022

I just remembered, we need to build and push out the updated images, then run the script.

scripts/update-components-sha.sh --image $(linuxkit package show-tag pkg/metadata)

That can be a separate commit.

Either way, though, CI is failing. Can you see what is causing it?

@KittyKatt
Copy link

@brlbil Any update on this? Really looking forward to configure k3os on vSphere without having to keep open a fork of linuxkit and build it every time I want a new ISO.

@brlbil
Copy link
Contributor Author

brlbil commented May 9, 2022

@KittyKatt Unfortunately, I do not have any spare time to track the error that the pipeline throws. I have to do this on my own time. If anyone can help to track the error in the pipeline I would appreciate it.

@observ3r
Copy link

Appears the logs have expired for the Action that failed. Could it be re-run?

@observ3r
Copy link

@brlbil @deitch I don't have permission to rerun looks like. Could someone rerun it to generate the logs of the failed job?

@brlbil
Copy link
Contributor Author

brlbil commented Jul 25, 2022

@observ3r I cannot run them either.

@KittyKatt
Copy link

@KittyKatt Unfortunately, I do not have any spare time to track the error that the pipeline throws. I have to do this on my own time. If anyone can help to track the error in the pipeline I would appreciate it.

I tried looking into the errors when it was available and correcting/building locally, but unfortunately I am not anywhere near an expert in Go and couldn't make heads nor tails of it. Sorry!

@observ3r
Copy link

Hey @deitch , are you able to rerun it?

@deitch
Copy link
Collaborator

deitch commented Nov 30, 2022

The rerun button isn't there. 🤷‍♂️

Might as well rebase it to get the parallelization we did for actions (runs much more quickly), and push it out, which will cause CI to kick off again anyways.

@observ3r
Copy link

observ3r commented Dec 7, 2022

Oh awesome, lookin good! I suppose just waiting on @rn at this point?

@observ3r
Copy link

observ3r commented Mar 2, 2023

@brlbil Wanna rebase it? I don't think I can

@brlbil
Copy link
Contributor Author

brlbil commented Mar 3, 2023

@observ3r @deitch I rebased, but I think the workflow requires approval

deitch
deitch previously approved these changes Mar 3, 2023
@deitch
Copy link
Collaborator

deitch commented Mar 3, 2023

Looks like something relating to the added packages failed? Maybe a go mod tidy followed by a go mod vendor? 🤷‍♂️

@brlbil
Copy link
Contributor Author

brlbil commented Mar 3, 2023

I think I see what is going on. The github.com/vmware/vmw-guestinfo package does not support arm64 so it fails to build. We can open an issue upstream to add support for it.

@deitch how to best avoid including VMware metadata in some of the architectures? I am pretty sure VMWare-tools is not supported on all the architectures that linuxkit is supporting like the arm.

@deitch
Copy link
Collaborator

deitch commented Mar 3, 2023

Really? No arm64 support? That is surprising.

Do a dedicated file like provider_vmware_amd64.go and provider_vmware_unsupported.go, use //build directives at each, one for all other arch unsupported, one for amd64; for the amd64, return a valid struct, for all others, return nil, and add an if == nil check before adding it.

@brlbil
Copy link
Contributor Author

brlbil commented Mar 3, 2023

Opened an issue for adding support for arm64 vmware-archive/vmw-guestinfo#25

@deitch I think we should proceed without arm64 support added. I have a feeling it would take a long time for it would be added upstream. If it is added then we can add support here as well. What do you think?

@deitch
Copy link
Collaborator

deitch commented Mar 3, 2023

Agreed. Just do the build directives based on the suggestion above.

@brlbil
Copy link
Contributor Author

brlbil commented Mar 3, 2023

@deitch ci passed on my fork, needs your touch here.

cloud-init data from vmware guest info as it described in the link below
https://github.com/vmware/cloud-init-vmware-guestinfo

Signed-off-by: Birol Bilgin <birolbilgin@gmail.com>
@brlbil
Copy link
Contributor Author

brlbil commented Mar 4, 2023

I fixed if check, the provider was added to the list when it is nil.

@deitch deitch merged commit d4a8e28 into linuxkit:master Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: add vmware/cloud-init as a metadata provider