Skip to content

Commit d190d11

Browse files
committed
Only dynamic provisioning for an independent snapshot needs a snapshot class
1 parent 3c79996 commit d190d11

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/sidecar-controller/snapshot_controller.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,15 @@ func (ctrl *csiSnapshotSideCarController) getCSISnapshotInput(content *crdv1.Vol
234234
return nil, nil, err
235235
}
236236
} else {
237-
// If dynamic provisioning, return failure if no snapshot class
238-
if content.Spec.Source.VolumeHandle != nil {
237+
// If dynamic provisioning for an independent snapshot, return failure if no snapshot class
238+
_, groupSnapshotMember := content.Labels[utils.VolumeGroupSnapshotHandleLabel]
239+
if content.Spec.Source.VolumeHandle != nil && !groupSnapshotMember {
239240
klog.Errorf("failed to getCSISnapshotInput %s without a snapshot class", content.Name)
240241
return nil, nil, fmt.Errorf("failed to take snapshot %s without a snapshot class", content.Name)
241242
}
242-
// For pre-provisioned snapshot, snapshot class is not required
243-
klog.V(5).Infof("getCSISnapshotInput for content [%s]: no VolumeSnapshotClassName provided for pre-provisioned snapshot", content.Name)
243+
// For pre-provisioned snapshot or an individual snapshot in a dynamically provisioned
244+
// volume group snapshot, snapshot class is not required
245+
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)
244246
}
245247

246248
// Resolve snapshotting secret credentials.

0 commit comments

Comments
 (0)