Skip to content

Commit d9b9633

Browse files
committed
set cipher suites from secrets in mount options
Signed-off-by: Ashima-Ashima1 <[email protected]>
1 parent 5a920f9 commit d9b9633

File tree

7 files changed

+35
-31
lines changed

7 files changed

+35
-31
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-09-01T06:07:00Z",
6+
"generated_at": "2025-09-02T07:03:59Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -199,7 +199,7 @@
199199
{
200200
"hashed_secret": "2e7a7ee14caebf378fc32d6cf6f557f347c96773",
201201
"is_verified": false,
202-
"line_number": 78,
202+
"line_number": 79,
203203
"type": "Secret Keyword",
204204
"verified_result": null
205205
}
@@ -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
}

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+
CipherSuitesMO = "cipher_suites"
5153
)
5254

5355
var (

pkg/driver/nodeserver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ func (ns *nodeServer) NodePublishVolume(_ context.Context, req *csi.NodePublishV
146146
secretMap["iamEndpoint"] = ns.iamEndpoint
147147
}
148148

149-
if len(secretMap["cipher_suites"]) == 0 {
150-
secretMap["cipher_suites"] = ns.CipherSuites
149+
if len(secretMap[constants.CipherSuitesMO]) == 0 {
150+
secretMap[constants.CipherSuitesMO] = ns.CipherSuites
151151
}
152152

153153
// If bucket name wasn't provided by user, we use temp bucket created for volume.

pkg/mounter/mounter-rclone.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ func updateMountOptions(dafaultMountOptions []string, secretMap map[string]strin
137137
}
138138
}
139139

140-
val, check := secretMap["cipher_suites"]
140+
val, check := secretMap[constants.CipherSuitesMO]
141141
if check {
142-
mountOptsMap["cipher_suites"] = val
142+
mountOptsMap[constants.CipherSuitesMO] = val
143143
}
144144

145145
stringData, ok := secretMap["mountOptions"]

pkg/mounter/mounter-rclone_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@ 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
)
1112

1213
var (
1314
secretMapRClone = map[string]string{
14-
"cosEndpoint": "test-endpoint",
15-
"locationConstraint": "test-loc-constraint",
16-
"bucketName": "test-bucket-name",
17-
"objPath": "test-obj-path",
18-
"accessKey": "test-access-key",
19-
"secretKey": "test-secret-key",
20-
"apiKey": "test-api-key",
21-
"kpRootKeyCRN": "test-kp-root-key-crn",
22-
"gid": "fake-gid",
23-
"uid": "fake-uid",
24-
"cipher_suites": "default",
15+
"cosEndpoint": "test-endpoint",
16+
"locationConstraint": "test-loc-constraint",
17+
"bucketName": "test-bucket-name",
18+
"objPath": "test-obj-path",
19+
"accessKey": "test-access-key",
20+
"secretKey": "test-secret-key",
21+
"apiKey": "test-api-key",
22+
"kpRootKeyCRN": "test-kp-root-key-crn",
23+
"gid": "fake-gid",
24+
"uid": "fake-uid",
25+
constants.CipherSuitesMO: "default",
2526
}
2627

2728
mountOptionsRClone = []string{"opt1=val1", "opt2=val2"}

pkg/mounter/mounter-s3fs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ func updateS3FSMountOptions(defaultMountOp []string, secretMap map[string]string
242242
mountOptsMap["uid"] = secretMap["uid"]
243243
}
244244

245-
val, check := secretMap["cipher_suites"]
245+
val, check := secretMap[constants.CipherSuitesMO]
246246
if check {
247-
mountOptsMap["cipher_suites"] = val
247+
mountOptsMap[constants.CipherSuitesMO] = val
248248
}
249249

250250
stringData, ok := secretMap["mountOptions"]
@@ -279,7 +279,7 @@ func updateS3FSMountOptions(defaultMountOp []string, secretMap map[string]string
279279
option = val
280280
}
281281

282-
if newVal, check := secretMap[key]; check {
282+
if newVal, check := secretMap[key]; check && key != constants.CipherSuitesMO {
283283
if isKeyValuePair {
284284
option = fmt.Sprintf("%s=%s", key, newVal)
285285
} else {

pkg/mounter/mounter-s3fs_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ 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
)
1112

1213
var (
1314
secretMap = map[string]string{
14-
"cosEndpoint": "test-endpoint",
15-
"locationConstraint": "test-loc-constraint",
16-
"bucketName": "test-bucket-name",
17-
"objPath": "test-obj-path",
18-
"accessKey": "test-access-key",
19-
"secretKey": "test-secret-key",
20-
"apiKey": "test-api-key",
21-
"kpRootKeyCRN": "test-kp-root-key-crn",
22-
"uid": "test-uid",
23-
"cipher_suites": "default",
15+
"cosEndpoint": "test-endpoint",
16+
"locationConstraint": "test-loc-constraint",
17+
"bucketName": "test-bucket-name",
18+
"objPath": "test-obj-path",
19+
"accessKey": "test-access-key",
20+
"secretKey": "test-secret-key",
21+
"apiKey": "test-api-key",
22+
"kpRootKeyCRN": "test-kp-root-key-crn",
23+
"uid": "test-uid",
24+
constants.CipherSuitesMO: "default",
2425
}
2526

2627
mountOptions = []string{"opt1=val1", "opt2=val2", "opt3"}

0 commit comments

Comments
 (0)