2
2
* IBM Confidential
3
3
* OCO Source Materials
4
4
* IBM Cloud Kubernetes Service, 5737-D43
5
- * (C) Copyright IBM Corp. 2023 All Rights Reserved.
5
+ * (C) Copyright IBM Corp. 2023, 2025 All Rights Reserved.
6
6
* The source code for this program is not published or otherwise divested of
7
7
* its trade secrets, irrespective of what has been deposited with
8
8
* the U.S. Copyright Office.
@@ -51,7 +51,6 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
51
51
pvcNamespace string
52
52
bucketVersioning string
53
53
)
54
- secretMapCustom := make (map [string ]string )
55
54
56
55
modifiedRequest , err := utils .ReplaceAndReturnCopy (req )
57
56
if err != nil {
@@ -81,6 +80,9 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
81
80
}
82
81
83
82
params := req .GetParameters ()
83
+ if params == nil {
84
+ params = make (map [string ]string )
85
+ }
84
86
klog .Info ("CreateVolume Parameters:\n \t " , params )
85
87
86
88
secretMap := req .GetSecrets ()
@@ -127,7 +129,7 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
127
129
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("Secret resource not found %v" , err ))
128
130
}
129
131
130
- secretMapCustom = parseCustomSecret (secret )
132
+ secretMapCustom : = parseCustomSecret (secret )
131
133
klog .Info ("custom secret parameters parsed successfully, length of custom secret: " , len (secretMapCustom ))
132
134
133
135
secretMap = secretMapCustom
@@ -136,6 +138,8 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
136
138
endPoint = secretMap ["cosEndpoint" ]
137
139
if endPoint == "" {
138
140
endPoint = params ["cosEndpoint" ]
141
+ } else {
142
+ params ["cosEndpoint" ] = endPoint
139
143
}
140
144
if endPoint == "" {
141
145
return nil , status .Error (codes .InvalidArgument , "cosEndpoint unknown" )
@@ -144,28 +148,26 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
144
148
locationConstraint = secretMap ["locationConstraint" ]
145
149
if locationConstraint == "" {
146
150
locationConstraint = params ["locationConstraint" ]
151
+ } else {
152
+ params ["locationConstraint" ] = locationConstraint
147
153
}
148
154
if locationConstraint == "" {
149
155
return nil , status .Error (codes .InvalidArgument , "locationConstraint unknown" )
150
156
}
151
157
152
158
kpRootKeyCrn = secretMap ["kpRootKeyCRN" ]
153
- if kpRootKeyCrn == "" {
154
- kpRootKeyCrn = secretMapCustom ["kpRootKeyCRN" ]
155
- }
156
159
if kpRootKeyCrn != "" {
157
160
klog .Infof ("key protect root key crn provided for bucket creation" )
158
161
}
159
162
160
163
mounter := secretMap ["mounter" ]
161
164
if mounter == "" {
162
165
mounter = params ["mounter" ]
166
+ } else {
167
+ params ["mounter" ] = mounter
163
168
}
164
169
165
170
bucketName = secretMap ["bucketName" ]
166
- if bucketName == "" {
167
- bucketName = secretMapCustom ["bucketName" ]
168
- }
169
171
170
172
// Check for bucketVersioning parameter
171
173
if val , ok := secretMap [constants .BucketVersioning ]; ok && val != "" {
@@ -189,7 +191,7 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
189
191
if err != nil {
190
192
return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("Error in getting credentials %v" , err ))
191
193
}
192
-
194
+ klog . Infof ( "cosEndpoint and locationConstraint getting paased to ObjectStorageSession: %s, %s" , endPoint , locationConstraint )
193
195
sess := cs .cosSession .NewObjectStorageSession (endPoint , locationConstraint , creds , cs .Logger )
194
196
195
197
params ["userProvidedBucket" ] = "true"
@@ -270,7 +272,6 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
270
272
}
271
273
272
274
func (cs * controllerServer ) DeleteVolume (_ context.Context , req * csi.DeleteVolumeRequest ) (* csi.DeleteVolumeResponse , error ) {
273
- //secretMapCustom := make(map[string]string)
274
275
275
276
modifiedRequest , err := utils .ReplaceAndReturnCopy (req )
276
277
if err != nil {
0 commit comments