Skip to content

Commit

Permalink
feat(csi): get cstorvolume policy from the SC parameters (#66)
Browse files Browse the repository at this point in the history
Changes gets the cstorvolumepolicy name from the storageclass
parameters and sets the annotations in Cstorvolumeclaim to get
it further used in configure cstorvolume target pods, etc

Signed-off-by: prateekpandey14 <[email protected]>
  • Loading branch information
prateekpandey14 authored and vishnuitta committed Jan 6, 2020
1 parent 58479bd commit a5679de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#!/usr/bin/env bash

OPENEBS_OPERATOR=https://raw.githubusercontent.com/openebs/openebs/master/k8s/openebs-operator.yaml
CSPC_OPERATOR=https://raw.githubusercontent.com/openebs/openebs/master/k8s/cspc-operator.yaml
CSPC_OPERATOR=https://raw.githubusercontent.com/openebs/openebs/master/k8s/cstor-operator.yaml
CSI_OPERATOR="$GOPATH/src/github.com/openebs/cstor-csi/deploy/csi-operator.yaml"

SRC_REPO="https://github.com/openebs/maya.git"
Expand Down
3 changes: 2 additions & 1 deletion pkg/service/v1alpha1/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (cs *controller) CreateVolume(
size := req.GetCapacityRange().RequiredBytes
rCount := req.GetParameters()["replicaCount"]
cspcName := req.GetParameters()["cstorPoolCluster"]
policyName := req.GetParameters()["cstorVolumePolicy"]
VolumeContext := map[string]string{
"openebs.io/cas-type": req.GetParameters()["cas-type"],
}
Expand All @@ -117,7 +118,7 @@ func (cs *controller) CreateVolume(
if err == nil && cvc != nil && cvc.DeletionTimestamp == nil {
goto createVolumeResponse
}
err = utils.ProvisionVolume(size, volName, rCount, cspcName, snapshotID)
err = utils.ProvisionVolume(size, volName, rCount, cspcName, snapshotID, policyName)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}
Expand Down
10 changes: 6 additions & 4 deletions pkg/utils/v1alpha1/maya.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const (
gib100 int64 = gib * 100
tib int64 = gib * 1024
tib100 int64 = tib * 100
// OpenebsConfigClass is the config class name passed to CSI from the
// OpenebsVolumePolicy is the config policy name passed to CSI from the
// storage class parameters
OpenebsConfigClass = "openebs.io/config-class"
OpenebsVolumePolicy = "openebs.io/volume-policy"
// OpenebsVolumeID is the PV name passed to CSI
OpenebsVolumeID = "openebs.io/volumeID"
// OpenebsCSPCName is the name of cstor storagepool cluster
Expand All @@ -49,11 +49,13 @@ func ProvisionVolume(
volName,
replicaCount,
cspcName,
snapshotID string,
snapshotID,
policyName string,
) error {

annotations := map[string]string{
OpenebsVolumeID: volName,
OpenebsVolumeID: volName,
OpenebsVolumePolicy: policyName,
}

labels := map[string]string{
Expand Down

0 comments on commit a5679de

Please sign in to comment.