@@ -352,16 +352,18 @@ func (r *ROSAMachinePoolReconciler) updateNodePool(machinePoolScope *scope.RosaM
352
352
353
353
currentSpec := nodePoolToRosaMachinePoolSpec (nodePool )
354
354
currentSpec .ProviderIDList = desiredSpec .ProviderIDList // providerIDList is set by the controller and shouldn't be compared here.
355
- currentSpec .Version = desiredSpec .Version // Version changed are reconciled separately and shouldn't be compared here.
355
+ currentSpec .Version = desiredSpec .Version // Version changes are reconciled separately and shouldn't be compared here.
356
356
357
357
if cmp .Equal (desiredSpec , currentSpec ) {
358
358
// no changes detected.
359
359
return nodePool , nil
360
360
}
361
361
362
- npBuilder := nodePoolBuilder (* desiredSpec , machinePoolScope .MachinePool .Spec )
363
- npBuilder .Version (nil ) // eunsure version is unset.
362
+ // zero-out fields that shouldn't be part of the update call.
363
+ desiredSpec .Version = ""
364
+ desiredSpec .AdditionalSecurityGroups = nil
364
365
366
+ npBuilder := nodePoolBuilder (* desiredSpec , machinePoolScope .MachinePool .Spec )
365
367
nodePoolSpec , err := npBuilder .Build ()
366
368
if err != nil {
367
369
return nil , fmt .Errorf ("failed to build nodePool spec: %w" , err )
@@ -401,8 +403,11 @@ func validateMachinePoolSpec(machinePoolScope *scope.RosaMachinePoolScope) (*str
401
403
func nodePoolBuilder (rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec , machinePoolSpec expclusterv1.MachinePoolSpec ) * cmv1.NodePoolBuilder {
402
404
npBuilder := cmv1 .NewNodePool ().ID (rosaMachinePoolSpec .NodePoolName ).
403
405
Labels (rosaMachinePoolSpec .Labels ).
404
- AutoRepair (rosaMachinePoolSpec .AutoRepair ).
405
- TuningConfigs (rosaMachinePoolSpec .TuningConfigs ... )
406
+ AutoRepair (rosaMachinePoolSpec .AutoRepair )
407
+
408
+ if rosaMachinePoolSpec .TuningConfigs != nil {
409
+ npBuilder = npBuilder .TuningConfigs (rosaMachinePoolSpec .TuningConfigs ... )
410
+ }
406
411
407
412
if len (rosaMachinePoolSpec .Taints ) > 0 {
408
413
taintBuilders := []* cmv1.TaintBuilder {}
@@ -430,7 +435,12 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
430
435
npBuilder .Subnet (rosaMachinePoolSpec .Subnet )
431
436
}
432
437
433
- npBuilder .AWSNodePool (cmv1 .NewAWSNodePool ().InstanceType (rosaMachinePoolSpec .InstanceType ))
438
+ awsNodePool := cmv1 .NewAWSNodePool ().InstanceType (rosaMachinePoolSpec .InstanceType )
439
+ if rosaMachinePoolSpec .AdditionalSecurityGroups != nil {
440
+ awsNodePool = awsNodePool .AdditionalSecurityGroupIds (rosaMachinePoolSpec .AdditionalSecurityGroups ... )
441
+ }
442
+ npBuilder .AWSNodePool (awsNodePool )
443
+
434
444
if rosaMachinePoolSpec .Version != "" {
435
445
npBuilder .Version (cmv1 .NewVersion ().ID (ocm .CreateVersionID (rosaMachinePoolSpec .Version , ocm .DefaultChannelGroup )))
436
446
}
@@ -440,14 +450,15 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
440
450
441
451
func nodePoolToRosaMachinePoolSpec (nodePool * cmv1.NodePool ) expinfrav1.RosaMachinePoolSpec {
442
452
spec := expinfrav1.RosaMachinePoolSpec {
443
- NodePoolName : nodePool .ID (),
444
- Version : rosa .RawVersionID (nodePool .Version ()),
445
- AvailabilityZone : nodePool .AvailabilityZone (),
446
- Subnet : nodePool .Subnet (),
447
- Labels : nodePool .Labels (),
448
- AutoRepair : nodePool .AutoRepair (),
449
- InstanceType : nodePool .AWSNodePool ().InstanceType (),
450
- TuningConfigs : nodePool .TuningConfigs (),
453
+ NodePoolName : nodePool .ID (),
454
+ Version : rosa .RawVersionID (nodePool .Version ()),
455
+ AvailabilityZone : nodePool .AvailabilityZone (),
456
+ Subnet : nodePool .Subnet (),
457
+ Labels : nodePool .Labels (),
458
+ AutoRepair : nodePool .AutoRepair (),
459
+ InstanceType : nodePool .AWSNodePool ().InstanceType (),
460
+ TuningConfigs : nodePool .TuningConfigs (),
461
+ AdditionalSecurityGroups : nodePool .AWSNodePool ().AdditionalSecurityGroupIds (),
451
462
}
452
463
453
464
if nodePool .Autoscaling () != nil {
0 commit comments