Feature/update to csi 1.0 (#9)
* updated all image to v1.0.1 csi * Updated golang code to csi 1.0 compatible names * added comment
This commit is contained in:
parent
1709545db6
commit
e326d607d0
8 changed files with 143 additions and 46 deletions
|
@ -28,7 +28,7 @@ import (
|
|||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
)
|
||||
|
||||
|
@ -97,9 +97,9 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||
s3Vol.VolID = volumeID
|
||||
return &csi.CreateVolumeResponse{
|
||||
Volume: &csi.Volume{
|
||||
Id: volumeID,
|
||||
VolumeId: volumeID,
|
||||
CapacityBytes: capacityBytes,
|
||||
Attributes: req.GetParameters(),
|
||||
VolumeContext: req.GetParameters(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
@ -153,12 +153,17 @@ func (cs *controllerServer) ValidateVolumeCapabilities(ctx context.Context, req
|
|||
return nil, status.Error(codes.NotFound, fmt.Sprintf("Volume with id %s does not exist", req.GetVolumeId()))
|
||||
}
|
||||
|
||||
for _, cap := range req.VolumeCapabilities {
|
||||
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Supported: false, Message: ""}, nil
|
||||
}
|
||||
}
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Supported: true, Message: ""}, nil
|
||||
// TODO: checkout if this code is still needed?
|
||||
//for _, cap := range req.VolumeCapabilities {
|
||||
// if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
||||
// return &csi.ValidateVolumeCapabilitiesResponse{Confirmed: false, Message: ""}, nil
|
||||
// }
|
||||
//}
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Confirmed: &csi.ValidateVolumeCapabilitiesResponse_Confirmed{
|
||||
VolumeContext: req.GetVolumeContext(),
|
||||
VolumeCapabilities: req.GetVolumeCapabilities(),
|
||||
Parameters: req.GetParameters(),
|
||||
}, Message: ""}, nil
|
||||
}
|
||||
|
||||
func sanitizeVolumeID(volumeID string) string {
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
"github.com/golang/glog"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
|
@ -63,13 +63,14 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
|||
}
|
||||
|
||||
deviceID := ""
|
||||
if req.GetPublishInfo() != nil {
|
||||
deviceID = req.GetPublishInfo()[deviceID]
|
||||
if req.GetPublishContext() != nil {
|
||||
deviceID = req.GetPublishContext()[deviceID]
|
||||
}
|
||||
|
||||
// TODO: Implement readOnly & mountFlags
|
||||
readOnly := req.GetReadonly()
|
||||
attrib := req.GetVolumeAttributes()
|
||||
// TODO: check if attrib is correct with context.
|
||||
attrib := req.GetVolumeContext()
|
||||
mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()
|
||||
|
||||
glog.V(4).Infof("target %v\ndevice %v\nreadonly %v\nvolumeId %v\nattributes %v\nmountflags %v\n",
|
||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
package s3
|
||||
|
||||
import (
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/golang/glog"
|
||||
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue