Skip to content

Commit a0f93a1

Browse files
authored
Merge pull request #442 from huffmanca/adjust-content-deletion-3.0
[Cherry-pick] Don't check for snapshotClass when deleting content
2 parents ca6af5e + 5d83442 commit a0f93a1

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

pkg/sidecar-controller/snapshot_controller.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
codes "google.golang.org/grpc/codes"
2828
"google.golang.org/grpc/status"
2929
v1 "k8s.io/api/core/v1"
30-
"k8s.io/apimachinery/pkg/api/errors"
3130
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3231
klog "k8s.io/klog/v2"
3332
)
@@ -328,9 +327,9 @@ func (ctrl *csiSnapshotSideCarController) createSnapshotWrapper(content *crdv1.V
328327
func (ctrl *csiSnapshotSideCarController) deleteCSISnapshotOperation(content *crdv1.VolumeSnapshotContent) error {
329328
klog.V(5).Infof("deleteCSISnapshotOperation [%s] started", content.Name)
330329

331-
_, snapshotterCredentials, err := ctrl.getCSISnapshotInput(content)
332-
if err != nil && !errors.IsNotFound(err) {
333-
ctrl.eventRecorder.Event(content, v1.EventTypeWarning, "SnapshotDeleteError", "Failed to get snapshot class or credentials")
330+
snapshotterCredentials, err := ctrl.GetCredentialsFromAnnotation(content)
331+
if err != nil {
332+
ctrl.eventRecorder.Event(content, v1.EventTypeWarning, "SnapshotDeleteError", "Failed to get snapshot credentials")
334333
return fmt.Errorf("failed to get input parameters to delete snapshot for content %s: %q", content.Name, err)
335334
}
336335

pkg/sidecar-controller/snapshot_delete_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ func TestDeleteSync(t *testing.T) {
339339
{
340340
name: "1-15 - (dynamic)deletion of content with no snapshotclass should succeed",
341341
initialContents: newContentArrayWithDeletionTimestamp("content1-15", "sid1-15", "snap1-15", "sid1-15", "", "", "snap1-15-volumehandle", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),
342-
expectedContents: newContentArrayWithDeletionTimestamp("content1-15", "sid1-15", "snap1-15", "sid1-15", "", "", "snap1-15-volumehandle", deletePolicy, nil, &defaultSize, true, &timeNowMetav1),
342+
expectedContents: newContentArrayWithDeletionTimestamp("content1-15", "sid1-15", "snap1-15", "", "", "", "snap1-15-volumehandle", deletePolicy, nil, &defaultSize, false, &timeNowMetav1),
343343
errors: noerrors,
344344
expectedDeleteCalls: []deleteCall{{"sid1-15", nil, nil}},
345345
test: testSyncContent,

0 commit comments

Comments
 (0)