@@ -133,9 +133,13 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
133
133
secretMap = secretMapCustom
134
134
}
135
135
136
+ klog .Info ("SecretMap Parameters:\n \t " , maskSecretkeys (secretMap ))
137
+
136
138
endPoint = secretMap ["cosEndpoint" ]
137
139
if endPoint == "" {
138
140
endPoint = params ["cosEndpoint" ]
141
+ } else {
142
+ params ["cosEndpoint" ] = secretMap ["cosEndpoint" ]
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" ] = secretMap ["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" ] = secretMap ["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 ( "endPoint 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"
@@ -553,6 +555,18 @@ func parseCustomSecret(secret *v1.Secret) map[string]string {
553
555
return secretMapCustom
554
556
}
555
557
558
+ func maskSecretkeys (secretMap map [string ]string ) map [string ]string {
559
+ maskedSecretMap := make (map [string ]string )
560
+ for k , v := range secretMap {
561
+ if k == "accessKey" || k == "secretKey" || k == "apiKey" || k == "kpRootKeyCRN" {
562
+ maskedSecretMap [k ] = "xxxxxxx"
563
+ continue
564
+ }
565
+ maskedSecretMap [k ] = v
566
+ }
567
+ return maskedSecretMap
568
+ }
569
+
556
570
func getTempBucketName (mounterType , volumeID string ) string {
557
571
klog .Infof ("mounterType: %v" , mounterType )
558
572
currentTime := time .Now ()
0 commit comments