Skip to content

[GEP-33] Add Capability support - #206

Open
aniruddha2000 wants to merge 7 commits into
mainfrom
add-capability
Open

[GEP-33] Add Capability support#206
aniruddha2000 wants to merge 7 commits into
mainfrom
add-capability

Conversation

@aniruddha2000

Copy link
Copy Markdown
Member

How to categorize this PR?

/kind api-change
/kind enhancement

What this PR does / why we need it:

This PR is part of GEP-33 Machine Image Capabilities

It adopts the introduced Cloud Profile Capabilities from Gardener. It offers a mechanism to define a relationships between MachineTypes and MachineImages to ensure only compatible amis are selected for a given MachineType. An example for a Capability is the CPU architecture that is added as the first mandatory Capability. The existing architecture field is planned to be removed eventually.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Breaking changes:

@ske-prow

ske-prow Bot commented Jul 9, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ske-prow ske-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change API change with impact on API users kind/enhancement Enhancement, improvement, extension labels Jul 9, 2026
@ske-prow

ske-prow Bot commented Jul 9, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nschad for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ske-prow ske-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 9, 2026
@ske-prow ske-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 13, 2026
@ske-prow ske-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 22, 2026
@aniruddha2000
aniruddha2000 marked this pull request as ready for review July 23, 2026 07:14
@ske-prow ske-prow Bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jul 23, 2026
@ske-prow ske-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2026
@nschad

nschad commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

/hold

risk of regression. needs heavy-testing

@ske-prow ske-prow Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 30, 2026
// specifying the volume type requires a custom volume size to be specified too.
if pool.Volume != nil && pool.Volume.Type != nil {
machineClassSpec["rootDiskType"] = *pool.Volume.Type
} else if machineTypeFromCloudProfile.Storage != nil &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dear Reviewers,

I've added this also from provider-openstack. This does not have anything to-do with the machine capabilities

@timebertt timebertt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In general, this PR is very hard to review.
We had a look together with @breuerfelix @viragvoros @nschad, but haven't made it through all of it. We had a look at the API types, helpers and some parts of the validation.

Image string `json:"image,omitempty"`
// Regions is an optional mapping to the correct Image ID for the machine image in the supported regions.
Regions []RegionIDMapping `json:"regions,omitempty"`
// CapabilityFlavors is grouping of region AMIs by capabilities.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add the // +optional tag for new fields

// Regions is a mapping to the correct Image ID for the machine image in the supported regions.
Regions []RegionIDMapping `json:"regions,omitempty"`
// Image is the name of the image.
Image string `json:"image,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this needed? I don't see it in the example you provided

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can drop it if we don't want to support imageNames at all.

// Image is the name of the image.
Image string `json:"image,omitempty"`
// Capabilities that are supported by the Image ID in this set.
Capabilities gardencorev1beta1.Capabilities `json:"capabilities,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a deprecation note to the architecture-related fields?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not yet deprecated. But the idea is eventually to deprecate it,
See: https://github.com/gardener/enhancements/tree/main/geps/0033-machine-image-capabilities#migration-strategy

// Image is the name of the image.
Image string `json:"image,omitempty"`
// Capabilities that are supported by the Image ID in this set.
Capabilities gardencorev1beta1.Capabilities `json:"capabilities,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume that specifying both an region[].architecture field and the new capabilities is not supported, right?

// +optional
Architecture *string `json:"architecture,omitempty"`
// Capabilities of the machine image.
Capabilities gardencorev1beta1.Capabilities `json:"capabilities,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add // +optional tag


// ValidateCloudProfileConfig validates a CloudProfileConfig object.
func ValidateCloudProfileConfig(cloudProfile *stackitv1alpha1.CloudProfileConfig, machineImages []core.MachineImage, fldPath *field.Path) field.ErrorList {
func ValidateCloudProfileConfig(cloudProfile *stackitv1alpha1.CloudProfileConfig, machineImages []core.MachineImage, capabilityDefinitions []gardencorev1beta1.CapabilityDefinition, fldPath *field.Path) field.ErrorList {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This mix between core (internal API version) and corev1beta1 (external API version) is strange. Can we use internal or external for both params?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can but so far we have used only the internal API types for the webhook.

Comment thread pkg/admission/validator/namespacedcloudprofile.go Outdated
Comment thread pkg/admission/validator/namespacedcloudprofile.go Outdated
Comment thread pkg/admission/validator/namespacedcloudprofile.go Outdated
return allErrs
}

func validateMachineImageCapabilities(machineImage core.MachineImage, version gardencorev1beta1.MachineImageVersion, providerImageVersion stackitv1alpha1.MachineImageVersion, capabilityDefinitions []gardencorev1beta1.CapabilityDefinition) field.ErrorList {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is the entire validation for NamespacedCloudProfiles implemented in this package, while validation for CloudProfiles is implemented in the dedicated validation package?
Can we consolidate this? (Could also be in a separate PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/api-change API change with impact on API users kind/enhancement Enhancement, improvement, extension size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants