Skip to content

Commit 78bbdbf

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 49c4488 commit 78bbdbf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/sidecar-controller/snapshot_controller.go

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

293+
// The VolumeSnapshotContents that are a member of a VolumeGroupSnapshot will always
294+
// have Spec.VolumeSnapshotClassName unset, use annotations for secrets in such case.
295+
if volumeGroupSnapshotMemberWithGroupSnapshotHandle {
296+
snapshotterListCredentials, err = ctrl.GetCredentialsFromAnnotation(content)
297+
if err != nil {
298+
return content, fmt.Errorf("failed to get credentials from annotation for snapshot content %s: %v", content.Name, err)
299+
}
300+
}
301+
293302
readyToUse, creationTime, size, groupSnapshotID, err = ctrl.handler.GetSnapshotStatus(content, snapshotterListCredentials)
294303
if err != nil {
295304
klog.Errorf("checkandUpdateContentStatusOperation: failed to call get snapshot status to check whether snapshot is ready to use %q", err)

0 commit comments

Comments
 (0)