Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(swarm): removed workaround support for mock staging/unstaging #746

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 15 additions & 38 deletions internal/driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package driver
import (
"context"
"fmt"
"os"

proto "github.com/container-storage-interface/spec/lib/go/csi"
"github.com/go-kit/log"
Expand All @@ -22,11 +21,6 @@ type NodeService struct {
volumeMountService volumes.MountService
volumeResizeService volumes.ResizeService
volumeStatsService volumes.StatsService
// enable volume staging api to workaround
// docker CSI support not working properly
// if a plugin does not support staging
// see https://github.com/moby/swarmkit/pull/3116
forceVolumeStaging bool
}

func NewNodeService(
Expand All @@ -44,20 +38,17 @@ func NewNodeService(
volumeMountService: volumeMountService,
volumeResizeService: volumeResizeService,
volumeStatsService: volumeStatsService,
forceVolumeStaging: os.Getenv("FORCE_STAGING_SUPPORT") == "true",
}
}

const encryptionPassphraseKey = "encryption-passphrase"

func (s *NodeService) NodeStageVolume(_ context.Context, _ *proto.NodeStageVolumeRequest) (*proto.NodeStageVolumeResponse, error) {
// while we dont do anything here, Swarm 23.0.1 might require this
return &proto.NodeStageVolumeResponse{}, nil
return nil, status.Error(codes.Unimplemented, "not supported")
}

func (s *NodeService) NodeUnstageVolume(_ context.Context, _ *proto.NodeUnstageVolumeRequest) (*proto.NodeUnstageVolumeResponse, error) {
// while we dont do anything here, Swarm 23.0.1 might require this
return &proto.NodeUnstageVolumeResponse{}, nil
return nil, status.Error(codes.Unimplemented, "not supported")
}

func (s *NodeService) NodePublishVolume(_ context.Context, req *proto.NodePublishVolumeRequest) (*proto.NodePublishVolumeResponse, error) {
Expand Down Expand Up @@ -159,38 +150,24 @@ func (s *NodeService) NodeGetVolumeStats(_ context.Context, req *proto.NodeGetVo
}

func (s *NodeService) NodeGetCapabilities(_ context.Context, _ *proto.NodeGetCapabilitiesRequest) (*proto.NodeGetCapabilitiesResponse, error) {
capabilities := []*proto.NodeServiceCapability{
{
Type: &proto.NodeServiceCapability_Rpc{
Rpc: &proto.NodeServiceCapability_RPC{
Type: proto.NodeServiceCapability_RPC_EXPAND_VOLUME,
return &proto.NodeGetCapabilitiesResponse{
Capabilities: []*proto.NodeServiceCapability{
{
Type: &proto.NodeServiceCapability_Rpc{
Rpc: &proto.NodeServiceCapability_RPC{
Type: proto.NodeServiceCapability_RPC_EXPAND_VOLUME,
},
},
},
},
{
Type: &proto.NodeServiceCapability_Rpc{
Rpc: &proto.NodeServiceCapability_RPC{
Type: proto.NodeServiceCapability_RPC_GET_VOLUME_STATS,
{
Type: &proto.NodeServiceCapability_Rpc{
Rpc: &proto.NodeServiceCapability_RPC{
Type: proto.NodeServiceCapability_RPC_GET_VOLUME_STATS,
},
},
},
},
}

if s.forceVolumeStaging {
capabilities = append(capabilities, &proto.NodeServiceCapability{
Type: &proto.NodeServiceCapability_Rpc{
Rpc: &proto.NodeServiceCapability_RPC{
Type: proto.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
},
},
})
}

resp := &proto.NodeGetCapabilitiesResponse{
Capabilities: capabilities,
}

return resp, nil
}, nil
}

func (s *NodeService) NodeGetInfo(_ context.Context, _ *proto.NodeGetInfoRequest) (*proto.NodeGetInfoResponse, error) {
Expand Down