@@ -74,7 +74,7 @@ func BuildPerArchMachineSetParamsList(ctx context.Context, client runtimeclient.
74
74
var params MachineSetParams
75
75
76
76
for _ , worker := range workers {
77
- if arch , err = getArchitectureFromMachineSetNodes (ctx , client , worker ); err != nil {
77
+ if arch , err = GetArchitectureFromMachineSetNodes (ctx , client , worker ); err != nil {
78
78
klog .Warningf ("unable to get the architecture for the machine set %s: %v" , worker .Name , err )
79
79
continue
80
80
}
@@ -176,7 +176,7 @@ func CreateMachineSet(c runtimeclient.Client, params MachineSetParams) (*machine
176
176
}
177
177
178
178
// BuildMachineSetParamsList creates a list of MachineSetParams based on the given machineSetParams with modified instance type.
179
- func BuildAlternativeMachineSetParams (machineSetParams MachineSetParams , platform configv1.PlatformType ) ([]MachineSetParams , error ) {
179
+ func BuildAlternativeMachineSetParams (machineSetParams MachineSetParams , platform configv1.PlatformType , arch string ) ([]MachineSetParams , error ) {
180
180
baseMachineSetParams := machineSetParams
181
181
baseProviderSpec := baseMachineSetParams .ProviderSpec .DeepCopy ()
182
182
@@ -185,7 +185,15 @@ func BuildAlternativeMachineSetParams(machineSetParams MachineSetParams, platfor
185
185
switch platform {
186
186
case configv1 .AWSPlatformType :
187
187
// Using cheapest compute optimized instances that meet openshift minimum requirements (4 vCPU, 8GiB RAM)
188
- alternativeInstanceTypes := []string {"c5.xlarge" , "c5a.xlarge" , "m5.xlarge" }
188
+ var alternativeInstanceTypes []string
189
+
190
+ switch arch {
191
+ case "arm64" :
192
+ alternativeInstanceTypes = []string {"m6g.large" , "t4g.nano" , "t4g.micro" , "m6gd.xlarge" }
193
+ default :
194
+ alternativeInstanceTypes = []string {"c5.xlarge" , "c5a.xlarge" , "m5.xlarge" }
195
+ }
196
+
189
197
for _ , instanceType := range alternativeInstanceTypes {
190
198
updatedProviderSpec , err := updateProviderSpecAWSInstanceType (baseProviderSpec , instanceType )
191
199
if err != nil {
@@ -196,7 +204,15 @@ func BuildAlternativeMachineSetParams(machineSetParams MachineSetParams, platfor
196
204
output = append (output , baseMachineSetParams )
197
205
}
198
206
case configv1 .AzurePlatformType :
199
- alternativeVMSizes := []string {"Standard_F4s_v2" , "Standard_D4as_v5" , "Standard_D4as_v4" }
207
+ var alternativeVMSizes []string
208
+
209
+ switch arch {
210
+ case "arm64" :
211
+ alternativeVMSizes = []string {"Standard_D2ps_v5" , "Standard_D3ps_v5" , "Standard_D4ps_v5" }
212
+ default :
213
+ alternativeVMSizes = []string {"Standard_F4s_v2" , "Standard_D4as_v5" , "Standard_D4as_v4" }
214
+ }
215
+
200
216
for _ , VMSize := range alternativeVMSizes {
201
217
updatedProviderSpec , err := updateProviderSpecAzureVMSize (baseProviderSpec , VMSize )
202
218
if err != nil {
@@ -334,13 +350,13 @@ func GetWorkerMachineSets(ctx context.Context, client runtimeclient.Client) ([]*
334
350
return result , nil
335
351
}
336
352
337
- // getArchitectureFromMachineSetNodes returns the architecture of the nodes controlled by the given machineSet's machines.
338
- func getArchitectureFromMachineSetNodes (ctx context.Context , client runtimeclient.Client , machineSet * machinev1.MachineSet ) (string , error ) {
353
+ // GetArchitectureFromMachineSetNodes returns the architecture of the nodes controlled by the given machineSet's machines.
354
+ func GetArchitectureFromMachineSetNodes (ctx context.Context , client runtimeclient.Client , machineSet * machinev1.MachineSet ) (string , error ) {
339
355
nodes , err := GetNodesFromMachineSet (ctx , client , machineSet )
340
356
if err != nil || len (nodes ) == 0 {
341
357
klog .Warningf ("error getting the machineSet's nodes or no nodes associated with %s. Using the capacity annotation" , machineSet .Name )
342
358
343
- for _ , kv := range strings .Split (machineSet .Labels [labelsKey ], "," ) {
359
+ for _ , kv := range strings .Split (machineSet .Annotations [labelsKey ], "," ) {
344
360
if strings .Contains (kv , "kubernetes.io/arch" ) {
345
361
return strings .Split (kv , "=" )[1 ], nil
346
362
}
0 commit comments