Preview flag for unsupported distro versions#756
Conversation
Add a preview feature flag that enables customizing unsupported distro versions. So, instead of: - `ubuntu-22.04` - `ubuntu-24.04` - `fedora-42` We now have: - `ubuntu` - `fedora` - `unsupported-distro-version` The `unsupported-distro-version` flag will allow customizing any unsupported distro version for any supported distro. This will allow users to customize new distro versions without needing to wait for official support from IC. To facilitate this, this change change modifies `TargetOs` from an enum to a struct. This will allow more complex logic to be applied against `TargetOs`. For example, checking if the target version is greater or less than a supported version.
| - `ubuntu-24.04`: Enables support for customizing Ubuntu 24.04 images using the [customize subcommand](../cli/customize.md). | ||
|
|
||
| Added in v1.2. | ||
| Added in v1.5. |
There was a problem hiding this comment.
azure-container-linux and unsupported-distro-version are missing from this list.
|
|
||
| // PreviewFeatureAzureContainerLinux3 enables support for Azure Container Linux 3 images. | ||
| PreviewFeatureAzureContainerLinux3 PreviewFeature = "azure-container-linux-3" | ||
| // PreviewFeatureAzureContainerLinux3 enables support for Azure Container Linux images. |
There was a problem hiding this comment.
Variable name needs updating in comment.
| // PreviewFeatureAzureContainerLinux3 enables support for Azure Container Linux images. | ||
| PreviewFeatureAzureContainerLinux PreviewFeature = "azure-container-linux" | ||
|
|
||
| // PreviewFeatureDistroVersion allows distro versions that are not supported yet. |
There was a problem hiding this comment.
Variable name needs updating in comment.
| Xfs: azl4XfsOptions, | ||
| BootXfs: azl4BootXfsOptions, | ||
| // Note: Distro versions must be in order from oldest to newest. | ||
| distroFileSystemsOptions = map[targetos.Distro][]versionFileSystemsOptions{ |
There was a problem hiding this comment.
If oldest -> newest is strictly necessary, should we validate it with an init()?
| BootXfs: fedora42XfsOptions, | ||
| }, | ||
| }, | ||
| }, |
There was a problem hiding this comment.
note: AzureContainerLinux is missing from this map. you could just add the azl3 fs options for now. @liulanze FYI
| case string(distroNameAzureLinux): | ||
| if version == "4.0" { | ||
| return newAzureLinux4DistroHandler() | ||
| default: |
There was a problem hiding this comment.
With unsupported-distro-version enabled, an AzureLinux image with VersionId other than 4.0 (e.g. 5.0) silently falls through to the distrohandler for 2.0/3.0. We should probably pick the newest known handler here, unlike in the filesystem options code, where it makes more sense to be conservative when enabling new features.
| APIs marked as **Preview** require the distribution's | ||
| [previewFeatures](./configuration/config.md#previewfeatures-string) value to be set | ||
| (e.g. `ubuntu-22.04`, `ubuntu-24.04`, `azure-container-linux-3`). | ||
| (e.g. `ubuntu`, `azure-container-linux`). |
There was a problem hiding this comment.
Worth listing unsupported-distro-version here too, since it's the flag a user will reach for when this page tells them their distro version isn't supported.
| testBaseImageAzl4CoreEfi, | ||
| testBaseImageAzl3CoreEfi, | ||
| testBaseImageAzl3BareMetal, | ||
| testBaseImageAzl4CoreEfi, |
There was a problem hiding this comment.
This change is worth a comment in the PR description or here in the code.
| // Supported versions | ||
|
|
||
| default: | ||
| err := handleUnsupportedDistroVersion(rc, d.targetOs) |
There was a problem hiding this comment.
I don't think this would throw an accurate error. azl4 would map to a different distro handler entirely, and doens't need the unsupported distro version preview feature, since it has its own distro handler.
| // Supported versions | ||
|
|
||
| default: | ||
| err := handleUnsupportedDistroVersion(rc, d.targetOs) |
There was a problem hiding this comment.
I'm not sure this error message is accurate either, since this distrohandler only maps from one combination of distro and version
Add a preview feature flag that enables customizing unsupported distro versions.
So, instead of:
ubuntu-22.04ubuntu-24.04fedora-42We now have:
ubuntufedoraunsupported-distro-versionThe
unsupported-distro-versionflag will allow customizing any unsupported distro version for any supported distro. This will allow users to customize new distro versions without needing to wait for official support from IC.To facilitate this, this change change modifies
TargetOsfrom an enum to a struct. This will allow more complex logic to be applied againstTargetOs. For example, checking if the target version is greater or less than a supported version.Checklist