@@ -692,6 +692,154 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
692
692
},
693
693
},
694
694
},
695
+ {
696
+ name : "update due to change in replica size" ,
697
+ errorExpected : false ,
698
+ testSpecificSetup : func (cs * ManagedMachinePoolScope , okeClient * mock_containerengine.MockClient ) {
699
+ ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
700
+ newReplicas := int32 (4 )
701
+ ms .MachinePool .Spec .Replicas = & newReplicas
702
+ ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
703
+ Version : common .String ("v1.24.5" ),
704
+ ID : common .String ("node-pool-id" ),
705
+ NodeMetadata : map [string ]string {"key1" : "value1" },
706
+ InitialNodeLabels : []infrav1exp.KeyValue {{
707
+ Key : common .String ("key" ),
708
+ Value : common .String ("value" ),
709
+ }},
710
+ NodeShape : "test-shape" ,
711
+ NodeShapeConfig : & infrav1exp.NodeShapeConfig {
712
+ Ocpus : common .String ("2" ),
713
+ MemoryInGBs : common .String ("16" ),
714
+ },
715
+ NodeSourceViaImage : & infrav1exp.NodeSourceViaImage {
716
+ ImageId : common .String ("test-image-id" ),
717
+ },
718
+ SshPublicKey : "test-ssh-public-key" ,
719
+ NodePoolNodeConfig : & infrav1exp.NodePoolNodeConfig {
720
+ UpdateNodePoolSize : true ,
721
+ PlacementConfigs : []infrav1exp.PlacementConfig {
722
+ {
723
+ AvailabilityDomain : common .String ("test-ad" ),
724
+ SubnetName : common .String ("worker-subnet" ),
725
+ CapacityReservationId : common .String ("cap-id" ),
726
+ FaultDomains : []string {"fd-1" , "fd-2" },
727
+ },
728
+ },
729
+ NsgNames : []string {"worker-nsg" },
730
+ KmsKeyId : common .String ("kms-key-id" ),
731
+ IsPvEncryptionInTransitEnabled : common .Bool (true ),
732
+ NodePoolPodNetworkOptionDetails : & infrav1exp.NodePoolPodNetworkOptionDetails {
733
+ CniType : infrav1exp .VCNNativeCNI ,
734
+ VcnIpNativePodNetworkOptions : infrav1exp.VcnIpNativePodNetworkOptions {
735
+ SubnetNames : []string {"pod-subnet" },
736
+ MaxPodsPerNode : common .Int (31 ),
737
+ NSGNames : []string {"pod-nsg" },
738
+ },
739
+ },
740
+ },
741
+ NodeEvictionNodePoolSettings : & infrav1exp.NodeEvictionNodePoolSettings {
742
+ EvictionGraceDuration : common .String ("PT30M" ),
743
+ IsForceDeleteAfterGraceDuration : common .Bool (true ),
744
+ },
745
+ }
746
+ okeClient .EXPECT ().UpdateNodePool (gomock .Any (), gomock .Eq (oke.UpdateNodePoolRequest {
747
+ NodePoolId : common .String ("node-pool-id" ),
748
+ UpdateNodePoolDetails : oke.UpdateNodePoolDetails {
749
+ Name : common .String ("test" ),
750
+ KubernetesVersion : common .String ("v1.24.5" ),
751
+ NodeMetadata : map [string ]string {"key1" : "value1" },
752
+ InitialNodeLabels : []oke.KeyValue {{
753
+ Key : common .String ("key" ),
754
+ Value : common .String ("value" ),
755
+ }},
756
+ NodeShape : common .String ("test-shape" ),
757
+ NodeShapeConfig : & oke.UpdateNodeShapeConfigDetails {
758
+ Ocpus : common .Float32 (2 ),
759
+ MemoryInGBs : common .Float32 (16 ),
760
+ },
761
+ NodeSourceDetails : & oke.NodeSourceViaImageDetails {
762
+ ImageId : common .String ("test-image-id" ),
763
+ },
764
+ SshPublicKey : common .String ("test-ssh-public-key" ),
765
+ NodeConfigDetails : & oke.UpdateNodePoolNodeConfigDetails {
766
+ Size : common .Int (4 ),
767
+ PlacementConfigs : []oke.NodePoolPlacementConfigDetails {
768
+ {
769
+ AvailabilityDomain : common .String ("test-ad" ),
770
+ CapacityReservationId : common .String ("cap-id" ),
771
+ SubnetId : common .String ("subnet-id" ),
772
+ FaultDomains : []string {"fd-1" , "fd-2" },
773
+ },
774
+ },
775
+ NsgIds : []string {"nsg-id" },
776
+ KmsKeyId : common .String ("kms-key-id" ),
777
+ IsPvEncryptionInTransitEnabled : common .Bool (true ),
778
+ NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
779
+ PodSubnetIds : []string {"pod-subnet-id" },
780
+ MaxPodsPerNode : common .Int (31 ),
781
+ PodNsgIds : []string {"pod-nsg-id" },
782
+ },
783
+ },
784
+ NodeEvictionNodePoolSettings : & oke.NodeEvictionNodePoolSettings {
785
+ EvictionGraceDuration : common .String ("PT30M" ),
786
+ IsForceDeleteAfterGraceDuration : common .Bool (true ),
787
+ },
788
+ },
789
+ })).
790
+ Return (oke.UpdateNodePoolResponse {
791
+ OpcWorkRequestId : common .String ("opc-work-request-id" ),
792
+ }, nil )
793
+ },
794
+ nodePool : oke.NodePool {
795
+ ClusterId : common .String ("cluster-id" ),
796
+ Id : common .String ("node-pool-id" ),
797
+ Name : common .String ("test" ),
798
+ CompartmentId : common .String ("test-compartment" ),
799
+ KubernetesVersion : common .String ("v1.24.5" ),
800
+ NodeMetadata : map [string ]string {"key1" : "value1" },
801
+ InitialNodeLabels : []oke.KeyValue {{
802
+ Key : common .String ("key" ),
803
+ Value : common .String ("value" ),
804
+ }},
805
+ NodeShape : common .String ("test-shape" ),
806
+ NodeShapeConfig : & oke.NodeShapeConfig {
807
+ Ocpus : common .Float32 (2 ),
808
+ MemoryInGBs : common .Float32 (16 ),
809
+ },
810
+ NodeSourceDetails : oke.NodeSourceViaImageDetails {
811
+ ImageId : common .String ("test-image-id" ),
812
+ },
813
+ FreeformTags : tags ,
814
+ DefinedTags : definedTagsInterface ,
815
+ SshPublicKey : common .String ("test-ssh-public-key" ),
816
+ NodeConfigDetails : & oke.NodePoolNodeConfigDetails {
817
+ Size : common .Int (3 ),
818
+ PlacementConfigs : []oke.NodePoolPlacementConfigDetails {
819
+ {
820
+ AvailabilityDomain : common .String ("test-ad" ),
821
+ SubnetId : common .String ("subnet-id" ),
822
+ CapacityReservationId : common .String ("cap-id" ),
823
+ FaultDomains : []string {"fd-1" , "fd-2" },
824
+ },
825
+ },
826
+ NsgIds : []string {"nsg-id" },
827
+ KmsKeyId : common .String ("kms-key-id" ),
828
+ IsPvEncryptionInTransitEnabled : common .Bool (true ),
829
+ FreeformTags : tags ,
830
+ DefinedTags : definedTagsInterface ,
831
+ NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
832
+ PodSubnetIds : []string {"pod-subnet-id" },
833
+ MaxPodsPerNode : common .Int (31 ),
834
+ PodNsgIds : []string {"pod-nsg-id" },
835
+ },
836
+ },
837
+ NodeEvictionNodePoolSettings : & oke.NodeEvictionNodePoolSettings {
838
+ EvictionGraceDuration : common .String ("PT30M" ),
839
+ IsForceDeleteAfterGraceDuration : common .Bool (true ),
840
+ },
841
+ },
842
+ },
695
843
{
696
844
name : "update due to change in k8s version" ,
697
845
errorExpected : false ,
@@ -760,7 +908,6 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
760
908
},
761
909
SshPublicKey : common .String ("test-ssh-public-key" ),
762
910
NodeConfigDetails : & oke.UpdateNodePoolNodeConfigDetails {
763
- Size : common .Int (3 ),
764
911
PlacementConfigs : []oke.NodePoolPlacementConfigDetails {
765
912
{
766
913
AvailabilityDomain : common .String ("test-ad" ),
@@ -905,7 +1052,6 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
905
1052
},
906
1053
SshPublicKey : common .String ("test-ssh-public-key" ),
907
1054
NodeConfigDetails : & oke.UpdateNodePoolNodeConfigDetails {
908
- Size : common .Int (3 ),
909
1055
PlacementConfigs : []oke.NodePoolPlacementConfigDetails {
910
1056
{
911
1057
AvailabilityDomain : common .String ("test-ad" ),
@@ -1051,7 +1197,6 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
1051
1197
},
1052
1198
SshPublicKey : common .String ("test-ssh-public-key" ),
1053
1199
NodeConfigDetails : & oke.UpdateNodePoolNodeConfigDetails {
1054
- Size : common .Int (3 ),
1055
1200
PlacementConfigs : []oke.NodePoolPlacementConfigDetails {
1056
1201
{
1057
1202
AvailabilityDomain : common .String ("test-ad" ),
0 commit comments