@@ -551,6 +551,103 @@ func TestInstanceReconciliation(t *testing.T) {
551
551
OpcRetryToken : ociutil .GetOPCRetryToken ("machineuid" )})).Return (core.LaunchInstanceResponse {}, nil )
552
552
},
553
553
},
554
+ {
555
+ name : "check all params together, with paravirtualized volume support" ,
556
+ errorExpected : false ,
557
+ testSpecificSetup : func (machineScope * MachineScope , computeClient * mock_compute.MockComputeClient ) {
558
+ setupAllParams (ms )
559
+ ms .OCIMachine .Spec .CapacityReservationId = common .String ("cap-id" )
560
+ ms .OCIMachine .Spec .DedicatedVmHostId = common .String ("dedicated-host-id" )
561
+ ms .OCIMachine .Spec .NetworkDetails .HostnameLabel = common .String ("hostname-label" )
562
+ ms .OCIMachine .Spec .NetworkDetails .SubnetId = common .String ("subnet-machine-id" )
563
+ ms .OCIMachine .Spec .NetworkDetails .NSGIds = []string {"nsg-machine-id-1" , "nsg-machine-id-2" }
564
+ // above array should take precedence
565
+ ms .OCIMachine .Spec .NetworkDetails .NSGId = common .String ("nsg-machine-id" )
566
+ ms .OCIMachine .Spec .NetworkDetails .SkipSourceDestCheck = common .Bool (true )
567
+ ms .OCIMachine .Spec .NetworkDetails .AssignPrivateDnsRecord = common .Bool (true )
568
+ ms .OCIMachine .Spec .NetworkDetails .DisplayName = common .String ("display-name" )
569
+ ms .OCIMachine .Spec .LaunchVolumeAttachment = []infrastructurev1beta2.LaunchVolumeAttachment {
570
+ {
571
+ Type : infrastructurev1beta2 .ParavirtualizedType ,
572
+ ParavirtualizedAttachment : infrastructurev1beta2.LaunchParavirtualizedVolumeAttachment {
573
+ Device : common .String ("/dev/oci" ),
574
+ IsShareable : common .Bool (true ),
575
+ IsPvEncryptionInTransitEnabled : common .Bool (false ),
576
+ LaunchCreateVolumeFromAttributes : infrastructurev1beta2.LaunchCreateVolumeFromAttributes {
577
+ DisplayName : common .String ("test-volume" ),
578
+ SizeInGBs : common .Int64 (75 ),
579
+ VpusPerGB : common .Int64 (20 ),
580
+ },
581
+ },
582
+ },
583
+ }
584
+ ms .OCIMachine .Spec .InstanceSourceViaImageDetails = & infrastructurev1beta2.InstanceSourceViaImageConfig {
585
+ KmsKeyId : common .String ("kms-key-id" ),
586
+ BootVolumeVpusPerGB : common .Int64 (32 ),
587
+ }
588
+ computeClient .EXPECT ().ListInstances (gomock .Any (), gomock .Eq (core.ListInstancesRequest {
589
+ DisplayName : common .String ("name" ),
590
+ CompartmentId : common .String ("test" ),
591
+ })).Return (core.ListInstancesResponse {}, nil )
592
+
593
+ launchDetails := core.LaunchInstanceDetails {DisplayName : common .String ("name" ),
594
+ CapacityReservationId : common .String ("cap-id" ),
595
+ DedicatedVmHostId : common .String ("dedicated-host-id" ),
596
+ SourceDetails : core.InstanceSourceViaImageDetails {
597
+ ImageId : common .String ("image" ),
598
+ BootVolumeSizeInGBs : common .Int64 (120 ),
599
+ KmsKeyId : common .String ("kms-key-id" ),
600
+ BootVolumeVpusPerGB : common .Int64 (32 ),
601
+ },
602
+ CreateVnicDetails : & core.CreateVnicDetails {
603
+ SubnetId : common .String ("subnet-machine-id" ),
604
+ AssignPublicIp : common .Bool (false ),
605
+ DefinedTags : map [string ]map [string ]interface {}{},
606
+ FreeformTags : map [string ]string {
607
+ ociutil .CreatedBy : ociutil .OCIClusterAPIProvider ,
608
+ ociutil .ClusterResourceIdentifier : "resource_uid" ,
609
+ },
610
+ NsgIds : []string {"nsg-machine-id-1" , "nsg-machine-id-2" },
611
+ HostnameLabel : common .String ("hostname-label" ),
612
+ SkipSourceDestCheck : common .Bool (true ),
613
+ AssignPrivateDnsRecord : common .Bool (true ),
614
+ DisplayName : common .String ("display-name" ),
615
+ },
616
+ LaunchVolumeAttachments : []core.LaunchAttachVolumeDetails {
617
+ core.LaunchAttachParavirtualizedVolumeDetails {
618
+ Device : common .String ("/dev/oci" ),
619
+ IsShareable : common .Bool (true ),
620
+ IsPvEncryptionInTransitEnabled : common .Bool (false ),
621
+ LaunchCreateVolumeDetails : core.LaunchCreateVolumeFromAttributes {
622
+ DisplayName : common .String ("test-volume" ),
623
+ SizeInGBs : common .Int64 (75 ),
624
+ VpusPerGB : common .Int64 (20 ),
625
+ },
626
+ },
627
+ },
628
+ Metadata : map [string ]string {
629
+ "user_data" : base64 .StdEncoding .EncodeToString ([]byte ("test" )),
630
+ },
631
+ Shape : common .String ("shape" ),
632
+ ShapeConfig : & core.LaunchInstanceShapeConfigDetails {
633
+ Ocpus : common .Float32 (2 ),
634
+ MemoryInGBs : common .Float32 (100 ),
635
+ BaselineOcpuUtilization : core .LaunchInstanceShapeConfigDetailsBaselineOcpuUtilization8 ,
636
+ },
637
+ AvailabilityDomain : common .String ("ad2" ),
638
+ CompartmentId : common .String ("test" ),
639
+ IsPvEncryptionInTransitEnabled : common .Bool (true ),
640
+ DefinedTags : map [string ]map [string ]interface {}{},
641
+ FreeformTags : map [string ]string {
642
+ ociutil .CreatedBy : ociutil .OCIClusterAPIProvider ,
643
+ ociutil .ClusterResourceIdentifier : "resource_uid" ,
644
+ },
645
+ }
646
+ computeClient .EXPECT ().LaunchInstance (gomock .Any (), gomock .Eq (core.LaunchInstanceRequest {
647
+ LaunchInstanceDetails : launchDetails ,
648
+ OpcRetryToken : ociutil .GetOPCRetryToken ("machineuid" )})).Return (core.LaunchInstanceResponse {}, nil )
649
+ },
650
+ },
554
651
{
555
652
name : "shape config is empty" ,
556
653
errorExpected : false ,
0 commit comments