From 34f5ac9c5f2279646e4a00d04f8eb7f3294c10c4 Mon Sep 17 00:00:00 2001 From: lukasmetzner Date: Thu, 10 Oct 2024 08:16:41 +0200 Subject: [PATCH 1/2] chore: Removed intermediate features for mock staging/unstaging in Docker swarm With the merge of https://github.com/moby/swarmkit/pull/3116 the mock staging/unstaging is not needed anymore. It was introduced in our csi-driver in this commit: https://github.com/hetznercloud/csi-driver/commit/619fa5c3996e17e84b09deca0c956229e5554c77. Which is part of a large PR (squashed commit) that included experimental support for Docker swarm. --- internal/driver/node.go | 53 ++++++++++++----------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/internal/driver/node.go b/internal/driver/node.go index 0d07dc1f..fcbf8a30 100644 --- a/internal/driver/node.go +++ b/internal/driver/node.go @@ -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" @@ -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( @@ -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) { @@ -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) { From 3bb844f9fcd94f23b1c02f44d29b4b9909fbac06 Mon Sep 17 00:00:00 2001 From: lukasmetzner Date: Thu, 17 Oct 2024 14:47:05 +0200 Subject: [PATCH 2/2] chore: Removed environment variable from config --- deploy/docker-swarm/pkg/config.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/deploy/docker-swarm/pkg/config.json b/deploy/docker-swarm/pkg/config.json index d518ed27..2637c38f 100644 --- a/deploy/docker-swarm/pkg/config.json +++ b/deploy/docker-swarm/pkg/config.json @@ -26,12 +26,6 @@ "value" ], "value": "debug" - }, - { - "name": "FORCE_STAGING_SUPPORT", - "description": "workaround: force staging support to make Docker 23.0.0 work without https://github.com/moby/swarmkit/pull/3116", - "settable": ["value"], - "value": "true" } ], "interface": { @@ -65,4 +59,4 @@ "type": "host" }, "propagatedmount": "/data/published" -} \ No newline at end of file +}