Skip to content

Commit 6a54e58

Browse files
sidecar: Get credentials from annotation for snapshots
When a snapshotcontent is created as a result of a volumegroupsnapshot the status for it is updated by calling the ListSnapshots RPC. Some COs require the credentials to be present in order to serve this RPC. The current code tries to get credentials only from a volumesnapshotclass if present. This condition will never be met in case of VGS. This patch adapts to code to fetch the credentials from the annotations `AnnDeletionSecretRef*` if volumesnapshotclassname is not present. Signed-off-by: Niraj Yadav <[email protected]>
1 parent ab0c90e commit 6a54e58

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/sidecar-controller/snapshot_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,13 @@ func (ctrl *csiSnapshotSideCarController) checkandUpdateContentStatusOperation(c
290290
}
291291
}
292292

293+
if snapshotterListCredentials == nil && volumeGroupSnapshotMemberWithGroupSnapshotHandle {
294+
snapshotterListCredentials, err = ctrl.GetCredentialsFromAnnotation(content)
295+
if err != nil {
296+
return content, fmt.Errorf("failed to get credentials from annotation for snapshot content %s: %v", content.Name, err)
297+
}
298+
}
299+
293300
readyToUse, creationTime, size, groupSnapshotID, err = ctrl.handler.GetSnapshotStatus(content, snapshotterListCredentials)
294301
if err != nil {
295302
klog.Errorf("checkandUpdateContentStatusOperation: failed to call get snapshot status to check whether snapshot is ready to use %q", err)

0 commit comments

Comments
 (0)