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

fix: build cvm on cvm hardware #5643

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open

Conversation

zachary-bailey
Copy link
Collaborator

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR changes the build process to use CVM hardware for CVM image builds. This will allow the use of apt-get dist-upgrade in the install scripts, resulting in the ability to install newer kernel versions.

Which issue(s) this PR fixes:

This will fix the CVEs that are currently unmitigated for CVM nodepools.

Requirements:

@@ -111,6 +116,7 @@ if [ -z "${VNET_NAME}" ]; then
fi
fi


Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: extra line

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the call out!

@@ -75,6 +75,10 @@ if [ "${OS_TYPE}" == "Linux" ] && [ "${ENABLE_TRUSTED_LAUNCH}" == "True" ]; then
TARGET_COMMAND_STRING+="--security-type TrustedLaunch --enable-secure-boot true --enable-vtpm true"
fi

if [ "${OS_TYPE}" == "Linux" ] && [ ${IMG_SKU} == "20_04-lts-cvm" ]; then
TARGET_COMMAND_STRING="--size Standard_DC8ads_v5 --security-type ConfidentialVM --enable-secure-boot true --enable-vtpm true --os-disk-security-encryption-type VMGuestStateOnly --specialized true"
Copy link
Collaborator

Choose a reason for hiding this comment

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

+=?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I made it +=, it would still have the VM size from standard images in the string, so I had to make it re write the whole string.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question. What should the size be if arch==arm64 and OS_TYPE== Linux and img_sku=2004? Now it will be set to Standard_DC8ads_v5. Is this expected?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If I made it +=, it would still have the VM size from standard images in the string, so I had to make it re write the whole string.

but will you not miss the FIPS setting if it's = ? For example --security-type TrustedLaunch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This condition will only be met if ${IMG_SKU} == "20_04-lts-cvm"

"20_04-lts-cvm" is the IMG_SKU only for CVM, not for 2004 or FIPs in general.

For example the IMG_SKU for 2004fipscontainerd is 20_04-lts. They are all unique per SKU. So this can only execute on our CVM image.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. So you are saying actually "${ENABLE_TRUSTED_LAUNCH}" == "True" is equivalent to ${IMG_SKU}==20_04-lts, right? If that's the case, please leave some comments to explain this. Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ENABLE_TRUSTED_LAUNCH is a boolean feature flag assigned to some of our images, some of which are Ubuntu and some of which are Mariner/AZLinux. The feature flag alerts Packer that these Packer VMs need to have the TrustedLaunch feature enabled because they need TPM measurement files to run.

So, the above conditional on line 70 checks to see if the --security-type TrustedLaunch --enable-secure-boot true --enable-vtpm true flags need to be appended to the command string to enable the VMs successful provisioning. It is unrelated to CVM, though.

@@ -63,6 +63,10 @@ if [[ "${OS_TYPE}" == "Linux" && "${ENABLE_TRUSTED_LAUNCH}" == "True" ]]; then
VM_OPTIONS+=" --security-type TrustedLaunch --enable-secure-boot true --enable-vtpm true"
fi

if [ "${OS_TYPE}" == "Linux" ] && [ ${IMG_SKU} == "20_04-lts-cvm" ]; then
VM_OPTIONS="--size Standard_DC8ads_v5 --security-type ConfidentialVM --enable-secure-boot true --enable-vtpm true --os-disk-security-encryption-type VMGuestStateOnly --specialized true"
Copy link
Collaborator

@Devinwong Devinwong Jan 24, 2025

Choose a reason for hiding this comment

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

what about if [[ "${ARCHITECTURE,,}" == "arm64" ]] but it also meets this if condition? Should the size be Standard_D8pds_v5 or Standard_DC8ads_v5?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We do not have any ARM64 CVMs. Just the one AMD image.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. Could you please leave a comment for the reason so other people know this is intended? Thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done! @Devinwong

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.

4 participants