Skip to content

Commit a1ea85b

Browse files
Add support for launch volumes (#361)
* Add support for volume attachments during launch instance
1 parent 5a4f2c9 commit a1ea85b

17 files changed

+1065
-115
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ $(KUSTOMIZE): ## Download kustomize locally if necessary.
378378
GOBIN=$(BIN_DIR)/ $(GO_INSTALL) sigs.k8s.io/kustomize/kustomize/v4 $(KUSTOMIZE_BIN) v4.5.2
379379

380380
$(GINKGO): ## Build ginkgo.
381-
GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/onsi/ginkgo/v2/ginkgo $(GINKGO_BIN) v2.11.0
381+
GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/onsi/ginkgo/v2/ginkgo $(GINKGO_BIN) v2.13.1
382382

383383
$(GOLANGCI_LINT): ## Build golanci-lint.
384384
GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) v1.44.0

api/v1beta1/ocimachine_types.go

+11
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ type OCIMachineSpec struct {
9595
// DedicatedVmHostId defines the OCID of the dedicated VM host.
9696
DedicatedVmHostId *string `json:"dedicatedVmHostId,omitempty"`
9797

98+
// Volume attachments to create as part of the launch instance operation.
99+
LaunchVolumeAttachment []LaunchVolumeAttachment `json:"launchVolumeAttachments,omitempty"`
100+
98101
// Provider ID of the instance, this will be set by Cluster API provider itself,
99102
// users should not set this parameter.
100103
// +optional
@@ -134,6 +137,14 @@ type OCIMachineSpec struct {
134137
// +optional
135138
// Deprecated, please use NetworkDetails.NSGNames
136139
NSGName string `json:"nsgName,omitempty"`
140+
141+
// Specifies whether to delete or preserve the boot volume when terminating an instance.
142+
// When set to true, the boot volume is preserved. The default value is false.
143+
PreserveBootVolume bool `json:"preserveBootVolume,omitempty"`
144+
145+
// Specifies whether to delete or preserve the data volumes created during launch when
146+
//terminating an instance. When set to true, the data volumes are preserved. The default value is true.
147+
PreserveDataVolumesCreatedAtLaunch bool `json:"preserveDataVolumesCreatedAtLaunch,omitempty"`
137148
}
138149

139150
// OCIMachineStatus defines the observed state of OCIMachine.

api/v1beta1/types.go

+87
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,93 @@ type RemotePeeringConnection struct {
10461046
RPCConnectionId *string `json:"rpcConnectionId,omitempty"`
10471047
}
10481048

1049+
type VolumeType string
1050+
1051+
const (
1052+
IscsiType VolumeType = "iscsi"
1053+
)
1054+
1055+
// EncryptionInTransitTypeEnum Enum with underlying type: string
1056+
type EncryptionInTransitTypeEnum string
1057+
1058+
// Set of constants representing the allowable values for EncryptionInTransitTypeEnum
1059+
const (
1060+
EncryptionInTransitTypeNone EncryptionInTransitTypeEnum = "NONE"
1061+
EncryptionInTransitTypeBmEncryptionInTransit EncryptionInTransitTypeEnum = "BM_ENCRYPTION_IN_TRANSIT"
1062+
)
1063+
1064+
type LaunchVolumeAttachment struct {
1065+
// The type of volume. Valid value is iscsi.
1066+
Type VolumeType `json:"volumeType,omitempty"`
1067+
1068+
// The details of iscsi volume attachment.
1069+
IscsiAttachment LaunchIscsiVolumeAttachment `json:"launchIscsiVolumeAttachment,omitempty"`
1070+
}
1071+
1072+
// LaunchIscsiVolumeAttachment specifies the iscsi volume attachments to create as part of the launch instance operation.
1073+
type LaunchIscsiVolumeAttachment struct {
1074+
// The device name. To retrieve a list of devices for a given instance, see ListInstanceDevices.
1075+
Device *string `json:"device,omitempty"`
1076+
1077+
// A user-friendly name. Does not have to be unique, and it's changeable.
1078+
// Avoid entering confidential information.
1079+
DisplayName *string `json:"displayName,omitempty"`
1080+
1081+
// Whether the attachment was created in read-only mode.
1082+
IsReadOnly *bool `json:"isReadOnly,omitempty"`
1083+
1084+
// Whether the attachment should be created in shareable mode. If an attachment
1085+
// is created in shareable mode, then other instances can attach the same volume, provided
1086+
// that they also create their attachments in shareable mode. Only certain volume types can
1087+
// be attached in shareable mode. Defaults to false if not specified.
1088+
IsShareable *bool `json:"isShareable,omitempty"`
1089+
1090+
// The OCID of the volume. If CreateVolumeDetails is specified, this field must be omitted from the request.
1091+
VolumeId *string `json:"volumeId,omitempty"`
1092+
1093+
// LaunchCreateVolumeFromAttributes The details of the volume to create for CreateVolume operation.
1094+
LaunchCreateVolumeFromAttributes LaunchCreateVolumeFromAttributes `json:"launchCreateVolumeFromAttributes,omitempty"`
1095+
1096+
// Whether to use CHAP authentication for the volume attachment. Defaults to false.
1097+
UseChap *bool `json:"useChap,omitempty"`
1098+
1099+
// 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.
1100+
IsAgentAutoIscsiLoginEnabled *bool `json:"isAgentAutoIscsiLoginEnabled,omitempty"`
1101+
1102+
// Refer the top-level definition of encryptionInTransitType.
1103+
// The default value is NONE.
1104+
EncryptionInTransitType EncryptionInTransitTypeEnum `json:"encryptionInTransitType,omitempty"`
1105+
}
1106+
1107+
// LaunchCreateVolumeFromAttributes The details of the volume to create for CreateVolume operation.
1108+
type LaunchCreateVolumeFromAttributes struct {
1109+
1110+
// The size of the volume in GBs.
1111+
SizeInGBs *int64 `json:"sizeInGBs,omitempty"`
1112+
1113+
// The OCID of the compartment that contains the volume. If not provided,
1114+
// it will be inherited from the instance.
1115+
CompartmentId *string `json:"compartmentId,omitempty"`
1116+
1117+
// A user-friendly name. Does not have to be unique, and it's changeable.
1118+
// Avoid entering confidential information.
1119+
DisplayName *string `json:"displayName,omitempty"`
1120+
1121+
// The OCID of the Vault service key to assign as the master encryption key
1122+
// for the volume.
1123+
KmsKeyId *string `json:"kmsKeyId,omitempty"`
1124+
1125+
// The number of volume performance units (VPUs) that will be applied to this volume per GB,
1126+
// representing the Block Volume service's elastic performance options.
1127+
// See Block Volume Performance Levels (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) for more information.
1128+
// Allowed values:
1129+
// * `0`: Represents Lower Cost option.
1130+
// * `10`: Represents Balanced option.
1131+
// * `20`: Represents Higher Performance option.
1132+
// * `30`-`120`: Represents the Ultra High Performance option.
1133+
VpusPerGB *int64 `json:"vpusPerGB,omitempty"`
1134+
}
1135+
10491136
const (
10501137
VCNNativeCNI CNIOptionEnum = "OCI_VCN_IP_NATIVE"
10511138
FlannelCNI CNIOptionEnum = "FLANNEL_OVERLAY"

api/v1beta1/zz_generated.conversion.go

+130
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)