@@ -94,13 +94,14 @@ type ExtensionSpec struct {
9494type (
9595 // VMSSVM defines a VM in a virtual machine scale set.
9696 VMSSVM struct {
97- ID string `json:"id,omitempty"`
98- InstanceID string `json:"instanceID,omitempty"`
99- Image infrav1.Image `json:"image,omitempty"`
100- Name string `json:"name,omitempty"`
101- AvailabilityZone string `json:"availabilityZone,omitempty"`
102- State infrav1.ProvisioningState `json:"vmState,omitempty"`
103- BootstrappingState infrav1.ProvisioningState `json:"bootstrappingState,omitempty"`
97+ ID string `json:"id,omitempty"`
98+ InstanceID string `json:"instanceID,omitempty"`
99+ Image infrav1.Image `json:"image,omitempty"`
100+ Name string `json:"name,omitempty"`
101+ AvailabilityZone string `json:"availabilityZone,omitempty"`
102+ State infrav1.ProvisioningState `json:"vmState,omitempty"`
103+ BootstrappingState infrav1.ProvisioningState `json:"bootstrappingState,omitempty"`
104+ OrchestrationMode infrav1.OrchestrationModeType `json:"orchestrationMode,omitempty"`
104105 }
105106
106107 // VMSS defines a virtual machine scale set.
@@ -129,9 +130,10 @@ func (vmss VMSS) HasModelChanges(other VMSS) bool {
129130}
130131
131132// InstancesByProviderID returns VMSSVMs by ID.
132- func (vmss VMSS ) InstancesByProviderID () map [string ]VMSSVM {
133+ func (vmss VMSS ) InstancesByProviderID (mode infrav1. OrchestrationModeType ) map [string ]VMSSVM {
133134 instancesByProviderID := make (map [string ]VMSSVM , len (vmss .Instances ))
134135 for _ , instance := range vmss .Instances {
136+ instance .OrchestrationMode = mode
135137 instancesByProviderID [instance .ProviderID ()] = instance
136138 }
137139
@@ -140,7 +142,7 @@ func (vmss VMSS) InstancesByProviderID() map[string]VMSSVM {
140142
141143// ProviderID returns the K8s provider ID for the VMSS instance.
142144func (vm VMSSVM ) ProviderID () string {
143- if vm .IsFlex () {
145+ if vm .OrchestrationMode == infrav1 . FlexibleOrchestrationMode {
144146 // ProviderID for Flex scaleset VMs looks like this:
145147 // azure:///subscriptions/<sub_id>/resourceGroups/my-cluster/providers/Microsoft.Compute/virtualMachines/my-cluster_1234abcd
146148 splitOnSlash := strings .Split (vm .ID , "/" )
@@ -153,11 +155,6 @@ func (vm VMSSVM) ProviderID() string {
153155 return ProviderIDPrefix + vm .ID
154156}
155157
156- // IsFlex returns true if the VMSS instance is a Flex VM.
157- func (vm VMSSVM ) IsFlex () bool {
158- return vm .InstanceID == ""
159- }
160-
161158// HasLatestModelAppliedToAll returns true if all VMSS instance have the latest model applied.
162159func (vmss VMSS ) HasLatestModelAppliedToAll () bool {
163160 for _ , instance := range vmss .Instances {
0 commit comments