@@ -133,13 +133,9 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
133133 secretMap = secretMapCustom
134134 }
135135
136- klog .Info ("SecretMap Parameters:\n \t " , maskSecretkeys (secretMap ))
137-
138136 endPoint = secretMap ["cosEndpoint" ]
139137 if endPoint == "" {
140138 endPoint = params ["cosEndpoint" ]
141- } else {
142- params ["cosEndpoint" ] = secretMap ["cosEndpoint" ]
143139 }
144140 if endPoint == "" {
145141 return nil , status .Error (codes .InvalidArgument , "cosEndpoint unknown" )
@@ -148,26 +144,28 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
148144 locationConstraint = secretMap ["locationConstraint" ]
149145 if locationConstraint == "" {
150146 locationConstraint = params ["locationConstraint" ]
151- } else {
152- params ["locationConstraint" ] = secretMap ["locationConstraint" ]
153147 }
154148 if locationConstraint == "" {
155149 return nil , status .Error (codes .InvalidArgument , "locationConstraint unknown" )
156150 }
157151
158152 kpRootKeyCrn = secretMap ["kpRootKeyCRN" ]
153+ if kpRootKeyCrn == "" {
154+ kpRootKeyCrn = secretMapCustom ["kpRootKeyCRN" ]
155+ }
159156 if kpRootKeyCrn != "" {
160157 klog .Infof ("key protect root key crn provided for bucket creation" )
161158 }
162159
163160 mounter := secretMap ["mounter" ]
164161 if mounter == "" {
165162 mounter = params ["mounter" ]
166- } else {
167- params ["mounter" ] = secretMap ["mounter" ]
168163 }
169164
170165 bucketName = secretMap ["bucketName" ]
166+ if bucketName == "" {
167+ bucketName = secretMapCustom ["bucketName" ]
168+ }
171169
172170 // Check for bucketVersioning parameter
173171 if val , ok := secretMap [constants .BucketVersioning ]; ok && val != "" {
@@ -191,7 +189,7 @@ func (cs *controllerServer) CreateVolume(_ context.Context, req *csi.CreateVolum
191189 if err != nil {
192190 return nil , status .Error (codes .InvalidArgument , fmt .Sprintf ("Error in getting credentials %v" , err ))
193191 }
194- klog . Infof ( "endPoint and locationConstraint getting paased to ObjectStorageSession: %s, %s" , endPoint , locationConstraint )
192+
195193 sess := cs .cosSession .NewObjectStorageSession (endPoint , locationConstraint , creds , cs .Logger )
196194
197195 params ["userProvidedBucket" ] = "true"
@@ -555,18 +553,6 @@ func parseCustomSecret(secret *v1.Secret) map[string]string {
555553 return secretMapCustom
556554}
557555
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-
570556func getTempBucketName (mounterType , volumeID string ) string {
571557 klog .Infof ("mounterType: %v" , mounterType )
572558 currentTime := time .Now ()
0 commit comments