[GEP-33] Add Capability support - #206
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
57d62ad to
3646083
Compare
|
/hold risk of regression. needs heavy-testing |
| // 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 && |
There was a problem hiding this comment.
Dear Reviewers,
I've added this also from provider-openstack. This does not have anything to-do with the machine capabilities
timebertt
left a comment
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
Is this needed? I don't see it in the example you provided
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
Can we add a deprecation note to the architecture-related fields?
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
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"` |
|
|
||
| // 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 { |
There was a problem hiding this comment.
This mix between core (internal API version) and corev1beta1 (external API version) is strange. Can we use internal or external for both params?
There was a problem hiding this comment.
We can but so far we have used only the internal API types for the webhook.
| return allErrs | ||
| } | ||
|
|
||
| func validateMachineImageCapabilities(machineImage core.MachineImage, version gardencorev1beta1.MachineImageVersion, providerImageVersion stackitv1alpha1.MachineImageVersion, capabilityDefinitions []gardencorev1beta1.CapabilityDefinition) field.ErrorList { |
There was a problem hiding this comment.
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)
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: