Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
be3bb9d
Bump github.com/IBM/networking-go-sdk from 0.51.11 to 0.51.12 (#2484)
dependabot[bot] Sep 4, 2025
fbe0bde
Bump github.com/spf13/pflag from 1.0.7 to 1.0.10 (#2483)
dependabot[bot] Sep 6, 2025
15c0f1e
Post v0.12.0 release housekeeping (#2486)
Prajyot-Parab Sep 8, 2025
f23332b
Bump golang.org/x/crypto from 0.41.0 to 0.42.0 (#2488)
dependabot[bot] Sep 9, 2025
a08e2ad
Bump golang.org/x/net from 0.43.0 to 0.44.0 (#2491)
dependabot[bot] Sep 10, 2025
3547ff5
Add release-0-12 book link (#2487)
Prajyot-Parab Sep 10, 2025
0ad8105
Bump github.com/coreos/ignition/v2 from 2.22.0 to 2.23.0 (#2493)
dependabot[bot] Sep 11, 2025
910b5eb
Bump github.com/IBM-Cloud/power-go-client from 1.12.0 to 1.13.0 (#2494)
dependabot[bot] Sep 11, 2025
35fafa7
Bump github.com/IBM/platform-services-go-sdk from 0.86.1 to 0.87.0 (#…
dependabot[bot] Sep 13, 2025
5da7417
Fix capibmadm download links (#2496)
Prajyot-Parab Sep 15, 2025
02f0946
Bump gotest.tools/gotestsum from 1.12.3 to 1.13.0 in /hack/tools (#2497)
dependabot[bot] Sep 16, 2025
d9319b3
Bump github.com/IBM/vpc-go-sdk from 0.71.1 to 0.72.0 (#2498)
dependabot[bot] Sep 19, 2025
3db159f
Bump github.com/golangci/golangci-lint/v2 in /hack/tools (#2499)
dependabot[bot] Sep 23, 2025
c8b4231
Bump github.com/IBM/vpc-go-sdk from 0.72.0 to 0.73.0 (#2500)
dependabot[bot] Sep 26, 2025
dd2ae82
Bump github.com/go-openapi/strfmt from 0.23.0 to 0.24.0 (#2501)
dependabot[bot] Sep 28, 2025
ebd39f9
Bump github.com/IBM/platform-services-go-sdk from 0.87.0 to 0.88.0 (#…
dependabot[bot] Oct 6, 2025
bd6bb77
Bump golang.org/x/net from 0.44.0 to 0.45.0 (#2504)
dependabot[bot] Oct 8, 2025
8699691
Bump github.com/IBM/vpc-go-sdk from 0.73.0 to 0.74.0 (#2505)
dependabot[bot] Oct 8, 2025
68baf2f
Bump github.com/IBM/platform-services-go-sdk from 0.88.0 to 0.89.0 (#…
dependabot[bot] Oct 11, 2025
54632c3
Bump golang.org/x/text from 0.29.0 to 0.30.0 (#2506)
dependabot[bot] Oct 13, 2025
36d4234
Bump golang.org/x/crypto from 0.42.0 to 0.43.0 (#2507)
dependabot[bot] Oct 13, 2025
6722919
Bump github.com/IBM/vpc-go-sdk from 0.74.0 to 0.74.1 (#2509)
dependabot[bot] Oct 13, 2025
add40fc
Update cluster-api to v1.11.2 and golang to 1.24.8 (#2511)
Amulyam24 Oct 13, 2025
e24137c
Bump golang.org/x/net from 0.45.0 to 0.46.0 (#2508)
dependabot[bot] Oct 14, 2025
b019224
Removed deprecated use of result.Requeue (#2503)
anshuman-agarwala Oct 14, 2025
8fc638c
Bump github.com/coreos/ignition/v2 from 2.23.0 to 2.24.0 (#2514)
dependabot[bot] Oct 15, 2025
4379c09
Bump github.com/IBM/networking-go-sdk from 0.51.12 to 0.51.13 (#2515)
dependabot[bot] Oct 16, 2025
dbcaee1
Bump github.com/IBM/platform-services-go-sdk from 0.89.0 to 0.90.0 (#…
dependabot[bot] Oct 29, 2025
abbe3ef
Update golang to 1.24.9 (#2518)
Prajyot-Parab Nov 5, 2025
0224ba9
Bump github.com/IBM/networking-go-sdk from 0.51.13 to 0.51.14 (#2523)
dependabot[bot] Nov 10, 2025
76d518c
Bump sigs.k8s.io/kustomize/kustomize/v5 in /hack/tools (#2526)
dependabot[bot] Nov 11, 2025
5e37fb5
Bump github.com/go-openapi/strfmt from 0.24.0 to 0.25.0 (#2524)
dependabot[bot] Nov 11, 2025
15308f4
Bump github.com/IBM/vpc-go-sdk from 0.74.1 to 0.75.0 (#2525)
dependabot[bot] Nov 11, 2025
8ee1894
Bump golang.org/x/crypto from 0.43.0 to 0.44.0 (#2528)
dependabot[bot] Nov 12, 2025
31467ec
Fix staging repository link (#2531)
Prajyot-Parab Nov 16, 2025
b2ed191
Bump github.com/golangci/golangci-lint/v2 from 2.5.0 to 2.6.0 (#2521)
ChandrikaHarish Nov 17, 2025
0c46edc
Bump github.com/golangci/golangci-lint/v2 in /hack/tools (#2532)
dependabot[bot] Nov 18, 2025
bb92506
Bump github.com/IBM-Cloud/power-go-client from 1.13.0 to 1.14.0 (#2535)
dependabot[bot] Nov 19, 2025
a792076
Bump github.com/IBM/platform-services-go-sdk from 0.90.0 to 0.90.1 (#…
dependabot[bot] Nov 19, 2025
1802526
Bump github.com/IBM/vpc-go-sdk from 0.75.0 to 0.76.0 (#2538)
dependabot[bot] Nov 20, 2025
d629933
Bump golang.org/x/crypto from 0.44.0 to 0.45.0 (#2539)
dependabot[bot] Nov 20, 2025
a4c2ae1
Bump github.com/IBM-Cloud/power-go-client from 1.14.0 to 1.14.3 (#2540)
dependabot[bot] Nov 20, 2025
2298b0c
Remove invalid kustomizeconfig from config/webhook (#2541)
mdbooth Nov 21, 2025
5f8dfad
Update cluster-api to v1.12.0-beta.1 and golang to 1.24.10 (#2542)
Amulyam24 Nov 21, 2025
d3dec4a
Bump github.com/IBM/go-sdk-core/v5 from 5.21.1 to 5.21.2 (#2543)
dependabot[bot] Nov 22, 2025
d5756d0
Bump github.com/IBM/platform-services-go-sdk from 0.90.1 to 0.90.2 (#…
dependabot[bot] Nov 25, 2025
dd924e7
Bump github.com/IBM/vpc-go-sdk from 0.76.0 to 0.76.1 (#2546)
dependabot[bot] Nov 26, 2025
ccd53a1
Bump github.com/IBM/platform-services-go-sdk from 0.90.2 to 0.90.4 (#…
dependabot[bot] Nov 28, 2025
059dd2f
Bump github.com/itchyny/gojq from 0.12.17 to 0.12.18 in /hack/tools (…
dependabot[bot] Dec 2, 2025
3bdb3d7
Readded support for additional disks (#2448)
anshuman-agarwala Dec 2, 2025
02d541c
Bump github.com/IBM/ibm-cos-sdk-go from 1.12.3 to 1.12.4 (#2549)
dependabot[bot] Dec 5, 2025
b05203c
Bump github.com/spf13/cobra from 1.10.1 to 1.10.2 (#2550)
dependabot[bot] Dec 5, 2025
8ef30bd
Fix invalid CLI plugin version for PowerVS e2e (#2552)
Amulyam24 Dec 8, 2025
19d7007
Bump github.com/IBM/vpc-go-sdk from 0.76.1 to 0.76.2 (#2553)
dependabot[bot] Dec 9, 2025
e43aa03
Bump golang.org/x/net from 0.47.0 to 0.48.0 (#2554)
dependabot[bot] Dec 9, 2025
9d45e55
Bump github.com/golangci/golangci-lint/v2 in /hack/tools (#2557)
dependabot[bot] Dec 9, 2025
6de2203
Fix weekly security scan (#2560)
Amulyam24 Dec 10, 2025
b10cce9
Update cluster-api to v1.12.0 (#2563)
Amulyam24 Dec 11, 2025
28e56dc
Bump github.com/IBM/platform-services-go-sdk from 0.90.4 to 0.91.0 (#…
dependabot[bot] Dec 11, 2025
e5cbd2a
tags proposal (#2364)
arshadd-b Dec 12, 2025
9d7ecea
Add validation for encryptionKeyCRN for VPC Machine spec (#2551)
ChandrikaHarish Dec 12, 2025
e4aa9cb
Bump github.com/coreos/ignition/v2 from 2.24.0 to 2.25.0 (#2569)
dependabot[bot] Dec 15, 2025
a0ca87c
Bump github.com/IBM-Cloud/power-go-client from 1.14.3 to 1.14.4 (#2570)
dependabot[bot] Dec 15, 2025
64a173c
Bump github.com/IBM/networking-go-sdk from 0.51.14 to 0.51.15 (#2571)
dependabot[bot] Dec 15, 2025
939cfe4
merge upstream/v0.13.0 into main
Feb 9, 2026
d9718fe
UPSTREAM: <carry>: Add vendor
Karthik-K-N Oct 4, 2022
4890bdb
UPSTREAM: <carry>: Add openshift specific changes
Karthik-K-N Oct 4, 2022
0e28d3b
UPSTREAM: <carry>: Sync OWNERS file
JoelSpeed Jun 25, 2024
6f211de
UPSTREAM: <carry>: Updating ose-ibmcloud-cluster-api-controllers-cont…
Sep 5, 2024
d3fa417
UPSTREAM: <carry>: add openshift/e2e-tests.sh
damdo Nov 11, 2024
ea8d51f
UPSTREAM: <carry>: Updating ose-ibmcloud-cluster-api-controllers-cont…
Dec 5, 2024
011c435
UPSTREAM: <carry>: Upgrade the golang.org/x/net to v0.33.0
aman4433 Feb 13, 2025
cd8635f
UPSTREAM: <carry>: Remove unnecesary kustomize
RadekManak Feb 20, 2025
6274615
UPSTREAM: <carry>: Update manifests generator tooling
RadekManak Feb 20, 2025
93da045
UPSTREAM: <carry>: Do not gitignore vendor
RadekManak May 16, 2025
13f4da5
UPSTREAM: <carry>: Sync OWNERS file
JoelSpeed Jul 22, 2025
3e4e335
UPSTREAM: <carry>: Sync OWNERS file
RadekManak Sep 4, 2025
f9d3866
UPSTREAM: <carry>: Updating ose-ibmcloud-cluster-api-controllers-cont…
Sep 30, 2025
b24ab81
UPSTREAM: <carry>: Updating ose-ibmcloud-cluster-api-controllers-cont…
Jun 20, 2025
3b1e306
UPSTREAM: <carry>: Updating ose-ibmcloud-cluster-api-controllers-cont…
Dec 20, 2025
94e267a
UPSTREAM: <carry>: Add manifests verify target
RadekManak Jan 15, 2026
27fc91e
UPSTREAM: <carry>: Update manifest generator
Feb 9, 2026
70257e1
UPSTREAM: <drop>: Update manifests generator
Feb 9, 2026
261e5c9
UPSTREAM: <drop>: Generate OpenShift manifests
Feb 9, 2026
bab3c03
UPSTREAM: <drop>: Updating and vendoring go modules after an upstream…
Feb 9, 2026
6b8f390
UPSTREAM: <carry>: Updating ose-ibmcloud-cluster-api-controllers-cont…
Jun 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build_root_image:
name: release
namespace: openshift
tag: rhel-9-release-golang-1.24-openshift-4.22
tag: rhel-9-release-golang-1.24-openshift-4.20
4 changes: 2 additions & 2 deletions .github/workflows/weekly-security-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: [ main, release-0.11, release-0.10 ]
branch: [ main, release-0.12, release-0.11 ]
name: Trivy
runs-on: ubuntu-24.04
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # tag=v5.0.0
with:
ref: ${{ matrix.branch }}
- name: Calculate go version
Expand Down
15 changes: 15 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,21 @@ linters:
- gocritic
path: _test\.go
text: 'deferInLoop: Possible resource leak, ''defer'' is called in the ''for'' loop'
- linters:
- staticcheck
text: 'SA1019: .*(i|s|m)\.IBMPowerVSCluster.Spec.ServiceInstanceID is deprecated: use ServiceInstance instead'
- linters:
- staticcheck
text: 'SA1019: .*(i|s|m)\.IBMPowerVSImage.Spec.ServiceInstanceID is deprecated: use ServiceInstance instead'
- linters:
- staticcheck
text: 'SA1019: .*(i|s|m|params)\.IBMPowerVSMachine.Spec.ServiceInstanceID is deprecated: use ServiceInstance instead'
- linters:
- staticcheck
text: 'SA1019: spec.ServiceInstanceID is deprecated: use ServiceInstance instead'
- linters:
- staticcheck
text: 'SA1019: endpoints.(FetchRCEndpoint|FetchPVSEndpoint) is deprecated: Use FetchEndpoints instead.'
paths:
- zz_generated.*\.go$
- third_party$
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RELEASE_NOTES_DIR := CHANGELOG
OUTPUT_TYPE ?= type=registry

# Go
GO_VERSION ?=1.24.6
GO_VERSION ?=1.24.11
GO_CONTAINER_IMAGE ?= golang:$(GO_VERSION)

# Trivy
Expand All @@ -105,7 +105,7 @@ PULL_POLICY ?= Always
# Set build time variables including version details
LDFLAGS := $(shell ./hack/version.sh)

KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.33.0
KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.34.0

# main controller
CORE_IMAGE_NAME ?= cluster-api-ibmcloud-controller
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ cluster on IBM Cloud.

This provider's versions are compatible with the following versions of Cluster API:

| |Cluster API v1alpha4 (v0.4) |Cluster API v1beta1 (v1.x) |
|:----------------------------------------|:---------------:|:--------------:|
| CAPIBM v1alpha4 (v0.1.x) | ✓ | |
| CAPIBM v1beta1 (v0.2.x, v0.3.x) | | ✓ |
| CAPIBM v1beta2 (v0.[4-11].x, main) | | ✓ |
| |Cluster API v1alpha4 (v0.4) |Cluster API v1beta1 (v1.[0-11].x) |Cluster API v1beta2 (v1.11.x) |
|:----------------------------------------|:---------------:|:--------------:|:--------------:|
| CAPIBM v1alpha4 (v0.1.x) | ✓ | | |
| CAPIBM v1beta1 (v0.2.x, v0.3.x) | | ✓ | |
| CAPIBM v1beta2 (v0.[4-12].x, main) | | ✓ | |


(See [Kubernetes support matrix][cluster-api-supported-v] of Cluster API versions).
Expand Down
4 changes: 3 additions & 1 deletion api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ type Subnet struct {
// VPCEndpoint describes a VPCEndpoint.
type VPCEndpoint struct {
Address *string `json:"address"`
// +optional

// Deprecated: This field has no function and is going to be removed in the next release.
//
// +optional
FIPID *string `json:"floatingIPID,omitempty"`
// +optional
LBID *string `json:"loadBalancerIPID,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion api/v1beta2/ibmpowervscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ const (

// IBMPowerVSClusterSpec defines the desired state of IBMPowerVSCluster.
type IBMPowerVSClusterSpec struct {
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed.

// Deprecated: use ServiceInstance instead
//
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed.
ServiceInstanceID string `json:"serviceInstanceID"`

// Network is the reference to the Network to use for this cluster.
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta2/ibmpowervsimage_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ type IBMPowerVSImageSpec struct {
// +kubebuilder:validation:MinLength=1
ClusterName string `json:"clusterName"`

// ServiceInstanceID is the id of the power cloud instance where the image will get imported.
// Deprecated: use ServiceInstance instead
//
// ServiceInstanceID is the id of the power cloud instance where the image will get imported.
ServiceInstanceID string `json:"serviceInstanceID"`

// serviceInstance is the reference to the Power VS workspace on which the server instance(VM) will be created.
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta2/ibmpowervsmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ type IBMPowerVSMachineSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed.
// Deprecated: use ServiceInstance instead
//
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed.
ServiceInstanceID string `json:"serviceInstanceID"`

// serviceInstance is the reference to the Power VS workspace on which the server instance(VM) will be created.
Expand Down
18 changes: 15 additions & 3 deletions api/v1beta2/ibmvpcmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ type IBMVPCMachineSpec struct {
// SSHKeys is the SSH pub keys that will be used to access VM.
// ID will take higher precedence over Name if both specified.
SSHKeys []*IBMVPCResourceReference `json:"sshKeys,omitempty"`

// additionalVolumes is the list of additional volumes attached to the instance
// There is a hard limit of 12 volume attachments per instance:
// https://cloud.ibm.com/docs/vpc?topic=vpc-attaching-block-storage&interface=api#vol-attach-limits
// +kubebuilder:validation:Optional
// +kubebuilder:validation:MaxItems=12
// +kubebuilder:validation:XValidation:rule="oldSelf.all(x, x in self)",message="Values may only be added"
AdditionalVolumes []*VPCVolume `json:"additionalVolumes,omitempty"`
}

// IBMVPCResourceReference is a reference to a specific VPC resource by ID or Name
Expand All @@ -95,7 +103,7 @@ type IBMVPCResourceReference struct {
Name *string `json:"name,omitempty"`
}

// VPCVolume defines the volume information for the instance.
// VPCVolume defines the volume information.
type VPCVolume struct {
// DeleteVolumeOnInstanceDelete If set to true, when deleting the instance the volume will also be deleted.
// Default is set as true
Expand All @@ -108,14 +116,15 @@ type VPCVolume struct {
// +optional
Name string `json:"name,omitempty"`

// SizeGiB is the size of the virtual server's boot disk in GiB.
// SizeGiB is the size of the virtual server's disk in GiB.
// Default to the size of the image's `minimum_provisioned_size`.
// +optional
SizeGiB int64 `json:"sizeGiB,omitempty"`

// Profile is the volume profile for the bootdisk, refer https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles
// Profile is the volume profile for the disk, refer https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles
// for more information.
// Default to general-purpose
// NOTE: If a profile other than custom is specified, the Iops and SizeGiB fields will be ignored
// +kubebuilder:validation:Enum="general-purpose";"5iops-tier";"10iops-tier";"custom"
// +kubebuilder:default=general-purpose
// +optional
Expand Down Expand Up @@ -190,6 +199,9 @@ type IBMVPCMachineV1Beta2Status struct {
// +listMapKey=type
// +kubebuilder:validation:MaxItems=32
Conditions []metav1.Condition `json:"conditions,omitempty"`
// AdditionalVolumeIDs is a list of Volume IDs as per IBMCloud
// +optional
AdditionalVolumeIDs []string `json:"additionalVolumeIDs,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,9 @@ type Subnet struct {
// VPCEndpoint describes a VPCEndpoint.
type VPCEndpoint struct {
Address *string `json:"address"`
// +optional
// Deprecated: This field has no function and is going to be removed in the next release.
//
// +optional
FIPID *string `json:"floatingIPID,omitempty"`
// +optional
LBID *string `json:"loadBalancerIPID,omitempty"`
Expand Down
16 changes: 16 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1162,3 +1162,80 @@ func (m *MachineScope) APIServerPort() int32 {
}
return infrav1.DefaultAPIServerPort
}

// GetVolumeAttachments returns the volume attachments for the instance.
func (m *MachineScope) GetVolumeAttachments() ([]vpcv1.VolumeAttachment, error) {
options := vpcv1.ListInstanceVolumeAttachmentsOptions{
InstanceID: &m.IBMVPCMachine.Status.InstanceID,
}
result, _, err := m.IBMVPCClient.GetVolumeAttachments(&options)
if err != nil {
return nil, fmt.Errorf("error while getting volume attachments: %w", err)
}
return result.VolumeAttachments, nil
}

// GetVolumeState returns the volume's state.
func (m *MachineScope) GetVolumeState(volumeID string) (string, error) {
options := vpcv1.GetVolumeOptions{
ID: &volumeID,
}
result, _, err := m.IBMVPCClient.GetVolume(&options)
if err != nil {
return "", fmt.Errorf("could not fetch volume status: %w", err)
}
return *result.Status, err
}

// CreateVolume creates a new Volume and attaches it to the instance.
func (m *MachineScope) CreateVolume(vpcVolume *infrav1.VPCVolume) (string, error) {
volumeOptions := vpcv1.CreateVolumeOptions{}
var resourceGroupID string
if m.IBMVPCCluster.Status.ResourceGroup != nil {
resourceGroupID = m.IBMVPCCluster.Status.ResourceGroup.ID
} else {
resourceGroupID = m.IBMVPCCluster.Spec.ResourceGroup
}
// TODO: EncryptionKeyCRN is not supported for now, the field is omitted from the manifest
volumeOptions.VolumePrototype = &vpcv1.VolumePrototype{
ResourceGroup: &vpcv1.ResourceGroupIdentityByID{
ID: &resourceGroupID,
},
Profile: &vpcv1.VolumeProfileIdentityByName{
Name: &vpcVolume.Profile,
},
Zone: &vpcv1.ZoneIdentity{
Name: &m.IBMVPCMachine.Spec.Zone,
},
Capacity: &vpcVolume.SizeGiB,
}

if vpcVolume.Profile == "custom" {
volumeOptions.VolumePrototype.(*vpcv1.VolumePrototype).Iops = &vpcVolume.Iops
}

volumeResult, _, err := m.IBMVPCClient.CreateVolume(&volumeOptions)
if err != nil {
return "", fmt.Errorf("error while creating volume: %w", err)
}

return *volumeResult.ID, nil
}

// AttachVolume attaches the given volume to the instance.
func (m *MachineScope) AttachVolume(deleteOnInstanceDelete bool, volumeID, volumeName string) error {
attachmentOptions := vpcv1.CreateInstanceVolumeAttachmentOptions{
InstanceID: &m.IBMVPCMachine.Status.InstanceID,
Volume: &vpcv1.VolumeAttachmentPrototypeVolume{
ID: &volumeID,
},
DeleteVolumeOnInstanceDelete: &deleteOnInstanceDelete,
Name: &volumeName,
}

_, _, err := m.IBMVPCClient.AttachVolumeToInstance(&attachmentOptions)
if err != nil {
err = fmt.Errorf("error while attaching volume to instance: %w", err)
}
return err
}
Loading