@@ -160,27 +160,28 @@ func (m *MachineScope) InitMachineCache(ctx context.Context) error {
160160// VMSpec returns the VM spec.
161161func (m * MachineScope ) VMSpec () azure.ResourceSpecGetter {
162162 spec := & virtualmachines.VMSpec {
163- Name : m .Name (),
164- Location : m .Location (),
165- ExtendedLocation : m .ExtendedLocation (),
166- ResourceGroup : m .NodeResourceGroup (),
167- ClusterName : m .ClusterName (),
168- Role : m .Role (),
169- NICIDs : m .NICIDs (),
170- SSHKeyData : m .AzureMachine .Spec .SSHPublicKey ,
171- Size : m .AzureMachine .Spec .VMSize ,
172- OSDisk : m .AzureMachine .Spec .OSDisk ,
173- DataDisks : m .AzureMachine .Spec .DataDisks ,
174- AvailabilitySetID : m .AvailabilitySetID (),
175- Zone : m .AvailabilityZone (),
176- Identity : m .AzureMachine .Spec .Identity ,
177- UserAssignedIdentities : m .AzureMachine .Spec .UserAssignedIdentities ,
178- SpotVMOptions : m .AzureMachine .Spec .SpotVMOptions ,
179- SecurityProfile : m .AzureMachine .Spec .SecurityProfile ,
180- DiagnosticsProfile : m .AzureMachine .Spec .Diagnostics ,
181- AdditionalTags : m .AdditionalTags (),
182- AdditionalCapabilities : m .AzureMachine .Spec .AdditionalCapabilities ,
183- ProviderID : m .ProviderID (),
163+ Name : m .Name (),
164+ Location : m .Location (),
165+ ExtendedLocation : m .ExtendedLocation (),
166+ ResourceGroup : m .NodeResourceGroup (),
167+ ClusterName : m .ClusterName (),
168+ Role : m .Role (),
169+ NICIDs : m .NICIDs (),
170+ SSHKeyData : m .AzureMachine .Spec .SSHPublicKey ,
171+ Size : m .AzureMachine .Spec .VMSize ,
172+ OSDisk : m .AzureMachine .Spec .OSDisk ,
173+ DataDisks : m .AzureMachine .Spec .DataDisks ,
174+ AvailabilitySetID : m .AvailabilitySetID (),
175+ Zone : m .AvailabilityZone (),
176+ Identity : m .AzureMachine .Spec .Identity ,
177+ UserAssignedIdentities : m .AzureMachine .Spec .UserAssignedIdentities ,
178+ SpotVMOptions : m .AzureMachine .Spec .SpotVMOptions ,
179+ SecurityProfile : m .AzureMachine .Spec .SecurityProfile ,
180+ DiagnosticsProfile : m .AzureMachine .Spec .Diagnostics ,
181+ AdditionalTags : m .AdditionalTags (),
182+ AdditionalCapabilities : m .AzureMachine .Spec .AdditionalCapabilities ,
183+ CapacityReservationGroupID : m .GetCapacityReservationGroupID (),
184+ ProviderID : m .ProviderID (),
184185 }
185186 if m .cache != nil {
186187 spec .SKU = m .cache .VMSKU
@@ -805,3 +806,9 @@ func (m *MachineScope) UpdatePatchStatus(condition clusterv1.ConditionType, serv
805806 conditions .MarkFalse (m .AzureMachine , condition , infrav1 .FailedReason , clusterv1 .ConditionSeverityError , "%s failed to update. err: %s" , service , err .Error ())
806807 }
807808}
809+
810+ // GetCapacityReservationGroupID returns the CapacityReservationGroupID from the spec if the
811+ // value is assigned, or else returns an empty string.
812+ func (m * MachineScope ) GetCapacityReservationGroupID () string {
813+ return ptr .Deref (m .AzureMachine .Spec .CapacityReservationGroupID , "" )
814+ }
0 commit comments