From a1ea85b04fde3904446b9ed73bcdfe1dee5eb105 Mon Sep 17 00:00:00 2001 From: Shyam Radhakrishnan Date: Fri, 29 Mar 2024 11:12:22 +0530 Subject: [PATCH] Add support for launch volumes (#361) * Add support for volume attachments during launch instance --- Makefile | 2 +- api/v1beta1/ocimachine_types.go | 11 + api/v1beta1/types.go | 87 ++++++++ api/v1beta1/zz_generated.conversion.go | 130 +++++++++++ api/v1beta1/zz_generated.deepcopy.go | 114 ++++++++++ api/v1beta2/ocimachine_types.go | 11 + api/v1beta2/types.go | 88 ++++++++ api/v1beta2/zz_generated.deepcopy.go | 114 ++++++++++ cloud/scope/clients.go | 99 --------- cloud/scope/machine.go | 58 ++++- cloud/scope/machine_test.go | 35 ++- ...tructure.cluster.x-k8s.io_ocimachines.yaml | 192 ++++++++++++++++ ....cluster.x-k8s.io_ocimachinetemplates.yaml | 210 ++++++++++++++++++ controllers/ocimachine_controller_test.go | 10 +- go.mod | 4 +- go.sum | 8 +- .../infrastructure-oci/v1beta2/bases/md.yaml | 7 + 17 files changed, 1065 insertions(+), 115 deletions(-) diff --git a/Makefile b/Makefile index 8f0107c2..0c9833ec 100644 --- a/Makefile +++ b/Makefile @@ -378,7 +378,7 @@ $(KUSTOMIZE): ## Download kustomize locally if necessary. GOBIN=$(BIN_DIR)/ $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v4 $(KUSTOMIZE_BIN) v4.5.2 $(GINKGO): ## Build ginkgo. - GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/onsi/ginkgo/v2/ginkgo $(GINKGO_BIN) v2.11.0 + GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/onsi/ginkgo/v2/ginkgo $(GINKGO_BIN) v2.13.1 $(GOLANGCI_LINT): ## Build golanci-lint. GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) v1.44.0 diff --git a/api/v1beta1/ocimachine_types.go b/api/v1beta1/ocimachine_types.go index 18ecc3e0..604dfdbd 100644 --- a/api/v1beta1/ocimachine_types.go +++ b/api/v1beta1/ocimachine_types.go @@ -95,6 +95,9 @@ type OCIMachineSpec struct { // DedicatedVmHostId defines the OCID of the dedicated VM host. DedicatedVmHostId *string `json:"dedicatedVmHostId,omitempty"` + // Volume attachments to create as part of the launch instance operation. + LaunchVolumeAttachment []LaunchVolumeAttachment `json:"launchVolumeAttachments,omitempty"` + // Provider ID of the instance, this will be set by Cluster API provider itself, // users should not set this parameter. // +optional @@ -134,6 +137,14 @@ type OCIMachineSpec struct { // +optional // Deprecated, please use NetworkDetails.NSGNames NSGName string `json:"nsgName,omitempty"` + + // Specifies whether to delete or preserve the boot volume when terminating an instance. + // When set to true, the boot volume is preserved. The default value is false. + PreserveBootVolume bool `json:"preserveBootVolume,omitempty"` + + // Specifies whether to delete or preserve the data volumes created during launch when + //terminating an instance. When set to true, the data volumes are preserved. The default value is true. + PreserveDataVolumesCreatedAtLaunch bool `json:"preserveDataVolumesCreatedAtLaunch,omitempty"` } // OCIMachineStatus defines the observed state of OCIMachine. diff --git a/api/v1beta1/types.go b/api/v1beta1/types.go index d6202e11..89604e2d 100644 --- a/api/v1beta1/types.go +++ b/api/v1beta1/types.go @@ -1046,6 +1046,93 @@ type RemotePeeringConnection struct { RPCConnectionId *string `json:"rpcConnectionId,omitempty"` } +type VolumeType string + +const ( + IscsiType VolumeType = "iscsi" +) + +// EncryptionInTransitTypeEnum Enum with underlying type: string +type EncryptionInTransitTypeEnum string + +// Set of constants representing the allowable values for EncryptionInTransitTypeEnum +const ( + EncryptionInTransitTypeNone EncryptionInTransitTypeEnum = "NONE" + EncryptionInTransitTypeBmEncryptionInTransit EncryptionInTransitTypeEnum = "BM_ENCRYPTION_IN_TRANSIT" +) + +type LaunchVolumeAttachment struct { + // The type of volume. Valid value is iscsi. + Type VolumeType `json:"volumeType,omitempty"` + + // The details of iscsi volume attachment. + IscsiAttachment LaunchIscsiVolumeAttachment `json:"launchIscsiVolumeAttachment,omitempty"` +} + +// LaunchIscsiVolumeAttachment specifies the iscsi volume attachments to create as part of the launch instance operation. +type LaunchIscsiVolumeAttachment struct { + // The device name. To retrieve a list of devices for a given instance, see ListInstanceDevices. + Device *string `json:"device,omitempty"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `json:"displayName,omitempty"` + + // Whether the attachment was created in read-only mode. + IsReadOnly *bool `json:"isReadOnly,omitempty"` + + // Whether the attachment should be created in shareable mode. If an attachment + // is created in shareable mode, then other instances can attach the same volume, provided + // that they also create their attachments in shareable mode. Only certain volume types can + // be attached in shareable mode. Defaults to false if not specified. + IsShareable *bool `json:"isShareable,omitempty"` + + // The OCID of the volume. If CreateVolumeDetails is specified, this field must be omitted from the request. + VolumeId *string `json:"volumeId,omitempty"` + + // LaunchCreateVolumeFromAttributes The details of the volume to create for CreateVolume operation. + LaunchCreateVolumeFromAttributes LaunchCreateVolumeFromAttributes `json:"launchCreateVolumeFromAttributes,omitempty"` + + // Whether to use CHAP authentication for the volume attachment. Defaults to false. + UseChap *bool `json:"useChap,omitempty"` + + // Whether to enable Oracle Cloud Agent to perform the iSCSI login and logout commands after the volume attach or detach operations for non multipath-enabled iSCSI attachments. + IsAgentAutoIscsiLoginEnabled *bool `json:"isAgentAutoIscsiLoginEnabled,omitempty"` + + // Refer the top-level definition of encryptionInTransitType. + // The default value is NONE. + EncryptionInTransitType EncryptionInTransitTypeEnum `json:"encryptionInTransitType,omitempty"` +} + +// LaunchCreateVolumeFromAttributes The details of the volume to create for CreateVolume operation. +type LaunchCreateVolumeFromAttributes struct { + + // The size of the volume in GBs. + SizeInGBs *int64 `json:"sizeInGBs,omitempty"` + + // The OCID of the compartment that contains the volume. If not provided, + // it will be inherited from the instance. + CompartmentId *string `json:"compartmentId,omitempty"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `json:"displayName,omitempty"` + + // The OCID of the Vault service key to assign as the master encryption key + // for the volume. + KmsKeyId *string `json:"kmsKeyId,omitempty"` + + // The number of volume performance units (VPUs) that will be applied to this volume per GB, + // representing the Block Volume service's elastic performance options. + // See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) for more information. + // Allowed values: + // * `0`: Represents Lower Cost option. + // * `10`: Represents Balanced option. + // * `20`: Represents Higher Performance option. + // * `30`-`120`: Represents the Ultra High Performance option. + VpusPerGB *int64 `json:"vpusPerGB,omitempty"` +} + const ( VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE" FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY" diff --git a/api/v1beta1/zz_generated.conversion.go b/api/v1beta1/zz_generated.conversion.go index 4f5fee72..cb3289f0 100644 --- a/api/v1beta1/zz_generated.conversion.go +++ b/api/v1beta1/zz_generated.conversion.go @@ -280,6 +280,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*LaunchCreateVolumeFromAttributes)(nil), (*v1beta2.LaunchCreateVolumeFromAttributes)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_LaunchCreateVolumeFromAttributes_To_v1beta2_LaunchCreateVolumeFromAttributes(a.(*LaunchCreateVolumeFromAttributes), b.(*v1beta2.LaunchCreateVolumeFromAttributes), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LaunchCreateVolumeFromAttributes)(nil), (*LaunchCreateVolumeFromAttributes)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LaunchCreateVolumeFromAttributes_To_v1beta1_LaunchCreateVolumeFromAttributes(a.(*v1beta2.LaunchCreateVolumeFromAttributes), b.(*LaunchCreateVolumeFromAttributes), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*LaunchInstanceAgentConfig)(nil), (*v1beta2.LaunchInstanceAgentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_LaunchInstanceAgentConfig_To_v1beta2_LaunchInstanceAgentConfig(a.(*LaunchInstanceAgentConfig), b.(*v1beta2.LaunchInstanceAgentConfig), scope) }); err != nil { @@ -300,6 +310,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*LaunchIscsiVolumeAttachment)(nil), (*v1beta2.LaunchIscsiVolumeAttachment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_LaunchIscsiVolumeAttachment_To_v1beta2_LaunchIscsiVolumeAttachment(a.(*LaunchIscsiVolumeAttachment), b.(*v1beta2.LaunchIscsiVolumeAttachment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LaunchIscsiVolumeAttachment)(nil), (*LaunchIscsiVolumeAttachment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LaunchIscsiVolumeAttachment_To_v1beta1_LaunchIscsiVolumeAttachment(a.(*v1beta2.LaunchIscsiVolumeAttachment), b.(*LaunchIscsiVolumeAttachment), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*LaunchOptions)(nil), (*v1beta2.LaunchOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_LaunchOptions_To_v1beta2_LaunchOptions(a.(*LaunchOptions), b.(*v1beta2.LaunchOptions), scope) }); err != nil { @@ -310,6 +330,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*LaunchVolumeAttachment)(nil), (*v1beta2.LaunchVolumeAttachment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_LaunchVolumeAttachment_To_v1beta2_LaunchVolumeAttachment(a.(*LaunchVolumeAttachment), b.(*v1beta2.LaunchVolumeAttachment), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*v1beta2.LaunchVolumeAttachment)(nil), (*LaunchVolumeAttachment)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LaunchVolumeAttachment_To_v1beta1_LaunchVolumeAttachment(a.(*v1beta2.LaunchVolumeAttachment), b.(*LaunchVolumeAttachment), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*LoadBalancer)(nil), (*v1beta2.LoadBalancer)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer(a.(*LoadBalancer), b.(*v1beta2.LoadBalancer), scope) }); err != nil { @@ -1507,6 +1537,34 @@ func Convert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig( return autoConvert_v1beta2_KubernetesNetworkConfig_To_v1beta1_KubernetesNetworkConfig(in, out, s) } +func autoConvert_v1beta1_LaunchCreateVolumeFromAttributes_To_v1beta2_LaunchCreateVolumeFromAttributes(in *LaunchCreateVolumeFromAttributes, out *v1beta2.LaunchCreateVolumeFromAttributes, s conversion.Scope) error { + out.SizeInGBs = (*int64)(unsafe.Pointer(in.SizeInGBs)) + out.CompartmentId = (*string)(unsafe.Pointer(in.CompartmentId)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.VpusPerGB = (*int64)(unsafe.Pointer(in.VpusPerGB)) + return nil +} + +// Convert_v1beta1_LaunchCreateVolumeFromAttributes_To_v1beta2_LaunchCreateVolumeFromAttributes is an autogenerated conversion function. +func Convert_v1beta1_LaunchCreateVolumeFromAttributes_To_v1beta2_LaunchCreateVolumeFromAttributes(in *LaunchCreateVolumeFromAttributes, out *v1beta2.LaunchCreateVolumeFromAttributes, s conversion.Scope) error { + return autoConvert_v1beta1_LaunchCreateVolumeFromAttributes_To_v1beta2_LaunchCreateVolumeFromAttributes(in, out, s) +} + +func autoConvert_v1beta2_LaunchCreateVolumeFromAttributes_To_v1beta1_LaunchCreateVolumeFromAttributes(in *v1beta2.LaunchCreateVolumeFromAttributes, out *LaunchCreateVolumeFromAttributes, s conversion.Scope) error { + out.SizeInGBs = (*int64)(unsafe.Pointer(in.SizeInGBs)) + out.CompartmentId = (*string)(unsafe.Pointer(in.CompartmentId)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.KmsKeyId = (*string)(unsafe.Pointer(in.KmsKeyId)) + out.VpusPerGB = (*int64)(unsafe.Pointer(in.VpusPerGB)) + return nil +} + +// Convert_v1beta2_LaunchCreateVolumeFromAttributes_To_v1beta1_LaunchCreateVolumeFromAttributes is an autogenerated conversion function. +func Convert_v1beta2_LaunchCreateVolumeFromAttributes_To_v1beta1_LaunchCreateVolumeFromAttributes(in *v1beta2.LaunchCreateVolumeFromAttributes, out *LaunchCreateVolumeFromAttributes, s conversion.Scope) error { + return autoConvert_v1beta2_LaunchCreateVolumeFromAttributes_To_v1beta1_LaunchCreateVolumeFromAttributes(in, out, s) +} + func autoConvert_v1beta1_LaunchInstanceAgentConfig_To_v1beta2_LaunchInstanceAgentConfig(in *LaunchInstanceAgentConfig, out *v1beta2.LaunchInstanceAgentConfig, s conversion.Scope) error { out.IsMonitoringDisabled = (*bool)(unsafe.Pointer(in.IsMonitoringDisabled)) out.IsManagementDisabled = (*bool)(unsafe.Pointer(in.IsManagementDisabled)) @@ -1555,6 +1613,46 @@ func Convert_v1beta2_LaunchInstanceAvailabilityConfig_To_v1beta1_LaunchInstanceA return autoConvert_v1beta2_LaunchInstanceAvailabilityConfig_To_v1beta1_LaunchInstanceAvailabilityConfig(in, out, s) } +func autoConvert_v1beta1_LaunchIscsiVolumeAttachment_To_v1beta2_LaunchIscsiVolumeAttachment(in *LaunchIscsiVolumeAttachment, out *v1beta2.LaunchIscsiVolumeAttachment, s conversion.Scope) error { + out.Device = (*string)(unsafe.Pointer(in.Device)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.IsReadOnly = (*bool)(unsafe.Pointer(in.IsReadOnly)) + out.IsShareable = (*bool)(unsafe.Pointer(in.IsShareable)) + out.VolumeId = (*string)(unsafe.Pointer(in.VolumeId)) + if err := Convert_v1beta1_LaunchCreateVolumeFromAttributes_To_v1beta2_LaunchCreateVolumeFromAttributes(&in.LaunchCreateVolumeFromAttributes, &out.LaunchCreateVolumeFromAttributes, s); err != nil { + return err + } + out.UseChap = (*bool)(unsafe.Pointer(in.UseChap)) + out.IsAgentAutoIscsiLoginEnabled = (*bool)(unsafe.Pointer(in.IsAgentAutoIscsiLoginEnabled)) + out.EncryptionInTransitType = v1beta2.EncryptionInTransitTypeEnum(in.EncryptionInTransitType) + return nil +} + +// Convert_v1beta1_LaunchIscsiVolumeAttachment_To_v1beta2_LaunchIscsiVolumeAttachment is an autogenerated conversion function. +func Convert_v1beta1_LaunchIscsiVolumeAttachment_To_v1beta2_LaunchIscsiVolumeAttachment(in *LaunchIscsiVolumeAttachment, out *v1beta2.LaunchIscsiVolumeAttachment, s conversion.Scope) error { + return autoConvert_v1beta1_LaunchIscsiVolumeAttachment_To_v1beta2_LaunchIscsiVolumeAttachment(in, out, s) +} + +func autoConvert_v1beta2_LaunchIscsiVolumeAttachment_To_v1beta1_LaunchIscsiVolumeAttachment(in *v1beta2.LaunchIscsiVolumeAttachment, out *LaunchIscsiVolumeAttachment, s conversion.Scope) error { + out.Device = (*string)(unsafe.Pointer(in.Device)) + out.DisplayName = (*string)(unsafe.Pointer(in.DisplayName)) + out.IsReadOnly = (*bool)(unsafe.Pointer(in.IsReadOnly)) + out.IsShareable = (*bool)(unsafe.Pointer(in.IsShareable)) + out.VolumeId = (*string)(unsafe.Pointer(in.VolumeId)) + if err := Convert_v1beta2_LaunchCreateVolumeFromAttributes_To_v1beta1_LaunchCreateVolumeFromAttributes(&in.LaunchCreateVolumeFromAttributes, &out.LaunchCreateVolumeFromAttributes, s); err != nil { + return err + } + out.UseChap = (*bool)(unsafe.Pointer(in.UseChap)) + out.IsAgentAutoIscsiLoginEnabled = (*bool)(unsafe.Pointer(in.IsAgentAutoIscsiLoginEnabled)) + out.EncryptionInTransitType = EncryptionInTransitTypeEnum(in.EncryptionInTransitType) + return nil +} + +// Convert_v1beta2_LaunchIscsiVolumeAttachment_To_v1beta1_LaunchIscsiVolumeAttachment is an autogenerated conversion function. +func Convert_v1beta2_LaunchIscsiVolumeAttachment_To_v1beta1_LaunchIscsiVolumeAttachment(in *v1beta2.LaunchIscsiVolumeAttachment, out *LaunchIscsiVolumeAttachment, s conversion.Scope) error { + return autoConvert_v1beta2_LaunchIscsiVolumeAttachment_To_v1beta1_LaunchIscsiVolumeAttachment(in, out, s) +} + func autoConvert_v1beta1_LaunchOptions_To_v1beta2_LaunchOptions(in *LaunchOptions, out *v1beta2.LaunchOptions, s conversion.Scope) error { out.BootVolumeType = v1beta2.LaunchOptionsBootVolumeTypeEnum(in.BootVolumeType) out.Firmware = v1beta2.LaunchOptionsFirmwareEnum(in.Firmware) @@ -1583,6 +1681,32 @@ func Convert_v1beta2_LaunchOptions_To_v1beta1_LaunchOptions(in *v1beta2.LaunchOp return autoConvert_v1beta2_LaunchOptions_To_v1beta1_LaunchOptions(in, out, s) } +func autoConvert_v1beta1_LaunchVolumeAttachment_To_v1beta2_LaunchVolumeAttachment(in *LaunchVolumeAttachment, out *v1beta2.LaunchVolumeAttachment, s conversion.Scope) error { + out.Type = v1beta2.VolumeType(in.Type) + if err := Convert_v1beta1_LaunchIscsiVolumeAttachment_To_v1beta2_LaunchIscsiVolumeAttachment(&in.IscsiAttachment, &out.IscsiAttachment, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta1_LaunchVolumeAttachment_To_v1beta2_LaunchVolumeAttachment is an autogenerated conversion function. +func Convert_v1beta1_LaunchVolumeAttachment_To_v1beta2_LaunchVolumeAttachment(in *LaunchVolumeAttachment, out *v1beta2.LaunchVolumeAttachment, s conversion.Scope) error { + return autoConvert_v1beta1_LaunchVolumeAttachment_To_v1beta2_LaunchVolumeAttachment(in, out, s) +} + +func autoConvert_v1beta2_LaunchVolumeAttachment_To_v1beta1_LaunchVolumeAttachment(in *v1beta2.LaunchVolumeAttachment, out *LaunchVolumeAttachment, s conversion.Scope) error { + out.Type = VolumeType(in.Type) + if err := Convert_v1beta2_LaunchIscsiVolumeAttachment_To_v1beta1_LaunchIscsiVolumeAttachment(&in.IscsiAttachment, &out.IscsiAttachment, s); err != nil { + return err + } + return nil +} + +// Convert_v1beta2_LaunchVolumeAttachment_To_v1beta1_LaunchVolumeAttachment is an autogenerated conversion function. +func Convert_v1beta2_LaunchVolumeAttachment_To_v1beta1_LaunchVolumeAttachment(in *v1beta2.LaunchVolumeAttachment, out *LaunchVolumeAttachment, s conversion.Scope) error { + return autoConvert_v1beta2_LaunchVolumeAttachment_To_v1beta1_LaunchVolumeAttachment(in, out, s) +} + func autoConvert_v1beta1_LoadBalancer_To_v1beta2_LoadBalancer(in *LoadBalancer, out *v1beta2.LoadBalancer, s conversion.Scope) error { out.Name = in.Name out.LoadBalancerId = (*string)(unsafe.Pointer(in.LoadBalancerId)) @@ -2198,6 +2322,7 @@ func autoConvert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(in *OCIMachine out.InstanceSourceViaImageDetails = (*v1beta2.InstanceSourceViaImageConfig)(unsafe.Pointer(in.InstanceSourceViaImageDetails)) out.PlatformConfig = (*v1beta2.PlatformConfig)(unsafe.Pointer(in.PlatformConfig)) out.DedicatedVmHostId = (*string)(unsafe.Pointer(in.DedicatedVmHostId)) + out.LaunchVolumeAttachment = *(*[]v1beta2.LaunchVolumeAttachment)(unsafe.Pointer(&in.LaunchVolumeAttachment)) out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) out.IsPvEncryptionInTransitEnabled = in.IsPvEncryptionInTransitEnabled out.BootVolumeSizeInGBs = in.BootVolumeSizeInGBs @@ -2206,6 +2331,8 @@ func autoConvert_v1beta1_OCIMachineSpec_To_v1beta2_OCIMachineSpec(in *OCIMachine out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) out.SubnetName = in.SubnetName // WARNING: in.NSGName requires manual conversion: does not exist in peer-type + out.PreserveBootVolume = in.PreserveBootVolume + out.PreserveDataVolumesCreatedAtLaunch = in.PreserveDataVolumesCreatedAtLaunch return nil } @@ -2238,7 +2365,10 @@ func autoConvert_v1beta2_OCIMachineSpec_To_v1beta1_OCIMachineSpec(in *v1beta2.OC out.Metadata = *(*map[string]string)(unsafe.Pointer(&in.Metadata)) out.FreeformTags = *(*map[string]string)(unsafe.Pointer(&in.FreeformTags)) out.DefinedTags = *(*map[string]map[string]string)(unsafe.Pointer(&in.DefinedTags)) + out.LaunchVolumeAttachment = *(*[]LaunchVolumeAttachment)(unsafe.Pointer(&in.LaunchVolumeAttachment)) out.SubnetName = in.SubnetName + out.PreserveBootVolume = in.PreserveBootVolume + out.PreserveDataVolumesCreatedAtLaunch = in.PreserveDataVolumesCreatedAtLaunch return nil } diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index f296a8fa..5159206f 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -802,6 +802,46 @@ func (in *KubernetesNetworkConfig) DeepCopy() *KubernetesNetworkConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchCreateVolumeFromAttributes) DeepCopyInto(out *LaunchCreateVolumeFromAttributes) { + *out = *in + if in.SizeInGBs != nil { + in, out := &in.SizeInGBs, &out.SizeInGBs + *out = new(int64) + **out = **in + } + if in.CompartmentId != nil { + in, out := &in.CompartmentId, &out.CompartmentId + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } + if in.VpusPerGB != nil { + in, out := &in.VpusPerGB, &out.VpusPerGB + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchCreateVolumeFromAttributes. +func (in *LaunchCreateVolumeFromAttributes) DeepCopy() *LaunchCreateVolumeFromAttributes { + if in == nil { + return nil + } + out := new(LaunchCreateVolumeFromAttributes) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchInstanceAgentConfig) DeepCopyInto(out *LaunchInstanceAgentConfig) { *out = *in @@ -859,6 +899,57 @@ func (in *LaunchInstanceAvailabilityConfig) DeepCopy() *LaunchInstanceAvailabili return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchIscsiVolumeAttachment) DeepCopyInto(out *LaunchIscsiVolumeAttachment) { + *out = *in + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.IsReadOnly != nil { + in, out := &in.IsReadOnly, &out.IsReadOnly + *out = new(bool) + **out = **in + } + if in.IsShareable != nil { + in, out := &in.IsShareable, &out.IsShareable + *out = new(bool) + **out = **in + } + if in.VolumeId != nil { + in, out := &in.VolumeId, &out.VolumeId + *out = new(string) + **out = **in + } + in.LaunchCreateVolumeFromAttributes.DeepCopyInto(&out.LaunchCreateVolumeFromAttributes) + if in.UseChap != nil { + in, out := &in.UseChap, &out.UseChap + *out = new(bool) + **out = **in + } + if in.IsAgentAutoIscsiLoginEnabled != nil { + in, out := &in.IsAgentAutoIscsiLoginEnabled, &out.IsAgentAutoIscsiLoginEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchIscsiVolumeAttachment. +func (in *LaunchIscsiVolumeAttachment) DeepCopy() *LaunchIscsiVolumeAttachment { + if in == nil { + return nil + } + out := new(LaunchIscsiVolumeAttachment) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchOptions) DeepCopyInto(out *LaunchOptions) { *out = *in @@ -879,6 +970,22 @@ func (in *LaunchOptions) DeepCopy() *LaunchOptions { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchVolumeAttachment) DeepCopyInto(out *LaunchVolumeAttachment) { + *out = *in + in.IscsiAttachment.DeepCopyInto(&out.IscsiAttachment) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchVolumeAttachment. +func (in *LaunchVolumeAttachment) DeepCopy() *LaunchVolumeAttachment { + if in == nil { + return nil + } + out := new(LaunchVolumeAttachment) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = *in @@ -1495,6 +1602,13 @@ func (in *OCIMachineSpec) DeepCopyInto(out *OCIMachineSpec) { *out = new(string) **out = **in } + if in.LaunchVolumeAttachment != nil { + in, out := &in.LaunchVolumeAttachment, &out.LaunchVolumeAttachment + *out = make([]LaunchVolumeAttachment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.ProviderID != nil { in, out := &in.ProviderID, &out.ProviderID *out = new(string) diff --git a/api/v1beta2/ocimachine_types.go b/api/v1beta2/ocimachine_types.go index db2aa455..b0a7a3cc 100644 --- a/api/v1beta2/ocimachine_types.go +++ b/api/v1beta2/ocimachine_types.go @@ -123,11 +123,22 @@ type OCIMachineSpec struct { // +optional DefinedTags map[string]map[string]string `json:"definedTags,omitempty"` + // Volume attachments to create as part of the launch instance operation. + LaunchVolumeAttachment []LaunchVolumeAttachment `json:"launchVolumeAttachments,omitempty"` + // The name of the subnet to use. The name here refers to the subnets // defined in the OCICluster Spec. Optional, only if multiple subnets of a type // is defined, else the first element is used. // +optional SubnetName string `json:"subnetName,omitempty"` + + // Specifies whether to delete or preserve the boot volume when terminating an instance. + // When set to true, the boot volume is preserved. The default value is false. + PreserveBootVolume bool `json:"preserveBootVolume,omitempty"` + + // Specifies whether to delete or preserve the data volumes created during launch when + //terminating an instance. When set to true, the data volumes are preserved. The default value is true. + PreserveDataVolumesCreatedAtLaunch bool `json:"preserveDataVolumesCreatedAtLaunch,omitempty"` } // OCIMachineStatus defines the observed state of OCIMachine. diff --git a/api/v1beta2/types.go b/api/v1beta2/types.go index f5a01607..ed71dab6 100644 --- a/api/v1beta2/types.go +++ b/api/v1beta2/types.go @@ -1115,6 +1115,94 @@ type NetworkSecurityGroup struct { List []*NSG `json:"list,omitempty"` } +type VolumeType string + +const ( + IscsiType VolumeType = "iscsi" +) + +// EncryptionInTransitTypeEnum Enum with underlying type: string +type EncryptionInTransitTypeEnum string + +// Set of constants representing the allowable values for EncryptionInTransitTypeEnum +const ( + EncryptionInTransitTypeNone EncryptionInTransitTypeEnum = "NONE" + EncryptionInTransitTypeBmEncryptionInTransit EncryptionInTransitTypeEnum = "BM_ENCRYPTION_IN_TRANSIT" +) + +// LaunchVolumeAttachment specifies the details of the volume attachment. +type LaunchVolumeAttachment struct { + // The type of volume. Valid value is iscsi. + Type VolumeType `json:"volumeType,omitempty"` + + // The details of iscsi volume attachment. + IscsiAttachment LaunchIscsiVolumeAttachment `json:"launchIscsiVolumeAttachment,omitempty"` +} + +// LaunchIscsiVolumeAttachment specifies the iscsi volume attachments to create as part of the launch instance operation. +type LaunchIscsiVolumeAttachment struct { + // The device name. To retrieve a list of devices for a given instance, see ListInstanceDevices. + Device *string `json:"device,omitempty"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `json:"displayName,omitempty"` + + // Whether the attachment was created in read-only mode. + IsReadOnly *bool `json:"isReadOnly,omitempty"` + + // Whether the attachment should be created in shareable mode. If an attachment + // is created in shareable mode, then other instances can attach the same volume, provided + // that they also create their attachments in shareable mode. Only certain volume types can + // be attached in shareable mode. Defaults to false if not specified. + IsShareable *bool `json:"isShareable,omitempty"` + + // The OCID of the volume. If CreateVolumeDetails is specified, this field must be omitted from the request. + VolumeId *string `json:"volumeId,omitempty"` + + // LaunchCreateVolumeFromAttributes The details of the volume to create for CreateVolume operation. + LaunchCreateVolumeFromAttributes LaunchCreateVolumeFromAttributes `json:"launchCreateVolumeFromAttributes,omitempty"` + + // Whether to use CHAP authentication for the volume attachment. Defaults to false. + UseChap *bool `json:"useChap,omitempty"` + + // Whether to enable Oracle Cloud Agent to perform the iSCSI login and logout commands after the volume attach or detach operations for non multipath-enabled iSCSI attachments. + IsAgentAutoIscsiLoginEnabled *bool `json:"isAgentAutoIscsiLoginEnabled,omitempty"` + + // Refer the top-level definition of encryptionInTransitType. + // The default value is NONE. + EncryptionInTransitType EncryptionInTransitTypeEnum `json:"encryptionInTransitType,omitempty"` +} + +// LaunchCreateVolumeFromAttributes The details of the volume to create for CreateVolume operation. +type LaunchCreateVolumeFromAttributes struct { + + // The size of the volume in GBs. + SizeInGBs *int64 `json:"sizeInGBs,omitempty"` + + // The OCID of the compartment that contains the volume. If not provided, + // it will be inherited from the instance. + CompartmentId *string `json:"compartmentId,omitempty"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + // Avoid entering confidential information. + DisplayName *string `json:"displayName,omitempty"` + + // The OCID of the Vault service key to assign as the master encryption key + // for the volume. + KmsKeyId *string `json:"kmsKeyId,omitempty"` + + // The number of volume performance units (VPUs) that will be applied to this volume per GB, + // representing the Block Volume service's elastic performance options. + // See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) for more information. + // Allowed values: + // * `0`: Represents Lower Cost option. + // * `10`: Represents Balanced option. + // * `20`: Represents Higher Performance option. + // * `30`-`120`: Represents the Ultra High Performance option. + VpusPerGB *int64 `json:"vpusPerGB,omitempty"` +} + const ( VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE" FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY" diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index 436e0f34..b202baa2 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -984,6 +984,46 @@ func (in *KubernetesNetworkConfig) DeepCopy() *KubernetesNetworkConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchCreateVolumeFromAttributes) DeepCopyInto(out *LaunchCreateVolumeFromAttributes) { + *out = *in + if in.SizeInGBs != nil { + in, out := &in.SizeInGBs, &out.SizeInGBs + *out = new(int64) + **out = **in + } + if in.CompartmentId != nil { + in, out := &in.CompartmentId, &out.CompartmentId + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.KmsKeyId != nil { + in, out := &in.KmsKeyId, &out.KmsKeyId + *out = new(string) + **out = **in + } + if in.VpusPerGB != nil { + in, out := &in.VpusPerGB, &out.VpusPerGB + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchCreateVolumeFromAttributes. +func (in *LaunchCreateVolumeFromAttributes) DeepCopy() *LaunchCreateVolumeFromAttributes { + if in == nil { + return nil + } + out := new(LaunchCreateVolumeFromAttributes) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchInstanceAgentConfig) DeepCopyInto(out *LaunchInstanceAgentConfig) { *out = *in @@ -1041,6 +1081,57 @@ func (in *LaunchInstanceAvailabilityConfig) DeepCopy() *LaunchInstanceAvailabili return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchIscsiVolumeAttachment) DeepCopyInto(out *LaunchIscsiVolumeAttachment) { + *out = *in + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.IsReadOnly != nil { + in, out := &in.IsReadOnly, &out.IsReadOnly + *out = new(bool) + **out = **in + } + if in.IsShareable != nil { + in, out := &in.IsShareable, &out.IsShareable + *out = new(bool) + **out = **in + } + if in.VolumeId != nil { + in, out := &in.VolumeId, &out.VolumeId + *out = new(string) + **out = **in + } + in.LaunchCreateVolumeFromAttributes.DeepCopyInto(&out.LaunchCreateVolumeFromAttributes) + if in.UseChap != nil { + in, out := &in.UseChap, &out.UseChap + *out = new(bool) + **out = **in + } + if in.IsAgentAutoIscsiLoginEnabled != nil { + in, out := &in.IsAgentAutoIscsiLoginEnabled, &out.IsAgentAutoIscsiLoginEnabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchIscsiVolumeAttachment. +func (in *LaunchIscsiVolumeAttachment) DeepCopy() *LaunchIscsiVolumeAttachment { + if in == nil { + return nil + } + out := new(LaunchIscsiVolumeAttachment) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchOptions) DeepCopyInto(out *LaunchOptions) { *out = *in @@ -1061,6 +1152,22 @@ func (in *LaunchOptions) DeepCopy() *LaunchOptions { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LaunchVolumeAttachment) DeepCopyInto(out *LaunchVolumeAttachment) { + *out = *in + in.IscsiAttachment.DeepCopyInto(&out.IscsiAttachment) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchVolumeAttachment. +func (in *LaunchVolumeAttachment) DeepCopy() *LaunchVolumeAttachment { + if in == nil { + return nil + } + out := new(LaunchVolumeAttachment) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { *out = *in @@ -1765,6 +1872,13 @@ func (in *OCIMachineSpec) DeepCopyInto(out *OCIMachineSpec) { (*out)[key] = outVal } } + if in.LaunchVolumeAttachment != nil { + in, out := &in.LaunchVolumeAttachment, &out.LaunchVolumeAttachment + *out = make([]LaunchVolumeAttachment, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIMachineSpec. diff --git a/cloud/scope/clients.go b/cloud/scope/clients.go index a813ac2d..7958a732 100644 --- a/cloud/scope/clients.go +++ b/cloud/scope/clients.go @@ -192,19 +192,6 @@ func (c *ClientProvider) createVcnClient(region string, ociAuthConfigProvider co dispatcher := vcnClient.HTTPClient vcnClient.HTTPClient = metrics.NewHttpRequestDispatcherWrapper(dispatcher, region) - if c.certOverride != nil { - if client, ok := dispatcher.(*http.Client); ok { - err = c.setCerts(client) - if err != nil { - logger.Error(err, "unable to create OCI VCN Client") - return nil, err - } - } else { - return nil, errors.New("The VCN Client dispatcher is not of http.Client type. Can not patch the tls config.") - } - - } - if c.ociClientOverrides != nil && c.ociClientOverrides.VCNClientUrl != nil { vcnClient.Host = *c.ociClientOverrides.VCNClientUrl } @@ -223,18 +210,6 @@ func (c *ClientProvider) createNLbClient(region string, ociAuthConfigProvider co dispatcher := nlbClient.HTTPClient nlbClient.HTTPClient = metrics.NewHttpRequestDispatcherWrapper(dispatcher, region) - if c.certOverride != nil { - if client, ok := dispatcher.(*http.Client); ok { - err = c.setCerts(client) - if err != nil { - logger.Error(err, "unable to create OCI NetworkLoadBalancer Client") - return nil, err - } - } else { - return nil, errors.New("The Network Loadbalancer Client dispatcher is not of http.Client type. Can not patch the tls config.") - } - } - if c.ociClientOverrides != nil && c.ociClientOverrides.NetworkLoadBalancerClientUrl != nil { nlbClient.Host = *c.ociClientOverrides.NetworkLoadBalancerClientUrl } @@ -253,18 +228,6 @@ func (c *ClientProvider) createLBClient(region string, ociAuthConfigProvider com dispatcher := lbClient.HTTPClient lbClient.HTTPClient = metrics.NewHttpRequestDispatcherWrapper(dispatcher, region) - if c.certOverride != nil { - if client, ok := dispatcher.(*http.Client); ok { - err = c.setCerts(client) - if err != nil { - logger.Error(err, "unable to create OCI Loadbalancer Client") - return nil, err - } - } else { - return nil, errors.New("The Loadbalancer Client dispatcher is not of http.Client type. Can not patch the tls config.") - } - } - if c.ociClientOverrides != nil && c.ociClientOverrides.LoadBalancerClientUrl != nil { lbClient.Host = *c.ociClientOverrides.LoadBalancerClientUrl } @@ -283,18 +246,6 @@ func (c *ClientProvider) createIdentityClient(region string, ociAuthConfigProvid dispatcher := identityClt.HTTPClient identityClt.HTTPClient = metrics.NewHttpRequestDispatcherWrapper(dispatcher, region) - if c.certOverride != nil { - if client, ok := dispatcher.(*http.Client); ok { - err = c.setCerts(client) - if err != nil { - logger.Error(err, "unable to create OCI Identity Client") - return nil, err - } - } else { - return nil, errors.New("The Identity Client dispatcher is not of http.Client type. Can not patch the tls config.") - } - } - if c.ociClientOverrides != nil && c.ociClientOverrides.IdentityClientUrl != nil { identityClt.Host = *c.ociClientOverrides.IdentityClientUrl } @@ -313,18 +264,6 @@ func (c *ClientProvider) createComputeClient(region string, ociAuthConfigProvide dispatcher := computeClient.HTTPClient computeClient.HTTPClient = metrics.NewHttpRequestDispatcherWrapper(dispatcher, region) - if c.certOverride != nil { - if client, ok := dispatcher.(*http.Client); ok { - err = c.setCerts(client) - if err != nil { - logger.Error(err, "unable to create OCI Compute Client") - return nil, err - } - } else { - return nil, errors.New("The Compute Client dispatcher is not of http.Client type. Can not patch the tls config.") - } - } - if c.ociClientOverrides != nil && c.ociClientOverrides.ComputeClientUrl != nil { computeClient.Host = *c.ociClientOverrides.ComputeClientUrl } @@ -343,18 +282,6 @@ func (c *ClientProvider) createComputeManagementClient(region string, ociAuthCon dispatcher := computeManagementClient.HTTPClient computeManagementClient.HTTPClient = metrics.NewHttpRequestDispatcherWrapper(dispatcher, region) - if c.certOverride != nil { - if client, ok := dispatcher.(*http.Client); ok { - err = c.setCerts(client) - if err != nil { - logger.Error(err, "unable to create OCI Compute Management Client") - return nil, err - } - } else { - return nil, errors.New("The Compute Management Client dispatcher is not of http.Client type. Can not patch the tls config.") - } - } - if c.ociClientOverrides != nil && c.ociClientOverrides.ComputeManagementClientUrl != nil { computeManagementClient.Host = *c.ociClientOverrides.ComputeManagementClientUrl } @@ -373,18 +300,6 @@ func (c *ClientProvider) createContainerEngineClient(region string, ociAuthConfi dispatcher := containerEngineClt.HTTPClient containerEngineClt.HTTPClient = metrics.NewHttpRequestDispatcherWrapper(dispatcher, region) - if c.certOverride != nil { - if client, ok := dispatcher.(*http.Client); ok { - err = c.setCerts(client) - if err != nil { - logger.Error(err, "unable to create OCI Container Engine Client") - return nil, err - } - } else { - return nil, errors.New("The Container Engine Client dispatcher is not of http.Client type. Can not patch the tls config.") - } - } - if c.ociClientOverrides != nil && c.ociClientOverrides.ContainerEngineClientUrl != nil { containerEngineClt.Host = *c.ociClientOverrides.ContainerEngineClientUrl } @@ -409,17 +324,3 @@ func setVersionHeader() func(request *http.Request) error { } } -// setCerts updates the client TLSClientConfig with the ClientProvider certOverride -func (c *ClientProvider) setCerts(client *http.Client) error { - tr := client.Transport.(*http.Transport).Clone() - if tr.TLSClientConfig != nil { - tr.TLSClientConfig.RootCAs = c.certOverride - } else { - // If TLS client config is not set, we should error out. else the default values will - // be used which will be insecure - return errors.New("TLSClientConfig is not set on the client") - } - client.Transport = tr - - return nil -} diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index e61d7792..3371ffd6 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -281,6 +281,7 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance, launchDetails.AvailabilityConfig = m.getAvailabilityConfig() launchDetails.PreemptibleInstanceConfig = m.getPreemptibleInstanceConfig() launchDetails.PlatformConfig = m.getPlatformConfig() + launchDetails.LaunchVolumeAttachments = m.getLaunchVolumeAttachments() req := core.LaunchInstanceRequest{LaunchInstanceDetails: launchDetails, OpcRetryToken: ociutil.GetOPCRetryToken(string(m.OCIMachine.UID))} resp, err := m.ComputeClient.LaunchInstance(ctx, req) @@ -310,7 +311,9 @@ func (m *MachineScope) getFreeFormTags() map[string]string { // DeleteMachine terminates the instance using InstanceId from the OCIMachine spec and deletes the boot volume func (m *MachineScope) DeleteMachine(ctx context.Context, instance *core.Instance) error { req := core.TerminateInstanceRequest{InstanceId: instance.Id, - PreserveBootVolume: common.Bool(false)} + PreserveBootVolume: common.Bool(m.OCIMachine.Spec.PreserveBootVolume), + PreserveDataVolumesCreatedAtLaunch: common.Bool(m.OCIMachine.Spec.PreserveDataVolumesCreatedAtLaunch), + } _, err := m.ComputeClient.TerminateInstance(ctx, req) return err } @@ -979,3 +982,56 @@ func (m *MachineScope) getPlatformConfig() core.PlatformConfig { } return nil } + +func (m *MachineScope) getLaunchVolumeAttachments() []core.LaunchAttachVolumeDetails { + volumeAttachmentsInSpec := m.OCIMachine.Spec.LaunchVolumeAttachment + if len(volumeAttachmentsInSpec) < 0 { + return nil + } + var volumes []core.LaunchAttachVolumeDetails + + for _, attachment := range volumeAttachmentsInSpec { + if attachment.Type == infrastructurev1beta2.IscsiType { + volumes = append(volumes, getIscsiVolumeAttachment(attachment.IscsiAttachment)) + } + } + return volumes +} + +func getIscsiVolumeAttachment(attachment infrastructurev1beta2.LaunchIscsiVolumeAttachment) core.LaunchAttachVolumeDetails { + volumeDetails := core.LaunchAttachIScsiVolumeDetails{ + Device: attachment.Device, + DisplayName: attachment.DisplayName, + IsShareable: attachment.IsShareable, + IsReadOnly: attachment.IsReadOnly, + VolumeId: attachment.VolumeId, + UseChap: attachment.UseChap, + IsAgentAutoIscsiLoginEnabled: attachment.IsAgentAutoIscsiLoginEnabled, + EncryptionInTransitType: getEncryptionType(attachment.EncryptionInTransitType), + LaunchCreateVolumeDetails: getLaunchCreateVolumeDetails(attachment.LaunchCreateVolumeFromAttributes), + } + return volumeDetails +} + +func getLaunchCreateVolumeDetails(attributes infrastructurev1beta2.LaunchCreateVolumeFromAttributes) core.LaunchCreateVolumeFromAttributes { + return core.LaunchCreateVolumeFromAttributes{ + SizeInGBs: attributes.SizeInGBs, + DisplayName: attributes.DisplayName, + CompartmentId: attributes.CompartmentId, + KmsKeyId: attributes.KmsKeyId, + VpusPerGB: attributes.VpusPerGB, + } +} + +func getEncryptionType(transitType infrastructurev1beta2.EncryptionInTransitTypeEnum) core.EncryptionInTransitTypeEnum { + if transitType == "" { + return "" + } + switch transitType { + case infrastructurev1beta2.EncryptionInTransitTypeNone: + return core.EncryptionInTransitTypeNone + case infrastructurev1beta2.EncryptionInTransitTypeBmEncryptionInTransit: + return core.EncryptionInTransitTypeBmEncryptionInTransit + } + return "" +} diff --git a/cloud/scope/machine_test.go b/cloud/scope/machine_test.go index 9069d635..79c322d3 100644 --- a/cloud/scope/machine_test.go +++ b/cloud/scope/machine_test.go @@ -470,6 +470,20 @@ func TestInstanceReconciliation(t *testing.T) { ms.OCIMachine.Spec.NetworkDetails.SkipSourceDestCheck = common.Bool(true) ms.OCIMachine.Spec.NetworkDetails.AssignPrivateDnsRecord = common.Bool(true) ms.OCIMachine.Spec.NetworkDetails.DisplayName = common.String("display-name") + ms.OCIMachine.Spec.LaunchVolumeAttachment = []infrastructurev1beta2.LaunchVolumeAttachment{ + { + Type: infrastructurev1beta2.IscsiType, + IscsiAttachment: infrastructurev1beta2.LaunchIscsiVolumeAttachment{ + Device: common.String("/dev/oci"), + IsShareable: common.Bool(true), + LaunchCreateVolumeFromAttributes: infrastructurev1beta2.LaunchCreateVolumeFromAttributes{ + DisplayName: common.String("test-volume"), + SizeInGBs: common.Int64(75), + VpusPerGB: common.Int64(20), + }, + }, + }, + } ms.OCIMachine.Spec.InstanceSourceViaImageDetails = &infrastructurev1beta2.InstanceSourceViaImageConfig{ KmsKeyId: common.String("kms-key-id"), BootVolumeVpusPerGB: common.Int64(32), @@ -502,6 +516,17 @@ func TestInstanceReconciliation(t *testing.T) { AssignPrivateDnsRecord: common.Bool(true), DisplayName: common.String("display-name"), }, + LaunchVolumeAttachments: []core.LaunchAttachVolumeDetails{ + core.LaunchAttachIScsiVolumeDetails{ + Device: common.String("/dev/oci"), + IsShareable: common.Bool(true), + LaunchCreateVolumeDetails: core.LaunchCreateVolumeFromAttributes{ + DisplayName: common.String("test-volume"), + SizeInGBs: common.Int64(75), + VpusPerGB: common.Int64(20), + }, + }, + }, Metadata: map[string]string{ "user_data": base64.StdEncoding.EncodeToString([]byte("test")), }, @@ -2499,8 +2524,9 @@ func TestInstanceDeletion(t *testing.T) { testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { ms.OCIMachine.Spec.InstanceId = common.String("test") computeClient.EXPECT().TerminateInstance(gomock.Any(), gomock.Eq(core.TerminateInstanceRequest{ - InstanceId: common.String("test"), - PreserveBootVolume: common.Bool(false), + InstanceId: common.String("test"), + PreserveBootVolume: common.Bool(false), + PreserveDataVolumesCreatedAtLaunch: common.Bool(false), })).Return(core.TerminateInstanceResponse{}, nil) }, instance: &core.Instance{ @@ -2514,8 +2540,9 @@ func TestInstanceDeletion(t *testing.T) { testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) { ms.OCIMachine.Spec.InstanceId = common.String("test") computeClient.EXPECT().TerminateInstance(gomock.Any(), gomock.Eq(core.TerminateInstanceRequest{ - InstanceId: common.String("test"), - PreserveBootVolume: common.Bool(false), + InstanceId: common.String("test"), + PreserveBootVolume: common.Bool(false), + PreserveDataVolumesCreatedAtLaunch: common.Bool(false), })).Return(core.TerminateInstanceResponse{}, errors.New("could not terminate instance")) }, instance: &core.Instance{ diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml index de68ca3a..daddc19a 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachines.yaml @@ -248,6 +248,91 @@ spec: and remote block storage volumes on platform images. type: string type: object + launchVolumeAttachments: + description: Volume attachments to create as part of the launch instance + operation. + items: + properties: + launchIscsiVolumeAttachment: + description: The details of iscsi volume attachment. + properties: + device: + description: The device name. To retrieve a list of devices + for a given instance, see ListInstanceDevices. + type: string + displayName: + description: A user-friendly name. Does not have to be unique, + and it's changeable. Avoid entering confidential information. + type: string + encryptionInTransitType: + description: Refer the top-level definition of encryptionInTransitType. + The default value is NONE. + type: string + isAgentAutoIscsiLoginEnabled: + description: Whether to enable Oracle Cloud Agent to perform + the iSCSI login and logout commands after the volume attach + or detach operations for non multipath-enabled iSCSI attachments. + type: boolean + isReadOnly: + description: Whether the attachment was created in read-only + mode. + type: boolean + isShareable: + description: Whether the attachment should be created in + shareable mode. If an attachment is created in shareable + mode, then other instances can attach the same volume, + provided that they also create their attachments in shareable + mode. Only certain volume types can be attached in shareable + mode. Defaults to false if not specified. + type: boolean + launchCreateVolumeFromAttributes: + description: LaunchCreateVolumeFromAttributes The details + of the volume to create for CreateVolume operation. + properties: + compartmentId: + description: The OCID of the compartment that contains + the volume. If not provided, it will be inherited + from the instance. + type: string + displayName: + description: A user-friendly name. Does not have to + be unique, and it's changeable. Avoid entering confidential + information. + type: string + kmsKeyId: + description: The OCID of the Vault service key to assign + as the master encryption key for the volume. + type: string + sizeInGBs: + description: The size of the volume in GBs. + format: int64 + type: integer + vpusPerGB: + description: 'The number of volume performance units + (VPUs) that will be applied to this volume per GB, + representing the Block Volume service''s elastic performance + options. See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) + for more information. Allowed values: * `0`: Represents + Lower Cost option. * `10`: Represents Balanced option. + * `20`: Represents Higher Performance option. * `30`-`120`: + Represents the Ultra High Performance option.' + format: int64 + type: integer + type: object + useChap: + description: Whether to use CHAP authentication for the + volume attachment. Defaults to false. + type: boolean + volumeId: + description: The OCID of the volume. If CreateVolumeDetails + is specified, this field must be omitted from the request. + type: string + type: object + volumeType: + description: The type of volume. Valid value is iscsi. + type: string + type: object + type: array metadata: additionalProperties: type: string @@ -629,6 +714,16 @@ spec: type: boolean type: object type: object + preserveBootVolume: + description: Specifies whether to delete or preserve the boot volume + when terminating an instance. When set to true, the boot volume + is preserved. The default value is false. + type: boolean + preserveDataVolumesCreatedAtLaunch: + description: Specifies whether to delete or preserve the data volumes + created during launch when terminating an instance. When set to + true, the data volumes are preserved. The default value is true. + type: boolean providerID: description: Provider ID of the instance, this will be set by Cluster API provider itself, users should not set this parameter. @@ -1022,6 +1117,93 @@ spec: and remote block storage volumes on platform images. type: string type: object + launchVolumeAttachments: + description: Volume attachments to create as part of the launch instance + operation. + items: + description: LaunchVolumeAttachment specifies the details of the + volume attachment. + properties: + launchIscsiVolumeAttachment: + description: The details of iscsi volume attachment. + properties: + device: + description: The device name. To retrieve a list of devices + for a given instance, see ListInstanceDevices. + type: string + displayName: + description: A user-friendly name. Does not have to be unique, + and it's changeable. Avoid entering confidential information. + type: string + encryptionInTransitType: + description: Refer the top-level definition of encryptionInTransitType. + The default value is NONE. + type: string + isAgentAutoIscsiLoginEnabled: + description: Whether to enable Oracle Cloud Agent to perform + the iSCSI login and logout commands after the volume attach + or detach operations for non multipath-enabled iSCSI attachments. + type: boolean + isReadOnly: + description: Whether the attachment was created in read-only + mode. + type: boolean + isShareable: + description: Whether the attachment should be created in + shareable mode. If an attachment is created in shareable + mode, then other instances can attach the same volume, + provided that they also create their attachments in shareable + mode. Only certain volume types can be attached in shareable + mode. Defaults to false if not specified. + type: boolean + launchCreateVolumeFromAttributes: + description: LaunchCreateVolumeFromAttributes The details + of the volume to create for CreateVolume operation. + properties: + compartmentId: + description: The OCID of the compartment that contains + the volume. If not provided, it will be inherited + from the instance. + type: string + displayName: + description: A user-friendly name. Does not have to + be unique, and it's changeable. Avoid entering confidential + information. + type: string + kmsKeyId: + description: The OCID of the Vault service key to assign + as the master encryption key for the volume. + type: string + sizeInGBs: + description: The size of the volume in GBs. + format: int64 + type: integer + vpusPerGB: + description: 'The number of volume performance units + (VPUs) that will be applied to this volume per GB, + representing the Block Volume service''s elastic performance + options. See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) + for more information. Allowed values: * `0`: Represents + Lower Cost option. * `10`: Represents Balanced option. + * `20`: Represents Higher Performance option. * `30`-`120`: + Represents the Ultra High Performance option.' + format: int64 + type: integer + type: object + useChap: + description: Whether to use CHAP authentication for the + volume attachment. Defaults to false. + type: boolean + volumeId: + description: The OCID of the volume. If CreateVolumeDetails + is specified, this field must be omitted from the request. + type: string + type: object + volumeType: + description: The type of volume. Valid value is iscsi. + type: string + type: object + type: array metadata: additionalProperties: type: string @@ -1397,6 +1579,16 @@ spec: type: boolean type: object type: object + preserveBootVolume: + description: Specifies whether to delete or preserve the boot volume + when terminating an instance. When set to true, the boot volume + is preserved. The default value is false. + type: boolean + preserveDataVolumesCreatedAtLaunch: + description: Specifies whether to delete or preserve the data volumes + created during launch when terminating an instance. When set to + true, the data volumes are preserved. The default value is true. + type: boolean providerID: description: Provider ID of the instance, this will be set by Cluster API provider itself, users should not set this parameter. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml index f8c7b5cd..3f209fac 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ocimachinetemplates.yaml @@ -274,6 +274,99 @@ spec: block storage volumes on platform images. type: string type: object + launchVolumeAttachments: + description: Volume attachments to create as part of the launch + instance operation. + items: + properties: + launchIscsiVolumeAttachment: + description: The details of iscsi volume attachment. + properties: + device: + description: The device name. To retrieve a list + of devices for a given instance, see ListInstanceDevices. + type: string + displayName: + description: A user-friendly name. Does not have + to be unique, and it's changeable. Avoid entering + confidential information. + type: string + encryptionInTransitType: + description: Refer the top-level definition of encryptionInTransitType. + The default value is NONE. + type: string + isAgentAutoIscsiLoginEnabled: + description: Whether to enable Oracle Cloud Agent + to perform the iSCSI login and logout commands + after the volume attach or detach operations for + non multipath-enabled iSCSI attachments. + type: boolean + isReadOnly: + description: Whether the attachment was created + in read-only mode. + type: boolean + isShareable: + description: Whether the attachment should be created + in shareable mode. If an attachment is created + in shareable mode, then other instances can attach + the same volume, provided that they also create + their attachments in shareable mode. Only certain + volume types can be attached in shareable mode. + Defaults to false if not specified. + type: boolean + launchCreateVolumeFromAttributes: + description: LaunchCreateVolumeFromAttributes The + details of the volume to create for CreateVolume + operation. + properties: + compartmentId: + description: The OCID of the compartment that + contains the volume. If not provided, it will + be inherited from the instance. + type: string + displayName: + description: A user-friendly name. Does not + have to be unique, and it's changeable. Avoid + entering confidential information. + type: string + kmsKeyId: + description: The OCID of the Vault service key + to assign as the master encryption key for + the volume. + type: string + sizeInGBs: + description: The size of the volume in GBs. + format: int64 + type: integer + vpusPerGB: + description: 'The number of volume performance + units (VPUs) that will be applied to this + volume per GB, representing the Block Volume + service''s elastic performance options. See + Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) + for more information. Allowed values: * `0`: + Represents Lower Cost option. * `10`: Represents + Balanced option. * `20`: Represents Higher + Performance option. * `30`-`120`: Represents + the Ultra High Performance option.' + format: int64 + type: integer + type: object + useChap: + description: Whether to use CHAP authentication + for the volume attachment. Defaults to false. + type: boolean + volumeId: + description: The OCID of the volume. If CreateVolumeDetails + is specified, this field must be omitted from + the request. + type: string + type: object + volumeType: + description: The type of volume. Valid value is iscsi. + type: string + type: object + type: array metadata: additionalProperties: type: string @@ -686,6 +779,17 @@ spec: type: boolean type: object type: object + preserveBootVolume: + description: Specifies whether to delete or preserve the boot + volume when terminating an instance. When set to true, the + boot volume is preserved. The default value is false. + type: boolean + preserveDataVolumesCreatedAtLaunch: + description: Specifies whether to delete or preserve the data + volumes created during launch when terminating an instance. + When set to true, the data volumes are preserved. The default + value is true. + type: boolean providerID: description: Provider ID of the instance, this will be set by Cluster API provider itself, users should not set this @@ -1029,6 +1133,101 @@ spec: block storage volumes on platform images. type: string type: object + launchVolumeAttachments: + description: Volume attachments to create as part of the launch + instance operation. + items: + description: LaunchVolumeAttachment specifies the details + of the volume attachment. + properties: + launchIscsiVolumeAttachment: + description: The details of iscsi volume attachment. + properties: + device: + description: The device name. To retrieve a list + of devices for a given instance, see ListInstanceDevices. + type: string + displayName: + description: A user-friendly name. Does not have + to be unique, and it's changeable. Avoid entering + confidential information. + type: string + encryptionInTransitType: + description: Refer the top-level definition of encryptionInTransitType. + The default value is NONE. + type: string + isAgentAutoIscsiLoginEnabled: + description: Whether to enable Oracle Cloud Agent + to perform the iSCSI login and logout commands + after the volume attach or detach operations for + non multipath-enabled iSCSI attachments. + type: boolean + isReadOnly: + description: Whether the attachment was created + in read-only mode. + type: boolean + isShareable: + description: Whether the attachment should be created + in shareable mode. If an attachment is created + in shareable mode, then other instances can attach + the same volume, provided that they also create + their attachments in shareable mode. Only certain + volume types can be attached in shareable mode. + Defaults to false if not specified. + type: boolean + launchCreateVolumeFromAttributes: + description: LaunchCreateVolumeFromAttributes The + details of the volume to create for CreateVolume + operation. + properties: + compartmentId: + description: The OCID of the compartment that + contains the volume. If not provided, it will + be inherited from the instance. + type: string + displayName: + description: A user-friendly name. Does not + have to be unique, and it's changeable. Avoid + entering confidential information. + type: string + kmsKeyId: + description: The OCID of the Vault service key + to assign as the master encryption key for + the volume. + type: string + sizeInGBs: + description: The size of the volume in GBs. + format: int64 + type: integer + vpusPerGB: + description: 'The number of volume performance + units (VPUs) that will be applied to this + volume per GB, representing the Block Volume + service''s elastic performance options. See + Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) + for more information. Allowed values: * `0`: + Represents Lower Cost option. * `10`: Represents + Balanced option. * `20`: Represents Higher + Performance option. * `30`-`120`: Represents + the Ultra High Performance option.' + format: int64 + type: integer + type: object + useChap: + description: Whether to use CHAP authentication + for the volume attachment. Defaults to false. + type: boolean + volumeId: + description: The OCID of the volume. If CreateVolumeDetails + is specified, this field must be omitted from + the request. + type: string + type: object + volumeType: + description: The type of volume. Valid value is iscsi. + type: string + type: object + type: array metadata: additionalProperties: type: string @@ -1435,6 +1634,17 @@ spec: type: boolean type: object type: object + preserveBootVolume: + description: Specifies whether to delete or preserve the boot + volume when terminating an instance. When set to true, the + boot volume is preserved. The default value is false. + type: boolean + preserveDataVolumesCreatedAtLaunch: + description: Specifies whether to delete or preserve the data + volumes created during launch when terminating an instance. + When set to true, the data volumes are preserved. The default + value is true. + type: boolean providerID: description: Provider ID of the instance, this will be set by Cluster API provider itself, users should not set this diff --git a/controllers/ocimachine_controller_test.go b/controllers/ocimachine_controller_test.go index 7a1009f8..9bba4d56 100644 --- a/controllers/ocimachine_controller_test.go +++ b/controllers/ocimachine_controller_test.go @@ -875,8 +875,9 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { }, }, nil) computeClient.EXPECT().TerminateInstance(gomock.Any(), gomock.Eq(core.TerminateInstanceRequest{ - InstanceId: common.String("test"), - PreserveBootVolume: common.Bool(false), + InstanceId: common.String("test"), + PreserveBootVolume: common.Bool(false), + PreserveDataVolumesCreatedAtLaunch: common.Bool(false), })).Return(core.TerminateInstanceResponse{}, nil) }, }, @@ -938,8 +939,9 @@ func TestMachineReconciliationDeletionNormal(t *testing.T) { }}, nil) computeClient.EXPECT().TerminateInstance(gomock.Any(), gomock.Eq(core.TerminateInstanceRequest{ - InstanceId: common.String("test"), - PreserveBootVolume: common.Bool(false), + InstanceId: common.String("test"), + PreserveBootVolume: common.Bool(false), + PreserveDataVolumesCreatedAtLaunch: common.Bool(false), })).Return(core.TerminateInstanceResponse{}, nil) }, }, diff --git a/go.mod b/go.mod index 2f871ba5..3ecb2412 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/google/gofuzz v1.2.0 github.com/onsi/ginkgo/v2 v2.13.1 github.com/onsi/gomega v1.30.0 - github.com/oracle/oci-go-sdk/v65 v65.45.0 + github.com/oracle/oci-go-sdk/v65 v65.61.2 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.17.0 github.com/spf13/pflag v1.0.5 @@ -22,7 +22,7 @@ require ( sigs.k8s.io/cluster-api v1.6.3 sigs.k8s.io/cluster-api/test v1.6.3 sigs.k8s.io/controller-runtime v0.16.5 - sigs.k8s.io/kind v0.20.0 + sigs.k8s.io/kind v0.21.0 ) require ( diff --git a/go.sum b/go.sum index 3f76af71..86b10ae8 100644 --- a/go.sum +++ b/go.sum @@ -290,8 +290,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/oracle/oci-go-sdk/v65 v65.45.0 h1:EpCst/iZma9s8eYS0QJ9qsTmGxX5GPehYGN1jwGIteU= -github.com/oracle/oci-go-sdk/v65 v65.45.0/go.mod h1:IBEV9l1qBzUpo7zgGaRUhbB05BVfcDGYRFBCPlTcPp0= +github.com/oracle/oci-go-sdk/v65 v65.61.2 h1:NiwGl+g1r1ibBbntqBeYWgP8GuSDPYRevpM4MUkBFpg= +github.com/oracle/oci-go-sdk/v65 v65.61.2/go.mod h1:IBEV9l1qBzUpo7zgGaRUhbB05BVfcDGYRFBCPlTcPp0= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -778,8 +778,8 @@ sigs.k8s.io/controller-runtime v0.16.5 h1:yr1cEJbX08xsTW6XEIzT13KHHmIyX8Umvme2cU sigs.k8s.io/controller-runtime v0.16.5/go.mod h1:j7bialYoSn142nv9sCOJmQgDXQXxnroFU4VnX/brVJ0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= -sigs.k8s.io/kind v0.20.0 h1:f0sc3v9mQbGnjBUaqSFST1dwIuiikKVGgoTwpoP33a8= -sigs.k8s.io/kind v0.20.0/go.mod h1:aBlbxg08cauDgZ612shr017/rZwqd7AS563FvpWKPVs= +sigs.k8s.io/kind v0.21.0 h1:QgkVrW35dMXNLkWlUkq2uFQNQbPLr0Z6RgRH5P/NzZU= +sigs.k8s.io/kind v0.21.0/go.mod h1:aBlbxg08cauDgZ612shr017/rZwqd7AS563FvpWKPVs= sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/test/e2e/data/infrastructure-oci/v1beta2/bases/md.yaml b/test/e2e/data/infrastructure-oci/v1beta2/bases/md.yaml index e3f0c082..adb0229e 100644 --- a/test/e2e/data/infrastructure-oci/v1beta2/bases/md.yaml +++ b/test/e2e/data/infrastructure-oci/v1beta2/bases/md.yaml @@ -13,6 +13,13 @@ spec: ocpus: "1" metadata: ssh_authorized_keys: "${OCI_SSH_KEY}" + launchVolumeAttachments: + - volumeType: "iscsi" + launchIscsiVolumeAttachment: + launchCreateVolumeFromAttributes: + sizeInGBs: 75 + encryptionInTransitType: "BM_ENCRYPTION_IN_TRANSIT" + isAgentAutoIscsiLoginEnabled: true --- apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 kind: KubeadmConfigTemplate