Conversation
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
Signed-off-by: Niclas Schad <niclas.schad@stackit.cloud>
stackit-ske-bot
left a comment
There was a problem hiding this comment.
SKE Code Review
Architectural Feedback
-
Simplify
WaitVolumeTargetStatusWithCustomBackoffSignature:
In pkg/stackit/client/iaas.go#L52,WaitVolumeTargetStatusWithCustomBackoffwas changed from acceptingvolumeID stringtovol **iaas.Volumeto allow mutating the pointer in-place for cleanup after creation. However, since the subsequent cleanup call afterWaitVolumeTargetStatusWithCustomBackoffwas removed in commit 87917aa, mutatingvolin-place is no longer needed in pkg/csi/blockstorage/controllerserver.go#L271.Passing a double pointer (
**iaas.Volume) across interface boundaries is unidiomatic in Go, introduces nil dereference risks (e.g.(*vol).GetId()), and forced modifications across multiple unit tests in pkg/csi/blockstorage/controllerserver_test.go and pkg/stackit/client/mock/iaas_mock.go. Reverting the interface method back tovolumeID stringsimplifies the API, avoids unnecessary mock changes, and keeps it consistent withWaitVolumeTargetStatus.
Findings & Feedback
- All findings and concrete recommendations have been provided as inline code suggestions above.
Verdict
Comment — The flag and cleanup logic for existing error-state volumes in CreateVolume are a great improvement. Please address the nil-safety items and consider reverting the double-pointer signature in WaitVolumeTargetStatusWithCustomBackoff.
Signed-off-by: Felix Breuer <f.breuer94@gmail.com>
stackit-ske-bot
left a comment
There was a problem hiding this comment.
SKE Code Review
Architectural Feedback
-
Handling of All Provisioning Error States in Cleanup:
In pkg/csi/blockstorage/controllerserver.go#L298,deleteVolumeInErrorstrictly compares againststackitclient.VolumeErrorStatus("ERROR"):if vol.GetStatus() != stackitclient.VolumeErrorStatus { return }
However, as defined in pkg/stackit/client/iaas.go#L98 (
volumeErrorStates), STACKIT IaaS volume provisioning can enter several terminal error states—most notably"ERROR_KMS-ENCRYPTION-PARAMS"if encrypted volume creation fails (e.g. invalid KMS keys or service account permissions), as well as"ERROR_RESTORING-BACKUP".If an encrypted volume fails creation and enters
"ERROR_KMS-ENCRYPTION-PARAMS", subsequent retries by Kubernetes external-provisioner will findlen(vols) == 1, butdeleteVolumeInErrorwill skip deletion because the status does not match"ERROR". The volume is then left orphaned and the provisioning loop remains permanently stuck returningcodes.Internal.Recommendation: Expose an error-state classification function in pkg/stackit/client (e.g.,
IsVolumeErrorState(status string) boolmatching creation error states and excluding non-terminal or deleting states likeERROR_DELETING), and use it withindeleteVolumeInErrorto ensure all failed provisioning artifacts are cleaned up whendeleteVolumesInErrorStateis enabled.
Findings & Feedback
- All findings and concrete recommendations have been provided as inline code suggestions above.
Verdict
Comment — The refactored WaitVolumeTargetStatusWithCustomBackoff method returning (*iaas.Volume, error) and the adoption of getter methods across the controller look very clean. Please consider extending the error status check in deleteVolumeInError to handle all provisioning error states (such as KMS errors) as outlined in the architectural feedback.
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: