Module: Kitchen::Driver::Oci::Instance::ComputeLaunchDetails
- Defined in:
- lib/kitchen/driver/oci/instance/compute.rb
Overview
Setter methods that populate the details of OCI::Core::Models::LaunchInstanceDetails.
Instance Method Summary collapse
-
#agent_config ⇒ Object
Adds the agent_config property to the launch_details.
-
#capacity_reservation ⇒ Object
Adds the capacity_reservation_id property to the launch_details if an ocid is provided.
-
#hostname_display_name ⇒ Object
Assigns the display_name and create_vnic_details to the launch_details.
-
#instance_metadata ⇒ Object
Adds the metadata property to the launch_details.
-
#instance_source_via_boot_volume ⇒ Object
Adds the source_details property to the launch_details for an instance that is being created from a boot volume.
-
#instance_source_via_image ⇒ Object
Adds the source_details property to the launch_details for an instance that is being created from an image.
-
#launch_instance_options ⇒ Object
Adds the instance_options property to the launch_details to disable legacy IMDS endpoints at launch time.
-
#preemptible_instance_config ⇒ Object
Adds the preemptible_instance_config property tot he launch_details by creating a new instance of OCI::Core::Models::PreemptibleInstanceConfigDetails.
-
#shape_config ⇒ Object
Adds the shape_config property to the launch_details by creating a new instance of OCI::Core::Models::LaunchInstanceShapeConfigDetails.
Instance Method Details
#agent_config ⇒ Object
Adds the agent_config property to the launch_details.
65 66 67 68 69 70 71 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 65 def agent_config launch_details.agent_config = OCI::Core::Models::LaunchInstanceAgentConfigDetails.new( are_all_plugins_disabled: config[:all_plugins_disabled], is_management_disabled: config[:management_disabled], is_monitoring_disabled: config[:monitoring_disabled] ) end |
#capacity_reservation ⇒ Object
Adds the capacity_reservation_id property to the launch_details if an ocid is provided.
60 61 62 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 60 def capacity_reservation launch_details.capacity_reservation_id = config[:capacity_reservation_id] end |
#hostname_display_name ⇒ Object
Assigns the display_name and create_vnic_details to the launch_details.
-
display_name is either the literal display_name provided in the kitchen config or a randomly generated one.
-
create_vnic_details is a populated instance of OCI::Core::Models::CreateVnicDetails.
30 31 32 33 34 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 30 def hostname_display_name display_name = config[:display_name] || hostname launch_details.display_name = display_name launch_details.create_vnic_details = create_vnic_details(display_name) end |
#instance_metadata ⇒ Object
Adds the metadata property to the launch_details.
98 99 100 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 98 def launch_details. = end |
#instance_source_via_boot_volume ⇒ Object
Adds the source_details property to the launch_details for an instance that is being created from a boot volume.
88 89 90 91 92 93 94 95 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 88 def instance_source_via_boot_volume return unless config[:boot_volume_id] launch_details.source_details = OCI::Core::Models::InstanceSourceViaBootVolumeDetails.new( boot_volume_id: clone_boot_volume, sourceType: "bootVolume" ) end |
#instance_source_via_image ⇒ Object
Adds the source_details property to the launch_details for an instance that is being created from an image. When kms_key_id is specified the boot volume is encrypted with the provided customer-managed key, which is required by compartments governed by a Security Zone that mandates customer-managed encryption.
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 76 def instance_source_via_image return if config[:boot_volume_id] launch_details.source_details = OCI::Core::Models::InstanceSourceViaImageDetails.new( sourceType: "image", imageId: image_id, bootVolumeSizeInGBs: config[:boot_volume_size_in_gbs], kmsKeyId: config[:kms_key_id] ) end |
#launch_instance_options ⇒ Object
Adds the instance_options property to the launch_details to disable legacy IMDS endpoints at launch time. This ensures IMDSv2 is enabled from instance creation, which is required by OCI security policies that deny instance creation when areLegacyEndpointsDisabled=‘false’.
105 106 107 108 109 110 111 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 105 def opts = config[:instance_options].dup return if opts.delete(:post_create) opts[:are_legacy_imds_endpoints_disabled] = true unless opts.key?(:are_legacy_imds_endpoints_disabled) launch_details. = OCI::Core::Models::InstanceOptions.new(opts) end |
#preemptible_instance_config ⇒ Object
Adds the preemptible_instance_config property tot he launch_details by creating a new instance of OCI::Core::Models::PreemptibleInstanceConfigDetails.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 37 def preemptible_instance_config return unless config[:preemptible_instance] launch_details.preemptible_instance_config = OCI::Core::Models::PreemptibleInstanceConfigDetails.new( preemption_action: OCI::Core::Models::TerminatePreemptionAction.new( type: "TERMINATE", preserve_boot_volume: true ) ) end |
#shape_config ⇒ Object
Adds the shape_config property to the launch_details by creating a new instance of OCI::Core::Models::LaunchInstanceShapeConfigDetails.
49 50 51 52 53 54 55 56 57 |
# File 'lib/kitchen/driver/oci/instance/compute.rb', line 49 def shape_config return if config[:shape_config].empty? launch_details.shape_config = OCI::Core::Models::LaunchInstanceShapeConfigDetails.new( ocpus: config[:shape_config][:ocpus], memory_in_gbs: config[:shape_config][:memory_in_gbs], baseline_ocpu_utilization: config[:shape_config][:baseline_ocpu_utilization] || "BASELINE_1_1" ) end |