Skip to content

Commit

Permalink
webhook: Remove the limitation for v2 volume snapshot creation
Browse files Browse the repository at this point in the history
Longhorn 6137

Signed-off-by: Shuo Wu <shuo.wu@suse.com>
  • Loading branch information
shuo-wu committed Dec 19, 2023
1 parent ce28f2c commit f5b33c9
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions webhook/resources/snapshot/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"reflect"

"github.com/pkg/errors"

"k8s.io/apimachinery/pkg/runtime"

admissionregv1 "k8s.io/api/admissionregistration/v1"
Expand Down Expand Up @@ -52,15 +50,6 @@ func (o *snapshotValidator) Create(request *admission.Request, newObj runtime.Ob
if snapshot.Spec.Volume == "" {
return werror.NewInvalidError("spec.volume is required", "spec.volume")
}
volume, err := o.ds.GetVolumeRO(snapshot.Spec.Volume)
if err != nil {
err := errors.Wrapf(err, "failed to get volume %v", snapshot.Spec.Volume)
return werror.NewInvalidError(err.Error(), "")
}
if volume.Spec.BackendStoreDriver == longhorn.BackendStoreDriverTypeV2 {
err := errors.Errorf("creating snapshot for volume %v with backend store driver %v is not supported", volume.Name, volume.Spec.BackendStoreDriver)
return werror.NewInvalidError(err.Error(), "")
}

return nil
}
Expand Down

0 comments on commit f5b33c9

Please sign in to comment.