Revert capabilites to only allow RWO (#12)
This commit is contained in:
parent
83723f4be0
commit
95d7e48328
1 changed files with 20 additions and 11 deletions
|
@ -153,17 +153,26 @@ 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()))
|
return nil, status.Error(codes.NotFound, fmt.Sprintf("Volume with id %s does not exist", req.GetVolumeId()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: checkout if this code is still needed?
|
// We currently only support RWO
|
||||||
//for _, cap := range req.VolumeCapabilities {
|
supportedAccessMode := &csi.VolumeCapability_AccessMode{
|
||||||
// if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER,
|
||||||
// return &csi.ValidateVolumeCapabilitiesResponse{Confirmed: false, Message: ""}, nil
|
}
|
||||||
// }
|
|
||||||
//}
|
for _, cap := range req.VolumeCapabilities {
|
||||||
return &csi.ValidateVolumeCapabilitiesResponse{Confirmed: &csi.ValidateVolumeCapabilitiesResponse_Confirmed{
|
if cap.GetAccessMode().GetMode() != supportedAccessMode.GetMode() {
|
||||||
VolumeContext: req.GetVolumeContext(),
|
return &csi.ValidateVolumeCapabilitiesResponse{Message: "Only single node writer is supported"}, nil
|
||||||
VolumeCapabilities: req.GetVolumeCapabilities(),
|
}
|
||||||
Parameters: req.GetParameters(),
|
}
|
||||||
}, Message: ""}, nil
|
|
||||||
|
return &csi.ValidateVolumeCapabilitiesResponse{
|
||||||
|
Confirmed: &csi.ValidateVolumeCapabilitiesResponse_Confirmed{
|
||||||
|
VolumeCapabilities: []*csi.VolumeCapability{
|
||||||
|
{
|
||||||
|
AccessMode: supportedAccessMode,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func sanitizeVolumeID(volumeID string) string {
|
func sanitizeVolumeID(volumeID string) string {
|
||||||
|
|
Loading…
Reference in a new issue