Skip to content

Commit

Permalink
Merge pull request #1098 from leonardoce/volumesnapshot-mix
Browse files Browse the repository at this point in the history
Avoid group snapshot provisioning with mismatching CSI Drivers
  • Loading branch information
k8s-ci-robot authored Jun 18, 2024
2 parents a50e4b8 + fe4a04d commit 3c92522
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/common-controller/groupsnapshot_controller_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,23 @@ func (ctrl *csiSnapshotCommonController) createGroupSnapshotContent(groupSnapsho
)
return nil, err
}

volumeCSIDriver := pv.Spec.CSI.Driver
classCSIDriver := groupSnapshotClass.Driver
if volumeCSIDriver != classCSIDriver {
strErr := fmt.Sprintf(
"Volume CSI driver (%s) mismatch with VolumeGroupSnapshotClass (%s) %s: %s",
volumeCSIDriver, classCSIDriver, utils.GroupSnapshotKey(groupSnapshot), pv.Name)
klog.Error(strErr)
ctrl.eventRecorder.Event(
groupSnapshot,
v1.EventTypeWarning,
"CreateGroupSnapshotContentFailed",
strErr,
)
return nil, newControllerUpdateError(utils.GroupSnapshotKey(groupSnapshot), strErr)

}
volumeHandles = append(volumeHandles, pv.Spec.CSI.VolumeHandle)
}

Expand Down

0 comments on commit 3c92522

Please sign in to comment.