-
Notifications
You must be signed in to change notification settings - Fork 401
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
Add support for Confidential VM images #1148
Conversation
61f8eb6
to
32cd7a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool! Couple thoughts:
- Are there VHD targets for Confidential VMs?
- We might need to add something like
image-builder/images/capi/scripts/ci-azure-e2e.sh
Lines 40 to 46 in 9b101ee
IFS=' ' read -r -a SIG_GEN2_CI_TARGETS <<< "${SIG_GEN2_CI_TARGETS}" # Append the "gen2" targets to the original SIG list for element in "${SIG_GEN2_CI_TARGETS[@]}" do SIG_CI_TARGETS+=("${element}-gen2") done
@jsturtevant thank you for your time and review!
I tried to create a VHD from the CVM images with the current Build 'azure-arm.vhd-{{user `build_name`}}' errored after 13 minutes 2 seconds: Code="DeploymentFailed" Message="At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details." D
etails=[{"code":"Conflict","message":"{\r\n \"error\": {\r\n \"code\": \"OperationNotAllowed\",\r\n \"message\": \"The specified platform image is not supported for creating a Virtual Machine with unmanaged disks. Please refer to the disallowed VM disk types at https://docs.mi
crosoft.com/en-us/rest/api/compute/virtualmachineimages/get#vmdisktypes. \"\r\n }\r\n}"}] Then I tried looking into it and I'm not quire sure we can get VHD from a managed disk via My two cents would be that since VHDs are slowly getting deprecated, we could skip adding such targets for CVMs. But I am probably missing CAPI's current policy on VHDs and their usecases.
Great suggestion, I missed the e2e CI script altogether. I have tried to suggest a solution for the CI CVM targets, keeping in mind that CVM images are only available in 4 Azure locations currently (i.e. |
06a92e0
to
6be5267
Compare
Yes I generally think that is fine, though we don't have a good way to add an e2e test in capz with the sig images or maybe that has changed @CecileRobertMichon @mboersma? looks like your ubuntu CMM image is failing (windows passed): https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_image-builder/1148/pull-azure-sigs/1651961055783424000/artifacts/azure-sigs/ubuntu-2204-cvm.log:
|
Yes generally looks like a good way to handle it 👍 |
/test pull-azure-vhds |
@jsturtevant it seems that Since this doesn't seem to be an issue with Ubuntu 20.04 for CVMs, I would drop support for Ubuntu 22.04 for CVMs until there is either a packer update that supports setting |
Sounds reasonable to me. Could you create an issue in Packer to add that field and maybe an issue to track adding 2204 here? |
@jsturtevant I updated this PR's description with a I also opened this issue to make sure we track it properly. Do you maybe see any possible workarounds (or even the proper solution) that I'm probably missing altogether? Should we move forward without Ubuntu 22.04 LTS for CVMs for now, in order to enable this feature in CAPZ sooner? |
I think we can move forward with this and revisit when 22.04 becomes more adopted. Hopefully the bug is resolved by then. lgtm code wise. @mresvanis is it worth updating the book to point out CVM images and any caveats?
If we need e2e tests in capz we might need to figure this out @mboersma @nawazkh /assign @mboersma |
@jsturtevant thanks for pointing me to the docs, I added a small section to the book regarding CVM images. |
@jsturtevant the This workaround is not great, but it provides users with CAPZ Ubuntu images for confidential VMs. Do you think this is an acceptable workaround? |
/test pull-azure-vhds |
1 similar comment
/test pull-azure-vhds |
/test pull-ova-all |
I don't really know enough about that that is doing. Could you give a summary? |
Absolutely, the issue we face when building CAPZ images based on To resolve the issue, i.e. to have a successful
This is configured to only run for debian-based (i.e. Ubuntu) CVM images. What do you think? |
@mresvanis Thank you for the explanation, makes sense to me. Though I am not so well versed with image-builder flow, your approach sounds good to me. Few questions:
|
@nawazkh thank you for reviewing this change!
If I understand your question correctly, ideally we would just run the regular image-builder flow on top of specific CVM images without any additional changes to them. For example, exactly what this change adds for the Windows CVM images.
Very good point! I tried to think about how we could test the changes of CVM images. But since we are not doing anything more other than base the CAPI images to the Ubuntu and Windows CVM images, without any CVM specific configuration needed, we should be good to go. If we were to test/check for specific CVM image configuration, already included in those CVM base images, I believe there is no way (at least not at the time of this writing) to consistently test that the CVM images we are basing upon the CAPI CVM images, include everything that is needed, for them to be successfully used in CVM instances. We can only trust that the Ubuntu and Windows base CVM images have everything we need. IMHO the holding/unholding |
^ Thank you for the detailed explanation and answer @mresvanis. I am happy with the changes, explanation makes sense to me, and I would love to "lgtm" this PR. "looks good to me!" Delegating to @jsturtevant and @mboersma for their thoughts :) |
/test pull-ova-all |
/test pull-azure-vhds |
This should only be needed for the 22.04 LTS images, right? A few more questions about the workaround:
I'm wondering if we can get away with just skipping 22.04 until the issues have been resolved upstream. Thanks for your patience and help understanding all the nuances. |
@jsturtevant unfortunately, we have the same issue with Ubuntu 20.04 LTS as well. We saw the issue appearing in both distributions gradually, as the latest version of the
Azure CVMs won't boot unless their OS image adheres to specific requirements (which are not yet published, but I'm confident that vTPM PCR measurements are a hard requirement). The Ubuntu CVM images are specific to the Azure CVMs, so users would use them only on those supported VM sizes. These VM sizes require vTPM to be enabled, otherwise Azure just refuses to create them (there is no point in using a CVM if it cannot be attested to). If a user tries to create a CVM with a non-compliant OS images, then the VM just won't boot. When a user runs an
As described above, CVMs require vTPM to be enabled and these OS images are a hard requirement, in order to be able to boot those VMs (and after boot for users to be able to attest them).
That was my initial thought as well, but since the
Absolutely no worries, we have to be sure we're adding reliable and useful changes. In addition, CVMs are a quite recent field :) |
So the VM sizes we are using to build this images don't have the vTPM enabled? But we expect users to select VM sizes in Azure that do make sense when creating VMs from the images? Would we have this issue if the VM size we are building from has a vTPM? |
@jsturtevant thank you for digging in, great questions and those are exactly what I was also trying to figure out. Please let me know if the following makes sense:
Exactly. We can't have SecureBoot or vTPM enabled when creating a managed image.
That's correct. The CVM images target Azure Confidential VMs only, but currently we can't use such VMs to build the respective CAPZ managed images.
The VM size we are building from can have a vTPM, but not an enabled one (here is the error from the packer plugin). It is the combination of the following two issues that lead me to this implementation:
|
Thanks for unraveling that for me. I think I finally understand the various bugs :-) /lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
I'm sorry I didn't review this earlier! I've finally caught up–thank you for the detailed explanation of the complexities here.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mboersma, mresvanis 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 |
What this PR does / why we need it:
This PR adds support for Azure Confidential VM images. These images are necessary in order to enable the Cluster API Provider Azure support nodes hosted on Confidential VMs.
Which issue(s) this PR fixes (optional, in fixes #(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged): Fixes #1154
Additional context
Related CAPZ PR.
NOTE: Building a CAPI Ubuntu 22.04 CVM image from a VM instance with vTPM disabled fails due to this bug(?) in nullboot. At the same time, Azure (and thus also packer) does not support publishing trusted launch images to managed images (i.e. when
vTpmEnabled: true
, we can't publish a managed image, which is currently what we do now for all linux images). Because of this we are currently unable to build an CAPI Ubuntu 22.04 for CVM image.