Skip to content

Commit 3717901

Browse files
Add support for compute cluster id
1 parent 0cbecd1 commit 3717901

File tree

6 files changed

+43
-5
lines changed

6 files changed

+43
-5
lines changed

api/v1beta1/ocimachine_types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ type OCIMachineSpec struct {
4848
// Shape of the instance.
4949
Shape string `json:"shape,omitempty"`
5050

51+
// ComputeClusterId refers to OCID of the compute cluster that the instance will be created in.
52+
// Please refer https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/compute-clusters.htm for more details
53+
ComputeClusterId *string `json:"computeClusterId,omitempty"`
54+
55+
// LaunchMode specifies the configuration mode for launching virtual machine (VM) instances.
56+
LaunchMode *LaunchMode `json:"launchMode,omitempty"`
57+
58+
// IpxeScript is the custom iPXE script that will run when the instance boots.
5159
IpxeScript *string `json:"ipxeScript,omitempty"`
5260

5361
// CapacityReservationId defines the OCID of the compute capacity reservation this instance is launched under.
@@ -167,6 +175,15 @@ type OCIMachineStatus struct {
167175
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
168176
}
169177

178+
type LaunchMode string
179+
180+
const (
181+
LaunchModeNative LaunchMode = "NATIVE"
182+
LaunchModeEmulated LaunchMode = "EMULATED"
183+
LaunchModeParavirtualized LaunchMode = "PARAVIRTUALIZED"
184+
LaunchModeCustom LaunchMode = "CUSTOM"
185+
)
186+
170187
//+kubebuilder:object:root=true
171188
//+kubebuilder:subresource:status
172189

api/v1beta2/ocimachine_types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ type OCIMachineSpec struct {
4848
// Shape of the instance.
4949
Shape string `json:"shape,omitempty"`
5050

51+
// ComputeClusterId refers to OCID of the compute cluster that the instance will be created in.
52+
// Please refer https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/compute-clusters.htm for more details
53+
ComputeClusterId *string `json:"computeClusterId,omitempty"`
54+
55+
// LaunchMode specifies the configuration mode for launching virtual machine (VM) instances.
56+
LaunchMode *LaunchMode `json:"launchMode,omitempty"`
57+
58+
// IpxeScript is the custom iPXE script that will run when the instance boots.
5159
IpxeScript *string `json:"ipxeScript,omitempty"`
5260

5361
// CapacityReservationId defines the OCID of the compute capacity reservation this instance is launched under.
@@ -160,6 +168,15 @@ type OCIMachineStatus struct {
160168
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
161169
}
162170

171+
type LaunchMode string
172+
173+
const (
174+
LaunchModeNative LaunchMode = "NATIVE"
175+
LaunchModeEmulated LaunchMode = "EMULATED"
176+
LaunchModeParavirtualized LaunchMode = "PARAVIRTUALIZED"
177+
LaunchModeCustom LaunchMode = "CUSTOM"
178+
)
179+
163180
//+kubebuilder:object:root=true
164181
//+kubebuilder:subresource:status
165182
// +kubebuilder:storageversion

cloud/scope/machine.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ func (m *MachineScope) GetOrCreateMachine(ctx context.Context) (*core.Instance,
245245
AssignPrivateDnsRecord: m.OCIMachine.Spec.NetworkDetails.AssignPrivateDnsRecord,
246246
DisplayName: m.OCIMachine.Spec.NetworkDetails.DisplayName,
247247
},
248+
ComputeClusterId: m.OCIMachine.Spec.ComputeClusterId,
248249
Metadata: metadata,
249250
Shape: common.String(m.OCIMachine.Spec.Shape),
250251
AvailabilityDomain: common.String(availabilityDomain),

cloud/scope/machine_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ func TestInstanceReconciliation(t *testing.T) {
325325
testSpecificSetup: func(machineScope *MachineScope, computeClient *mock_compute.MockComputeClient) {
326326
setupAllParams(ms)
327327
ms.OCIMachine.Spec.CapacityReservationId = common.String("cap-id")
328+
ms.OCIMachine.Spec.ComputeClusterId = common.String("cluster-id")
328329
ms.OCIMachine.Spec.DedicatedVmHostId = common.String("dedicated-host-id")
329330
ms.OCIMachine.Spec.NetworkDetails.HostnameLabel = common.String("hostname-label")
330331
ms.OCIMachine.Spec.NetworkDetails.SkipSourceDestCheck = common.Bool(true)
@@ -342,6 +343,7 @@ func TestInstanceReconciliation(t *testing.T) {
342343
launchDetails := core.LaunchInstanceDetails{DisplayName: common.String("name"),
343344
CapacityReservationId: common.String("cap-id"),
344345
DedicatedVmHostId: common.String("dedicated-host-id"),
346+
ComputeClusterId: common.String("cluster-id"),
345347
SourceDetails: core.InstanceSourceViaImageDetails{
346348
ImageId: common.String("image"),
347349
BootVolumeSizeInGBs: common.Int64(120),

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/google/gofuzz v1.2.0
99
github.com/onsi/ginkgo/v2 v2.11.0
1010
github.com/onsi/gomega v1.27.8
11-
github.com/oracle/oci-go-sdk/v65 v65.40.1
11+
github.com/oracle/oci-go-sdk/v65 v65.45.0
1212
github.com/pkg/errors v0.9.1
1313
github.com/prometheus/client_golang v1.16.0
1414
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8
368368
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
369369
github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM=
370370
github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
371-
github.com/oracle/oci-go-sdk/v65 v65.40.1 h1:nukjC4GfrpOxOEoGvqg8y31/11VtaeSnejF7icyMKJg=
372-
github.com/oracle/oci-go-sdk/v65 v65.40.1/go.mod h1:MXMLMzHnnd9wlpgadPkdlkZ9YrwQmCOmbX5kjVEJodw=
371+
github.com/oracle/oci-go-sdk/v65 v65.45.0 h1:EpCst/iZma9s8eYS0QJ9qsTmGxX5GPehYGN1jwGIteU=
372+
github.com/oracle/oci-go-sdk/v65 v65.45.0/go.mod h1:IBEV9l1qBzUpo7zgGaRUhbB05BVfcDGYRFBCPlTcPp0=
373373
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
374374
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
375375
github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
@@ -459,8 +459,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
459459
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
460460
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
461461
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
462-
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
463462
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
463+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
464+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
464465
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
465466
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
466467
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
@@ -663,7 +664,7 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
663664
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
664665
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
665666
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
666-
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
667+
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
667668
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
668669
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
669670
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

0 commit comments

Comments
 (0)