Skip to content

Commit 1a9b38b

Browse files
authored
Merge pull request #5628 from w21froster/amp-additionalCapabilities
feat: add additionalCapabilities spec to az MPs to support UltraSSDs
2 parents ed925af + ee4a875 commit 1a9b38b

File tree

6 files changed

+30
-1
lines changed

6 files changed

+30
-1
lines changed

azure/scope/machinepool.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ func (m *MachinePoolScope) ScaleSetSpec(ctx context.Context) azure.ResourceSpecG
200200
PublicLBName: m.OutboundLBName(infrav1.Node),
201201
PublicLBAddressPoolName: m.OutboundPoolName(infrav1.Node),
202202
AcceleratedNetworking: m.AzureMachinePool.Spec.Template.NetworkInterfaces[0].AcceleratedNetworking,
203+
AdditionalCapabilities: m.AzureMachinePool.Spec.Template.AdditionalCapabilities,
203204
Identity: m.AzureMachinePool.Spec.Identity,
204205
UserAssignedIdentities: m.AzureMachinePool.Spec.UserAssignedIdentities,
205206
DiagnosticsProfile: m.AzureMachinePool.Spec.Template.Diagnostics,

azure/services/resourceskus/sku.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ func (s SKU) HasLocationCapability(capabilityName, location, zone string) bool {
158158

159159
for _, capability := range zoneDetail.Capabilities {
160160
if capability.Name != nil && *capability.Name == capabilityName {
161+
// If capability is not limited to specific zones, return true
162+
if zoneDetail.Name == nil {
163+
return true
164+
}
165+
166+
// Otherwise, we need to check listed zones to verify capability is available
161167
for _, name := range zoneDetail.Name {
162168
if ptr.Deref(name, "") == zone {
163169
return true

azure/services/scalesets/spec.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ func (s *ScaleSetSpec) Parameters(ctx context.Context, existing interface{}) (pa
269269
if s.AdditionalCapabilities != nil {
270270
// Set UltraSSDEnabled if a specific value is set on the spec for it.
271271
if s.AdditionalCapabilities.UltraSSDEnabled != nil {
272-
vmss.Properties.AdditionalCapabilities.UltraSSDEnabled = s.AdditionalCapabilities.UltraSSDEnabled
272+
vmss.Properties.AdditionalCapabilities = &armcompute.AdditionalCapabilities{
273+
UltraSSDEnabled: s.AdditionalCapabilities.UltraSSDEnabled,
274+
}
273275
}
274276
}
275277

config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachinepools.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,17 @@ spec:
235235
description: 'Deprecated: AcceleratedNetworking should be set
236236
in the networkInterfaces field.'
237237
type: boolean
238+
additionalCapabilities:
239+
description: AdditionalCapabilities specifies additional capabilities
240+
enabled or disabled on the virtual machine.
241+
properties:
242+
ultraSSDEnabled:
243+
description: |-
244+
UltraSSDEnabled enables or disables Azure UltraSSD capability for the virtual machine.
245+
Defaults to true if Ultra SSD data disks are specified,
246+
otherwise it doesn't set the capability on the VM.
247+
type: boolean
248+
type: object
238249
dataDisks:
239250
description: DataDisks specifies the list of data disks to be
240251
created for a Virtual Machine

exp/api/v1beta1/azuremachinepool_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ type (
7171
// +optional
7272
AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"`
7373

74+
// AdditionalCapabilities specifies additional capabilities enabled or disabled on the virtual machine.
75+
// +optional
76+
AdditionalCapabilities *infrav1.AdditionalCapabilities `json:"additionalCapabilities,omitempty"`
77+
7478
// Diagnostics specifies the diagnostics settings for a virtual machine.
7579
// If not specified then Boot diagnostics (Managed) will be enabled.
7680
// +optional

exp/api/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)