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

Build Azure images with Packer #341

Closed
5 tasks done
mudler opened this issue Jun 29, 2021 · 13 comments
Closed
5 tasks done

Build Azure images with Packer #341

mudler opened this issue Jun 29, 2021 · 13 comments
Assignees
Labels
kind/enhancement New feature or request

Comments

@mudler
Copy link
Contributor

mudler commented Jun 29, 2021

This card is about having a packer template for Azure by using an image created by #235

Additional context
Part of #208

Requirements

@mudler mudler added the kind/enhancement New feature or request label Jun 29, 2021
@mudler mudler self-assigned this Jun 29, 2021
@mudler mudler removed their assignment Jun 29, 2021
@Itxaka Itxaka self-assigned this Jun 29, 2021
@Itxaka
Copy link
Contributor

Itxaka commented Jun 29, 2021

Blocked until we can get API keys for the client, our accounts are just not valid to access directly

@Itxaka Itxaka added the status/blocked Issue depends on another one label Jun 29, 2021
@Itxaka Itxaka removed the status/blocked Issue depends on another one label Jul 14, 2021
@Itxaka
Copy link
Contributor

Itxaka commented Jul 14, 2021

Api keys obtained.

We cannot currently build azure images because we are missing the user-data input from linuxkit as its stuck upstream in limbo linuxkit/linuxkit#3585

Currently booting manually works, executing the user-data manually also seems to work, so once we fix that metadata issue, we should be able to automate the packer templates.

I will send a draft PR

Note: We may have issues with the custom_data VS user_data. Packer currently supports custom_data ONLY. So we may need to send a patch upstream to support user_data as well in the packer builder if we cannot use the custom_data properly.

@Itxaka
Copy link
Contributor

Itxaka commented Jul 14, 2021

Draft PR: #412

@Itxaka Itxaka added the status/blocked Issue depends on another one label Jul 14, 2021
@Itxaka
Copy link
Contributor

Itxaka commented Jul 14, 2021

Blocked due to user-data: #355

@Itxaka
Copy link
Contributor

Itxaka commented Jul 14, 2021

Thanks to @davidcassany yip has now support for the azure metadata. Tested and the metadata ends up in the proper place.

Unfortunately packer does not support user data only custom data which is passed during provisioning and requires cloud-init or waagent to process....¬_¬

Seems like an issue + PR is required to the https://github.com/hashicorp/packer-plugin-azure repo to support using user-data 😩

@Itxaka
Copy link
Contributor

Itxaka commented Jul 14, 2021

yikes, seems like upstream azure-sdk did not support userdata until....01/03/2021 -> https://github.com/Azure/azure-sdk-for-go/blob/main/services/compute/mgmt/2021-03-01/compute/models.go

The api packer is using is currently....2018-04-01

Like its gonna be a hard sell to send an update upstream for this...

@Itxaka
Copy link
Contributor

Itxaka commented Jul 14, 2021

Looks like its easy to implement actually :O will send a patch upstream to support user_data and see what they think about

@Itxaka
Copy link
Contributor

Itxaka commented Jul 14, 2021

opened hashicorp/packer-plugin-azure#122 and sent hashicorp/packer-plugin-azure#121

tested locally with that patch and it works as expected :o

@Itxaka
Copy link
Contributor

Itxaka commented Jul 15, 2021

Templates are ready and pushed. They work, I have build and image based of the vanilla image. Unfortunately I dont think images are shareable so derivatives will need to upload their own vanilla image and then build from there. We could also make the bucket where we store the images publicy accessible so they can create recovery images from there but I dunno, something to discuss.

There is this shared image gallery but I have no idea how that works anyway :D

#412 missing the docs

@mudler mudler added status/blocked Issue depends on another one and removed status/blocked Issue depends on another one labels Jul 19, 2021
@mudler
Copy link
Contributor Author

mudler commented Jul 26, 2021

I've pinged upstream maintainers here hashicorp/packer-plugin-azure#123 (comment). let's see what happens

@mudler mudler self-assigned this Jul 27, 2021
@mudler
Copy link
Contributor Author

mudler commented Jul 28, 2021

Follow up opened hashicorp/packer-plugin-azure#131

@mudler
Copy link
Contributor Author

mudler commented Jul 29, 2021

Azure docs seems quite confusing in this regard, here I read that Images in the shared gallery should be generalized first: https://docs.microsoft.com/en-us/azure/virtual-machines/shared-image-galleries#generalized-and-specialized-images which seems to involve waagent. But here instead https://docs.microsoft.com/en-us/azure/virtual-machines/generalize seems generalization is not required, if it's not required, should be just a matter of running

az vm generalize \
   --resource-group myResourceGroup \
   --name myVM

There are also other docs at https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/virtual-machines/windows/capture-image-resource.md to turn a generalized image into a managed one, which seems to be required in order to have that published in the shared gallery

@mudler
Copy link
Contributor Author

mudler commented Jul 29, 2021

Opened #341 to dig into the shared image gallery as a separate story

@mudler mudler removed the status/blocked Issue depends on another one label Jul 29, 2021
@mudler mudler closed this as completed Aug 3, 2021
frelon pushed a commit to frelon/elemental-toolkit that referenced this issue May 12, 2023
* Align install, reset and upgrade hooks
* Set upgrade hooks constants

Signed-off-by: David Cassany <dcassany@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants