Skip to content

WIP: Delete Volume when creation fails with status ERROR - #1452

Draft
nschad wants to merge 3 commits into
mainfrom
delete-vol-when-error-create
Draft

WIP: Delete Volume when creation fails with status ERROR#1452
nschad wants to merge 3 commits into
mainfrom
delete-vol-when-error-create

Conversation

@nschad

@nschad nschad commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

How to categorize this PR?

/kind enhancement

What this PR does / why we need it:

The idea is to automatically delete the volume when status is ERROR. We do this there is no left-over volumes even though the CreateVolume RPC failed.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Breaking changes:

Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
@ske-prow

ske-prow Bot commented Aug 4, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ske-prow ske-prow Bot added kind/enhancement Enhancement, improvement, extension do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Aug 4, 2026
@ske-prow

ske-prow Bot commented Aug 4, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nschad for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ske-prow ske-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 4, 2026
return nil, status.Error(codes.AlreadyExists, "Volume Already exists with same name and different capacity")
}
if *vols[0].Status != stackitclient.VolumeAvailableStatus {
return nil, status.Error(codes.Internal, fmt.Sprintf("Volume %s is not in available state", *vols[0].Id))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needs to be also handled here or?

@nschad nschad Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we can't. This would remove volumes that can potentially have data in it. Think about this scenario

  1. User creates Volume with data unrelated to SKE or any CSI
  2. Volume enters bad state due to reasons ™️
  3. User tries to import Volume (which is possible) back into Kubernetes
  4. Volume is now managed by CSI and will be deleted because of 2.) instead of being stuck.

return nil, status.Errorf(codes.Internal, "Failed to get volumes: %v", err)
}

if len(vols) == 1 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should BTW also error when we find more than 1 volume or?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do

} else if len(vols) > 1 {

Just below that

Comment thread pkg/csi/blockstorage/controllerserver.go Outdated
nschad added 2 commits August 4, 2026 13:33
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/enhancement Enhancement, improvement, extension size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants