Skip to content

feat: add OSSKU-based IsCgroupV2 detection and CustomizedImageTrustedLaunch distro#8252

Open
aadhar-agarwal wants to merge 1 commit intomainfrom
aadagarwal/cgroupv2-byoi
Open

feat: add OSSKU-based IsCgroupV2 detection and CustomizedImageTrustedLaunch distro#8252
aadhar-agarwal wants to merge 1 commit intomainfrom
aadagarwal/cgroupv2-byoi

Conversation

@aadhar-agarwal
Copy link
Copy Markdown
Contributor

@aadhar-agarwal aadhar-agarwal commented Apr 8, 2026

What this PR does:
Fixes cgroupv2 detection for BYOI scenarios and adds the CustomizedImageTrustedLaunch distro.

Changes:

  • IsCgroupV2: Add explicit config.OSSKU == OSSKUAzureLinux check and switch Flatcar/ACL detection from profile.Is*() (distro-based, always false for customized images) to config.Is*() (OSSKU-based)
  • Add unit tests for cgroupv2 detection
  • CustomizedImageTrustedLaunch: New distro constant

Why do we need it:

  • BYOI nodes using AzureLinux/Flatcar/ACL images were not getting NEEDS_CGROUPV2=true because the distro-level helpers return false for customized images

  • Adding CustomizedImageTrustedLaunch as a distro avoids needing separate customized image distro constants for an OS variant to support trusted launch. (for eg. CustomizedImageACL)

    • This is a similar change to adding support for CustomizedImageLinuxGuard (in AgentBaker and aks-rp)

Which issue(s) this PR fixes:
Fixes #7999

Testing:

Copilot AI review requested due to automatic review settings April 8, 2026 22:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes IsCgroupV2 template detection for BYOI/customized-image scenarios by switching Flatcar/ACL checks to OSSKU-based helpers and explicitly handling AzureLinux OSSKU, and it introduces a new CustomizedImageTrustedLaunch distro to represent trusted-launch customized images without proliferating per-OS custom distro constants.

Changes:

  • Update IsCgroupV2 to use config.IsFlatcar() / config.IsACL() (OSSKU-aware) and add an explicit OSSKUAzureLinux check.
  • Add CustomizedImageTrustedLaunch distro and treat it as a “custom image” in bootstrapping flows.
  • Add unit tests covering cgroupv2 detection for customized images and bootstrapping behavior for the new distro.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/agent/datamodel/types.go Adds the CustomizedImageTrustedLaunch distro constant.
pkg/agent/bakerapi.go Treats CustomizedImageTrustedLaunch like other customized images (bypasses SIG/PIR image lookup).
pkg/agent/bakerapi_test.go Adds coverage ensuring bootstrapping doesn’t error for CustomizedImageTrustedLaunch.
pkg/agent/baker.go Updates IsCgroupV2 to be OSSKU-aware for AzureLinux/Flatcar/ACL; includes new distro in IsCustomImage.
pkg/agent/baker_test.go Adds tests asserting NEEDS_CGROUPV2=true for customized-image + OSSKU combinations.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

profile.Distro == datamodel.CustomizedImageKata ||
profile.Distro == datamodel.CustomizedImageLinuxGuard
profile.Distro == datamodel.CustomizedImageLinuxGuard ||
profile.Distro == datamodel.CustomizedImageTrustedLaunch
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why is TrustedLaunch considered a customImage ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

CustomizedImageTrustedLaunch doesn't mean TrustedLaunch itself is a custom image - It is a custom image that supports trusted launch.

This follows the same pattern as CustomizedImageLinuxGuard (AgentBaker PR #6619 + aks-rp PR). The distro constant is needed so aks-rp can set it for BYOI + TrustedLaunch nodes.

@djsly
Copy link
Copy Markdown
Collaborator

djsly commented Apr 10, 2026

In all honesty, I understand that I'm asking for a major refactor, but the only cgroupv1 we support today is 2004Fips, which we will soon stop offering

I would rather not see NEEDS_CGROUPV2, and instead have a single REQUIRE_CGROUPV1_STILL...

…Launch distro

Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
@aadhar-agarwal
Copy link
Copy Markdown
Contributor Author

In all honesty, I understand that I'm asking for a major refactor, but the only cgroupv1 we support today is 2004Fips, which we will soon stop offering

I would rather not see NEEDS_CGROUPV2, and instead have a single REQUIRE_CGROUPV1_STILL...

Let me look into the cgroupv2 -> cgroupv1 inversion separately as that might change a lot of logic. I'll open a separate PR for that to keep this one scoped to the BYOI fix. Does that sound good?

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.

IsCgroupV2 template function uses profile-only detection, missing CustomizedImage + OSSKU scenarios

4 participants