Skip to content

Commit

Permalink
Remove yet unused csi-volume-attribute retryTimeout (#4233)
Browse files Browse the repository at this point in the history
  • Loading branch information
0sewa0 authored Dec 19, 2024
1 parent c7f6748 commit 8b4c874
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 59 deletions.
14 changes: 0 additions & 14 deletions pkg/controllers/csi/driver/volumes/volume_config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package csivolumes

import (
"time"

"github.com/container-storage-interface/spec/lib/go/csi"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand All @@ -29,7 +27,6 @@ type VolumeConfig struct {
PodName string
Mode string
DynakubeName string
RetryTimeout time.Duration
}

// Transforms the NodePublishVolumeRequest into a VolumeConfig
Expand Down Expand Up @@ -76,16 +73,6 @@ func ParseNodePublishVolumeRequest(req *csi.NodePublishVolumeRequest) (*VolumeCo
return nil, status.Error(codes.InvalidArgument, "No dynakube attribute included with request")
}

retryTimeoutValue := volCtx[CSIVolumeAttributeRetryTimeout]
if retryTimeoutValue == "" {
return nil, status.Error(codes.InvalidArgument, "No retryTimeout attribute included with request")
}

retryTimeout, err := time.ParseDuration(retryTimeoutValue)
if err != nil {
return nil, status.Error(codes.InvalidArgument, "The retryTimeout attribute has incorrect format")
}

return &VolumeConfig{
VolumeInfo: VolumeInfo{
VolumeID: volID,
Expand All @@ -94,7 +81,6 @@ func ParseNodePublishVolumeRequest(req *csi.NodePublishVolumeRequest) (*VolumeCo
PodName: podName,
Mode: mode,
DynakubeName: dynakubeName,
RetryTimeout: retryTimeout,
}, nil
}

Expand Down
44 changes: 0 additions & 44 deletions pkg/controllers/csi/driver/volumes/volume_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package csivolumes

import (
"testing"
"time"

"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -142,47 +141,6 @@ func TestCSIDriverServer_ParsePublishVolumeRequest(t *testing.T) {
require.Error(t, err)
assert.Nil(t, volumeCfg)
})
t.Run(`retryTimeout missing from requests volume context`, func(t *testing.T) {
request := &csi.NodePublishVolumeRequest{
VolumeCapability: &csi.VolumeCapability{
AccessType: &csi.VolumeCapability_Mount{
Mount: &csi.VolumeCapability_MountVolume{},
},
},
VolumeId: testVolumeId,
TargetPath: testTargetPath,
VolumeContext: map[string]string{
PodNameContextKey: testPodUID,
CSIVolumeAttributeDynakubeField: testDynakubeName,
CSIVolumeAttributeModeField: "test",
},
}
volumeCfg, err := ParseNodePublishVolumeRequest(request)

require.Error(t, err)
assert.Nil(t, volumeCfg)
})
t.Run(`retryTimeout has incorrect format`, func(t *testing.T) {
request := &csi.NodePublishVolumeRequest{
VolumeCapability: &csi.VolumeCapability{
AccessType: &csi.VolumeCapability_Mount{
Mount: &csi.VolumeCapability_MountVolume{},
},
},
VolumeId: testVolumeId,
TargetPath: testTargetPath,
VolumeContext: map[string]string{
PodNameContextKey: testPodUID,
CSIVolumeAttributeDynakubeField: testDynakubeName,
CSIVolumeAttributeModeField: "test",
CSIVolumeAttributeRetryTimeout: "5",
},
}
volumeCfg, err := ParseNodePublishVolumeRequest(request)

require.Error(t, err)
assert.Nil(t, volumeCfg)
})
t.Run(`request is parsed correctly`, func(t *testing.T) {
request := &csi.NodePublishVolumeRequest{
VolumeCapability: &csi.VolumeCapability{
Expand All @@ -196,7 +154,6 @@ func TestCSIDriverServer_ParsePublishVolumeRequest(t *testing.T) {
PodNameContextKey: testPodUID,
CSIVolumeAttributeDynakubeField: testDynakubeName,
CSIVolumeAttributeModeField: "test",
CSIVolumeAttributeRetryTimeout: "5m",
},
}
volumeCfg, err := ParseNodePublishVolumeRequest(request)
Expand All @@ -208,6 +165,5 @@ func TestCSIDriverServer_ParsePublishVolumeRequest(t *testing.T) {
assert.Equal(t, testPodUID, volumeCfg.PodName)
assert.Equal(t, "test", volumeCfg.Mode)
assert.Equal(t, testDynakubeName, volumeCfg.DynakubeName)
assert.Equal(t, time.Minute*5, volumeCfg.RetryTimeout)
})
}
1 change: 0 additions & 1 deletion pkg/controllers/dynakube/oneagent/daemonset/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ func getCSIStorageVolume(dk *dynakube.DynaKube) corev1.Volume {
VolumeAttributes: map[string]string{
csivolumes.CSIVolumeAttributeModeField: hostvolumes.Mode,
csivolumes.CSIVolumeAttributeDynakubeField: dk.Name,
csivolumes.CSIVolumeAttributeRetryTimeout: dk.FeatureMaxCSIRetryTimeout().String(),
},
},
},
Expand Down

0 comments on commit 8b4c874

Please sign in to comment.