@@ -352,16 +352,18 @@ func (r *ROSAMachinePoolReconciler) updateNodePool(machinePoolScope *scope.RosaM
352352
353353 currentSpec := nodePoolToRosaMachinePoolSpec (nodePool )
354354 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.
356356
357357 if cmp .Equal (desiredSpec , currentSpec ) {
358358 // no changes detected.
359359 return nodePool , nil
360360 }
361361
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
364365
366+ npBuilder := nodePoolBuilder (* desiredSpec , machinePoolScope .MachinePool .Spec )
365367 nodePoolSpec , err := npBuilder .Build ()
366368 if err != nil {
367369 return nil , fmt .Errorf ("failed to build nodePool spec: %w" , err )
@@ -401,8 +403,11 @@ func validateMachinePoolSpec(machinePoolScope *scope.RosaMachinePoolScope) (*str
401403func nodePoolBuilder (rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec , machinePoolSpec expclusterv1.MachinePoolSpec ) * cmv1.NodePoolBuilder {
402404 npBuilder := cmv1 .NewNodePool ().ID (rosaMachinePoolSpec .NodePoolName ).
403405 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+ }
406411
407412 if len (rosaMachinePoolSpec .Taints ) > 0 {
408413 taintBuilders := []* cmv1.TaintBuilder {}
@@ -430,7 +435,12 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
430435 npBuilder .Subnet (rosaMachinePoolSpec .Subnet )
431436 }
432437
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+
434444 if rosaMachinePoolSpec .Version != "" {
435445 npBuilder .Version (cmv1 .NewVersion ().ID (ocm .CreateVersionID (rosaMachinePoolSpec .Version , ocm .DefaultChannelGroup )))
436446 }
@@ -440,14 +450,15 @@ func nodePoolBuilder(rosaMachinePoolSpec expinfrav1.RosaMachinePoolSpec, machine
440450
441451func nodePoolToRosaMachinePoolSpec (nodePool * cmv1.NodePool ) expinfrav1.RosaMachinePoolSpec {
442452 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 (),
451462 }
452463
453464 if nodePool .Autoscaling () != nil {
0 commit comments