Skip to content

Commit

Permalink
fix: don't default to sharedv4/shared for RWX Volumes if proxy spec i…
Browse files Browse the repository at this point in the history
…s set

Signed-off-by: Shivanjan Chakravorty <[email protected]>
  • Loading branch information
Glitchfix committed Aug 24, 2023
1 parent 8015fc0 commit 57d76df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions csi/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,11 @@ func resolveSharedSpec(spec *api.VolumeSpec, req *csi.CreateVolumeRequest) (*api
return spec, nil
}

// don't default to sharedv4/shared for RWX Volumes if proxy spec is set
if spec.ProxySpec != nil {
return spec, nil
}

var shared bool
for _, cap := range req.GetVolumeCapabilities() {
mode := cap.GetAccessMode().GetMode()
Expand Down
24 changes: 24 additions & 0 deletions csi/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3289,6 +3289,30 @@ func TestResolveSpecFromCSI(t *testing.T) {
},
},
},
{
name: "Should not set shared flag to true for RWX Volumes if proxy spec is set",
req: &csi.CreateVolumeRequest{
VolumeCapabilities: []*csi.VolumeCapability{
{
AccessMode: &csi.VolumeCapability_AccessMode{
Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER,
},
},
},
},
existingSpec: &api.VolumeSpec{
ProxySpec: &api.ProxySpec{
ProxyProtocol: api.ProxyProtocol_PROXY_PROTOCOL_NFS,
},
},

expectedSpec: &api.VolumeSpec{
Shared: false,
ProxySpec: &api.ProxySpec{
ProxyProtocol: api.ProxyProtocol_PROXY_PROTOCOL_NFS,
},
},
},
}

for _, tc := range tt {
Expand Down

0 comments on commit 57d76df

Please sign in to comment.