@@ -717,7 +717,6 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
717717 },
718718 SshPublicKey : "test-ssh-public-key" ,
719719 NodePoolNodeConfig : & infrav1exp.NodePoolNodeConfig {
720- UpdateNodePoolSize : true ,
721720 PlacementConfigs : []infrav1exp.PlacementConfig {
722721 {
723722 AvailabilityDomain : common .String ("test-ad" ),
@@ -840,6 +839,108 @@ func TestManagedMachinePoolUpdate(t *testing.T) {
840839 },
841840 },
842841 },
842+ {
843+ name : "no update due to change in replica size as annotation is set" ,
844+ errorExpected : false ,
845+ testSpecificSetup : func (cs * ManagedMachinePoolScope , okeClient * mock_containerengine.MockClient ) {
846+ ms .OCIManagedCluster .Spec .OCIResourceIdentifier = "resource_uid"
847+ ms .MachinePool .Annotations = make (map [string ]string )
848+ ms .MachinePool .Annotations [clusterv1 .ReplicasManagedByAnnotation ] = ""
849+ newReplicas := int32 (4 )
850+ ms .MachinePool .Spec .Replicas = & newReplicas
851+ ms .OCIManagedMachinePool .Spec = infrav1exp.OCIManagedMachinePoolSpec {
852+ Version : common .String ("v1.24.5" ),
853+ ID : common .String ("node-pool-id" ),
854+ NodeMetadata : map [string ]string {"key1" : "value1" },
855+ InitialNodeLabels : []infrav1exp.KeyValue {{
856+ Key : common .String ("key" ),
857+ Value : common .String ("value" ),
858+ }},
859+ NodeShape : "test-shape" ,
860+ NodeShapeConfig : & infrav1exp.NodeShapeConfig {
861+ Ocpus : common .String ("2" ),
862+ MemoryInGBs : common .String ("16" ),
863+ },
864+ NodeSourceViaImage : & infrav1exp.NodeSourceViaImage {
865+ ImageId : common .String ("test-image-id" ),
866+ },
867+ SshPublicKey : "test-ssh-public-key" ,
868+ NodePoolNodeConfig : & infrav1exp.NodePoolNodeConfig {
869+ PlacementConfigs : []infrav1exp.PlacementConfig {
870+ {
871+ AvailabilityDomain : common .String ("test-ad" ),
872+ SubnetName : common .String ("worker-subnet" ),
873+ CapacityReservationId : common .String ("cap-id" ),
874+ FaultDomains : []string {"fd-1" , "fd-2" },
875+ },
876+ },
877+ NsgNames : []string {"worker-nsg" },
878+ KmsKeyId : common .String ("kms-key-id" ),
879+ IsPvEncryptionInTransitEnabled : common .Bool (true ),
880+ NodePoolPodNetworkOptionDetails : & infrav1exp.NodePoolPodNetworkOptionDetails {
881+ CniType : infrav1exp .VCNNativeCNI ,
882+ VcnIpNativePodNetworkOptions : infrav1exp.VcnIpNativePodNetworkOptions {
883+ SubnetNames : []string {"pod-subnet" },
884+ MaxPodsPerNode : common .Int (31 ),
885+ NSGNames : []string {"pod-nsg" },
886+ },
887+ },
888+ },
889+ NodeEvictionNodePoolSettings : & infrav1exp.NodeEvictionNodePoolSettings {
890+ EvictionGraceDuration : common .String ("PT30M" ),
891+ IsForceDeleteAfterGraceDuration : common .Bool (true ),
892+ },
893+ }
894+ },
895+ nodePool : oke.NodePool {
896+ ClusterId : common .String ("cluster-id" ),
897+ Id : common .String ("node-pool-id" ),
898+ Name : common .String ("test" ),
899+ CompartmentId : common .String ("test-compartment" ),
900+ KubernetesVersion : common .String ("v1.24.5" ),
901+ NodeMetadata : map [string ]string {"key1" : "value1" },
902+ InitialNodeLabels : []oke.KeyValue {{
903+ Key : common .String ("key" ),
904+ Value : common .String ("value" ),
905+ }},
906+ NodeShape : common .String ("test-shape" ),
907+ NodeShapeConfig : & oke.NodeShapeConfig {
908+ Ocpus : common .Float32 (2 ),
909+ MemoryInGBs : common .Float32 (16 ),
910+ },
911+ NodeSourceDetails : oke.NodeSourceViaImageDetails {
912+ ImageId : common .String ("test-image-id" ),
913+ },
914+ FreeformTags : tags ,
915+ DefinedTags : definedTagsInterface ,
916+ SshPublicKey : common .String ("test-ssh-public-key" ),
917+ NodeConfigDetails : & oke.NodePoolNodeConfigDetails {
918+ Size : common .Int (3 ),
919+ PlacementConfigs : []oke.NodePoolPlacementConfigDetails {
920+ {
921+ AvailabilityDomain : common .String ("test-ad" ),
922+ SubnetId : common .String ("subnet-id" ),
923+ CapacityReservationId : common .String ("cap-id" ),
924+ FaultDomains : []string {"fd-1" , "fd-2" },
925+ },
926+ },
927+ NsgIds : []string {"nsg-id" },
928+ KmsKeyId : common .String ("kms-key-id" ),
929+ IsPvEncryptionInTransitEnabled : common .Bool (true ),
930+ FreeformTags : tags ,
931+ DefinedTags : definedTagsInterface ,
932+ NodePoolPodNetworkOptionDetails : oke.OciVcnIpNativeNodePoolPodNetworkOptionDetails {
933+ PodSubnetIds : []string {"pod-subnet-id" },
934+ MaxPodsPerNode : common .Int (31 ),
935+ PodNsgIds : []string {"pod-nsg-id" },
936+ },
937+ },
938+ NodeEvictionNodePoolSettings : & oke.NodeEvictionNodePoolSettings {
939+ EvictionGraceDuration : common .String ("PT30M" ),
940+ IsForceDeleteAfterGraceDuration : common .Bool (true ),
941+ },
942+ },
943+ },
843944 {
844945 name : "update due to change in k8s version" ,
845946 errorExpected : false ,
0 commit comments