Skip to content

Commit

Permalink
Merge pull request #15 from msau42/more-access-modes
Browse files Browse the repository at this point in the history
Add more access modes to volume capabilities
  • Loading branch information
k8s-ci-robot authored Mar 27, 2020
2 parents c197f2a + 790b67c commit 2bb0d1e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/nfs/nfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type nfsDriver struct {

//ids *identityServer
ns *nodeServer
cap []*csi.VolumeCapability_AccessMode
cap map[csi.VolumeCapability_AccessMode_Mode]bool
cscap []*csi.ControllerServiceCapability
}

Expand All @@ -51,9 +51,18 @@ func NewNFSdriver(nodeID, endpoint string) *nfsDriver {
version: version,
nodeID: nodeID,
endpoint: endpoint,
cap: map[csi.VolumeCapability_AccessMode_Mode]bool{},
}

n.AddVolumeCapabilityAccessModes([]csi.VolumeCapability_AccessMode_Mode{csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER})
vcam := []csi.VolumeCapability_AccessMode_Mode{
csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY,
csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY,
csi.VolumeCapability_AccessMode_MULTI_NODE_SINGLE_WRITER,
csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
}
n.AddVolumeCapabilityAccessModes(vcam)

// NFS plugin does not support ControllerServiceCapability now.
// If support is added, it should set to appropriate
// ControllerServiceCapability RPC types.
Expand Down Expand Up @@ -86,8 +95,8 @@ func (n *nfsDriver) AddVolumeCapabilityAccessModes(vc []csi.VolumeCapability_Acc
for _, c := range vc {
glog.Infof("Enabling volume access mode: %v", c.String())
vca = append(vca, &csi.VolumeCapability_AccessMode{Mode: c})
n.cap[c] = true
}
n.cap = vca
return vca
}

Expand Down

0 comments on commit 2bb0d1e

Please sign in to comment.