Skip to content

Commit

Permalink
Merge pull request #1204 from xing-yang/independent_snapshot
Browse files Browse the repository at this point in the history
Only dynamic provisioning for an independent snapshot needs a snapshot class
  • Loading branch information
k8s-ci-robot authored Nov 22, 2024
2 parents 0708ea1 + d190d11 commit 9d77fea
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/sidecar-controller/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,15 @@ func (ctrl *csiSnapshotSideCarController) getCSISnapshotInput(content *crdv1.Vol
return nil, nil, err
}
} else {
// If dynamic provisioning, return failure if no snapshot class
if content.Spec.Source.VolumeHandle != nil {
// If dynamic provisioning for an independent snapshot, return failure if no snapshot class
_, groupSnapshotMember := content.Labels[utils.VolumeGroupSnapshotHandleLabel]
if content.Spec.Source.VolumeHandle != nil && !groupSnapshotMember {
klog.Errorf("failed to getCSISnapshotInput %s without a snapshot class", content.Name)
return nil, nil, fmt.Errorf("failed to take snapshot %s without a snapshot class", content.Name)
}
// For pre-provisioned snapshot, snapshot class is not required
klog.V(5).Infof("getCSISnapshotInput for content [%s]: no VolumeSnapshotClassName provided for pre-provisioned snapshot", content.Name)
// For pre-provisioned snapshot or an individual snapshot in a dynamically provisioned
// volume group snapshot, snapshot class is not required
klog.V(5).Infof("getCSISnapshotInput for content [%s]: no VolumeSnapshotClassName provided for pre-provisioned snapshot or an individual snapshot in a dynamically provisioned volume group snapshot", content.Name)
}

// Resolve snapshotting secret credentials.
Expand Down

0 comments on commit 9d77fea

Please sign in to comment.