Skip to content

Commit 0c34060

Browse files
authored
Add TLS cipher suites in the mount options (#263)
* update versions Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * publish v0.9.2 Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * publish v0.9.6 Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * renaming Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> * uts Signed-off-by: Ashima-Ashima1 <[email protected]> * set cipher suites from secrets in mount options Signed-off-by: Ashima-Ashima1 <[email protected]> --------- Signed-off-by: Ashima-Ashima1 <[email protected]>
1 parent 1d5d20f commit 0c34060

15 files changed

+134
-63
lines changed

.secrets.baseline

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-08-25T02:32:44Z",
6+
"generated_at": "2025-09-04T09:22:05Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -218,7 +218,7 @@
218218
{
219219
"hashed_secret": "2e7a7ee14caebf378fc32d6cf6f557f347c96773",
220220
"is_verified": false,
221-
"line_number": 20,
221+
"line_number": 21,
222222
"type": "Secret Keyword",
223223
"verified_result": null
224224
}
@@ -270,7 +270,7 @@
270270
{
271271
"hashed_secret": "c7c6508b19455e3e8040e60e9833fbede92e5d8e",
272272
"is_verified": false,
273-
"line_number": 368,
273+
"line_number": 376,
274274
"type": "Secret Keyword",
275275
"verified_result": null
276276
}

go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ require (
1414
github.com/google/uuid v1.6.0
1515
github.com/kubernetes-csi/csi-test/v5 v5.3.1
1616
github.com/mitchellh/go-ps v1.0.0
17-
github.com/onsi/ginkgo/v2 v2.24.0
18-
github.com/onsi/gomega v1.38.0
17+
github.com/onsi/ginkgo/v2 v2.25.1
18+
github.com/onsi/gomega v1.38.1
1919
github.com/prometheus/client_golang v1.23.0
2020
github.com/stretchr/testify v1.10.0
2121
go.uber.org/zap v1.27.0
@@ -35,7 +35,7 @@ require (
3535
github.com/BurntSushi/toml v1.0.0 // indirect
3636
github.com/IBM/secret-utils-lib v1.1.14 // indirect
3737
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab // indirect
38-
github.com/Masterminds/semver/v3 v3.3.1 // indirect
38+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
3939
github.com/Microsoft/go-winio v0.6.2 // indirect
4040
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
4141
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
@@ -85,7 +85,7 @@ require (
8585
github.com/google/cel-go v0.23.2 // indirect
8686
github.com/google/gnostic-models v0.6.9 // indirect
8787
github.com/google/go-cmp v0.7.0 // indirect
88-
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
88+
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect
8989
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
9090
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
9191
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -142,6 +142,7 @@ require (
142142
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
143143
go.uber.org/automaxprocs v1.6.0 // indirect
144144
go.uber.org/multierr v1.11.0 // indirect
145+
go.yaml.in/yaml/v3 v3.0.4 // indirect
145146
golang.org/x/arch v0.8.0 // indirect
146147
golang.org/x/crypto v0.41.0 // indirect
147148
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect

go.sum

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ github.com/IBM/secret-utils-lib v1.1.14 h1:Gv5Ca2hZTQMr9+PkOq7AE2lUUnNEeQJ0uiKax
1616
github.com/IBM/secret-utils-lib v1.1.14/go.mod h1:wAAmS6JOrgcASOuyDkclmxWdKMcbVxshW5QWlMn21X8=
1717
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab h1:UKkYhof1njT1/xq4SEg5z+VpTgjmNeHwPGRQl7takDI=
1818
github.com/JeffAshton/win_pdh v0.0.0-20161109143554-76bb4ee9f0ab/go.mod h1:3VYc5hodBMJ5+l/7J4xAyMeuM2PNuepvHlGs8yilUCA=
19-
github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4=
20-
github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
19+
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
20+
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
2121
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
2222
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
2323
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
@@ -146,8 +146,8 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
146146
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
147147
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
148148
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
149-
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8=
150-
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
149+
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY=
150+
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U=
151151
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
152152
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
153153
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo=
@@ -230,10 +230,10 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
230230
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
231231
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
232232
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
233-
github.com/onsi/ginkgo/v2 v2.24.0 h1:obZz8LAnHicNdbBqvG3ytAFx8fgza+i1IDpBVcHT2YE=
234-
github.com/onsi/ginkgo/v2 v2.24.0/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk=
235-
github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY=
236-
github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o=
233+
github.com/onsi/ginkgo/v2 v2.25.1 h1:Fwp6crTREKM+oA6Cz4MsO8RhKQzs2/gOIVOUscMAfZY=
234+
github.com/onsi/ginkgo/v2 v2.25.1/go.mod h1:ppTWQ1dh9KM/F1XgpeRqelR+zHVwV81DGRSDnFxK7Sk=
235+
github.com/onsi/gomega v1.38.1 h1:FaLA8GlcpXDwsb7m0h2A9ew2aTk3vnZMlzFgg5tz/pk=
236+
github.com/onsi/gomega v1.38.1/go.mod h1:LfcV8wZLvwcYRwPiJysphKAEsmcFnLMK/9c+PjvlX8g=
237237
github.com/opencontainers/cgroups v0.0.1 h1:MXjMkkFpKv6kpuirUa4USFBas573sSAY082B4CiHEVA=
238238
github.com/opencontainers/cgroups v0.0.1/go.mod h1:s8lktyhlGUqM7OSRL5P7eAW6Wb+kWPNvt4qvVfzA5vs=
239239
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
@@ -327,6 +327,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
327327
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
328328
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
329329
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
330+
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
331+
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
330332
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
331333
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
332334
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=

pkg/constants/constants.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ const (
4848
IsNodeServer = "IS_NODE_SERVER"
4949
KubeNodeName = "KUBE_NODE_NAME"
5050
MaxVolumesPerNodeEnv = "MAX_VOLUMES_PER_NODE"
51+
52+
CipherSuitesKey = "cipher_suites"
5153
)
5254

5355
var (

pkg/driver/nodeserver.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type NodeServerConfig struct {
3939
Region string
4040
Zone string
4141
NodeID string
42+
TLSCipherSuite string
4243
}
4344

4445
func (ns *nodeServer) NodeStageVolume(_ context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
@@ -161,7 +162,11 @@ func (ns *nodeServer) NodePublishVolume(_ context.Context, req *csi.NodePublishV
161162
secretMap["bucketName"] = tempBucketName
162163
}
163164

164-
mounterObj := ns.Mounter.NewMounter(attrib, secretMap, mountFlags)
165+
var defaultParamsMap = map[string]string{
166+
constants.CipherSuitesKey: ns.TLSCipherSuite,
167+
}
168+
169+
mounterObj := ns.Mounter.NewMounter(attrib, secretMap, mountFlags, defaultParamsMap)
165170

166171
klog.Info("-NodePublishVolume-: Mount")
167172
if err = mounterObj.Mount("", targetPath); err != nil {
@@ -192,7 +197,7 @@ func (ns *nodeServer) NodeUnpublishVolume(_ context.Context, req *csi.NodeUnpubl
192197
return nil, status.Error(codes.NotFound, "Failed to get PV details")
193198
}
194199

195-
mounterObj := ns.Mounter.NewMounter(attrib, nil, nil)
200+
mounterObj := ns.Mounter.NewMounter(attrib, nil, nil, nil)
196201

197202
klog.Info("-NodeUnpublishVolume-: Unmount")
198203
if err = mounterObj.Unmount(targetPath); err != nil {

pkg/driver/s3-driver.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"fmt"
1515
"os"
1616
"strconv"
17+
"strings"
1718

1819
"github.com/IBM/ibm-csi-common/pkg/utils"
1920
"github.com/IBM/ibm-object-csi-driver/pkg/constants"
@@ -140,7 +141,7 @@ func newNodeServer(d *S3Driver, statsUtil pkgUtils.StatsUtils, nodeID string, mo
140141
return nil, fmt.Errorf("KUBE_NODE_NAME env variable not set")
141142
}
142143

143-
region, zone, err := statsUtil.GetRegionAndZone(nodeName)
144+
data, err := statsUtil.GetClusterNodeData(nodeName)
144145
if err != nil {
145146
return nil, err
146147
}
@@ -157,12 +158,18 @@ func newNodeServer(d *S3Driver, statsUtil pkgUtils.StatsUtils, nodeID string, mo
157158
maxVolumesPerNode = int64(constants.DefaultVolumesPerNode)
158159
}
159160

161+
ciphersuite := "default"
162+
if strings.Contains(strings.ToLower(data.OS), "ubuntu") {
163+
ciphersuite = "AESGCM"
164+
}
165+
160166
return &nodeServer{
161-
S3Driver: d,
162-
Stats: statsUtil,
163-
NodeServerConfig: NodeServerConfig{MaxVolumesPerNode: maxVolumesPerNode, Region: region, Zone: zone, NodeID: nodeID},
164-
Mounter: mountObj,
165-
MounterUtils: mounterUtil,
167+
S3Driver: d,
168+
Stats: statsUtil,
169+
NodeServerConfig: NodeServerConfig{MaxVolumesPerNode: maxVolumesPerNode, Region: data.Region, Zone: data.Zone,
170+
NodeID: nodeID, TLSCipherSuite: ciphersuite},
171+
Mounter: mountObj,
172+
MounterUtils: mounterUtil,
166173
}, nil
167174
}
168175

pkg/driver/s3-driver_test.go

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ func TestNewNodeServer(t *testing.T) {
119119
constants.MaxVolumesPerNodeEnv: "10",
120120
},
121121
statsUtils: utils.NewFakeStatsUtilsImpl(utils.FakeStatsUtilsFuncStruct{
122-
GetRegionAndZoneFn: func(nodeName string) (string, string, error) { return testRegion, testZone, nil },
122+
GetClusterNodeDataFn: func(nodeName string) (*utils.ClusterNodeData, error) {
123+
return &utils.ClusterNodeData{
124+
Region: testRegion,
125+
Zone: testZone,
126+
OS: "ubuntu",
127+
}, nil
128+
},
123129
}),
124130
verifyResult: func(t *testing.T, ns *nodeServer, err error) {
125131
assert.NoError(t, err)
@@ -149,8 +155,8 @@ func TestNewNodeServer(t *testing.T) {
149155
constants.MaxVolumesPerNodeEnv: "",
150156
},
151157
statsUtils: utils.NewFakeStatsUtilsImpl(utils.FakeStatsUtilsFuncStruct{
152-
GetRegionAndZoneFn: func(nodeName string) (string, string, error) {
153-
return "", "", errors.New("unable to load in-cluster configuration")
158+
GetClusterNodeDataFn: func(nodeName string) (*utils.ClusterNodeData, error) {
159+
return nil, errors.New("unable to load in-cluster configuration")
154160
},
155161
}),
156162
verifyResult: func(t *testing.T, ns *nodeServer, err error) {
@@ -165,8 +171,11 @@ func TestNewNodeServer(t *testing.T) {
165171
constants.MaxVolumesPerNodeEnv: "invalid",
166172
},
167173
statsUtils: utils.NewFakeStatsUtilsImpl(utils.FakeStatsUtilsFuncStruct{
168-
GetRegionAndZoneFn: func(nodeName string) (string, string, error) {
169-
return testRegion, testZone, nil
174+
GetClusterNodeDataFn: func(nodeName string) (*utils.ClusterNodeData, error) {
175+
return &utils.ClusterNodeData{
176+
Region: testRegion,
177+
Zone: testZone,
178+
}, nil
170179
},
171180
}),
172181
verifyResult: func(t *testing.T, ns *nodeServer, err error) {
@@ -181,7 +190,12 @@ func TestNewNodeServer(t *testing.T) {
181190
constants.MaxVolumesPerNodeEnv: "",
182191
},
183192
statsUtils: utils.NewFakeStatsUtilsImpl(utils.FakeStatsUtilsFuncStruct{
184-
GetRegionAndZoneFn: func(nodeName string) (string, string, error) { return testRegion, testZone, nil },
193+
GetClusterNodeDataFn: func(nodeName string) (*utils.ClusterNodeData, error) {
194+
return &utils.ClusterNodeData{
195+
Region: testRegion,
196+
Zone: testZone,
197+
}, nil
198+
},
185199
}),
186200
verifyResult: func(t *testing.T, ns *nodeServer, err error) {
187201
assert.NoError(t, err)
@@ -270,7 +284,12 @@ func TestNewS3CosDriver(t *testing.T) {
270284
GetEndpointsFn: func() (string, string, error) {
271285
return constants.PublicIAMEndpoint, "", nil
272286
},
273-
GetRegionAndZoneFn: func(nodeName string) (string, string, error) { return testRegion, testZone, nil },
287+
GetClusterNodeDataFn: func(nodeName string) (*utils.ClusterNodeData, error) {
288+
return &utils.ClusterNodeData{
289+
Region: testRegion,
290+
Zone: testZone,
291+
}, nil
292+
},
274293
}),
275294
verifyResult: func(t *testing.T, driver *S3Driver, err error) {
276295
assert.NoError(t, err)
@@ -287,7 +306,12 @@ func TestNewS3CosDriver(t *testing.T) {
287306
GetEndpointsFn: func() (string, string, error) {
288307
return constants.PublicIAMEndpoint, "", nil
289308
},
290-
GetRegionAndZoneFn: func(nodeName string) (string, string, error) { return testRegion, testZone, nil },
309+
GetClusterNodeDataFn: func(nodeName string) (*utils.ClusterNodeData, error) {
310+
return &utils.ClusterNodeData{
311+
Region: testRegion,
312+
Zone: testZone,
313+
}, nil
314+
},
291315
}),
292316
verifyResult: func(t *testing.T, driver *S3Driver, err error) {
293317
assert.NoError(t, err)

pkg/mounter/fake_mounter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type FakeMounterFactory struct {
1717
IsFailedUnmount bool
1818
}
1919

20-
func (f *FakeMounterFactory) NewMounter(attrib map[string]string, secretMap map[string]string, mountFlags []string) Mounter {
20+
func (f *FakeMounterFactory) NewMounter(attrib map[string]string, secretMap map[string]string, mountFlags []string, defaultParams map[string]string) Mounter {
2121
switch f.Mounter {
2222
case constants.S3FS:
2323
return fakenewS3fsMounter(f.IsFailedMount, f.IsFailedUnmount)

pkg/mounter/mounter-s3fs.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var (
5050
removeFile = removeS3FSCredFile
5151
)
5252

53-
func NewS3fsMounter(secretMap map[string]string, mountOptions []string, mounterUtils utils.MounterUtils) Mounter {
53+
func NewS3fsMounter(secretMap map[string]string, mountOptions []string, mounterUtils utils.MounterUtils, defaultParams map[string]string) Mounter {
5454
klog.Info("-newS3fsMounter-")
5555

5656
var (
@@ -103,7 +103,7 @@ func NewS3fsMounter(secretMap map[string]string, mountOptions []string, mounterU
103103
klog.Infof("newS3fsMounter args:\n\tbucketName: [%s]\n\tobjPath: [%s]\n\tendPoint: [%s]\n\tlocationConstraint: [%s]\n\tauthType: [%s]\n\tkpRootKeyCrn: [%s]",
104104
mounter.BucketName, mounter.ObjPath, mounter.EndPoint, mounter.LocConstraint, mounter.AuthType, mounter.KpRootKeyCrn)
105105

106-
updatedOptions := updateS3FSMountOptions(mountOptions, secretMap)
106+
updatedOptions := updateS3FSMountOptions(mountOptions, secretMap, defaultParams)
107107
mounter.MountOptions = updatedOptions
108108

109109
mounter.MounterUtils = mounterUtils
@@ -208,7 +208,7 @@ func (s3fs *S3fsMounter) Unmount(target string) error {
208208
return nil
209209
}
210210

211-
func updateS3FSMountOptions(defaultMountOp []string, secretMap map[string]string) []string {
211+
func updateS3FSMountOptions(defaultMountOp []string, secretMap map[string]string, defaultParams map[string]string) []string {
212212
mountOptsMap := make(map[string]string)
213213

214214
// Create map out of array
@@ -285,6 +285,12 @@ func updateS3FSMountOptions(defaultMountOp []string, secretMap map[string]string
285285
updatedOptions = append(updatedOptions, option)
286286
}
287287

288+
// Mount options which are not present in secret mountOptions and need to be set by nodeserver
289+
if _, ok := mountOptsMap[constants.CipherSuitesKey]; !ok {
290+
option := fmt.Sprintf("%s=%s", constants.CipherSuitesKey, defaultParams[constants.CipherSuitesKey])
291+
updatedOptions = append(updatedOptions, option)
292+
}
293+
288294
klog.Infof("updated S3fsMounter Options: %v", updatedOptions)
289295
return updatedOptions
290296
}

pkg/mounter/mounter-s3fs_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"testing"
77

8+
"github.com/IBM/ibm-object-csi-driver/pkg/constants"
89
mounterUtils "github.com/IBM/ibm-object-csi-driver/pkg/mounter/utils"
910
"github.com/stretchr/testify/assert"
1011
)
@@ -26,7 +27,7 @@ var (
2627
)
2728

2829
func TestNewS3fsMounter_Success(t *testing.T) {
29-
mounter := NewS3fsMounter(secretMap, mountOptions, mounterUtils.NewFakeMounterUtilsImpl(mounterUtils.FakeMounterUtilsFuncStruct{}))
30+
mounter := NewS3fsMounter(secretMap, mountOptions, mounterUtils.NewFakeMounterUtilsImpl(mounterUtils.FakeMounterUtilsFuncStruct{}), map[string]string{constants.CipherSuitesKey: "default"})
3031

3132
s3fsMounter, ok := mounter.(*S3fsMounter)
3233
assert.True(t, ok)
@@ -55,7 +56,7 @@ func TestNewS3fsMounter_Success_Hmac(t *testing.T) {
5556

5657
mountOptions := []string{"opt1=val1", "opt2=val2", " ", "opt3"}
5758

58-
mounter := NewS3fsMounter(secretMap, mountOptions, mounterUtils.NewFakeMounterUtilsImpl(mounterUtils.FakeMounterUtilsFuncStruct{}))
59+
mounter := NewS3fsMounter(secretMap, mountOptions, mounterUtils.NewFakeMounterUtilsImpl(mounterUtils.FakeMounterUtilsFuncStruct{}), nil)
5960

6061
s3fsMounter, ok := mounter.(*S3fsMounter)
6162
assert.True(t, ok)

0 commit comments

Comments
 (0)