Skip to content

Commit

Permalink
fix(create): validate create volume request access mode
Browse files Browse the repository at this point in the history
Commits adds the validation to validate the create volume
request access mode to validate and support only single node writer
i.e. `ReadWriteOnce` accessmode and failed for other unsupported
modes, like `ReadWriteMany`

Signed-off-by: prateekpandey14 <[email protected]>
  • Loading branch information
prateekpandey14 committed Aug 5, 2020
1 parent 1c97e9a commit 1ac5218
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
NDM_OPERATOR=https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/ndm-operator.yaml
CSTOR_RBAC=https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/rbac.yaml
CSTOR_OPERATOR=https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/cstor-operator.yaml
VOL_CRD=https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/crds/volumes-crd.yaml
CSPC_CRD=https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/crds/cspc-crd.yaml
CSPI_CRD=https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/crds/cspi-crd.yaml
ALL_CRD=https://raw.githubusercontent.com/openebs/cstor-operators/master/deploy/crds/all_cstor_crds.yaml

CSI_OPERATOR="$GOPATH/src/github.com/openebs/cstor-csi/deploy/csi-operator.yaml"
SNAPSHOT_CLASS="$GOPATH/src/github.com/openebs/cstor-csi/deploy/snapshot-class.yaml"
Expand All @@ -31,9 +29,7 @@ DST_PATH="$GOPATH/src/github.com/openebs"
# Minikube is already running
kubectl apply -f $CSTOR_RBAC
kubectl apply -f $NDM_OPERATOR
kubectl apply -f $VOL_CRD
kubectl apply -f $CSPC_CRD
kubectl apply -f $CSPI_CRD
kubectl apply -f $ALL_CRD
kubectl apply -f $CSTOR_OPERATOR
kubectl apply -f $CSI_OPERATOR
kubectl apply -f $SNAPSHOT_CLASS
Expand Down
7 changes: 7 additions & 0 deletions pkg/driver/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ func (cs *controller) validateVolumeCreateReq(req *csi.CreateVolumeRequest) erro
)
}
}
if mode := volcap.GetAccessMode(); mode != nil {
modeName := csi.VolumeCapability_AccessMode_Mode_name[int32(mode.GetMode())]
// we only support SINGLE_NODE_WRITER
if mode.GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
return status.Errorf(codes.InvalidArgument, "unsupported access mode: %s", modeName)
}
}
}
return nil
}
Expand Down

0 comments on commit 1ac5218

Please sign in to comment.