@@ -20,6 +20,7 @@ package enhancer
20
20
import (
21
21
"encoding/base64"
22
22
"fmt"
23
+
23
24
csiv1 "tkestack.io/csi-operator/pkg/apis/storage/v1"
24
25
"tkestack.io/csi-operator/pkg/config"
25
26
"tkestack.io/csi-operator/pkg/types"
@@ -331,26 +332,26 @@ func (e *tencentCloudEnhancer) getTencentInfo(csiDeploy *csiv1.CSI) (*tencentClo
331
332
secretKey = e .config .SecretKey
332
333
}
333
334
334
- vpcID := csiDeploy .Spec .Parameters [vpcID ]
335
- if len (vpcID ) == 0 {
336
- vpcID = e .config .VpcID
335
+ if len (secretID ) == 0 || len (secretKey ) == 0 {
336
+ return nil , fmt .Errorf ("no tencent info of secretID, secretKey in csiDeploy.Spec.Parameters: %v" , csiDeploy .Spec .Parameters )
337
337
}
338
338
339
+ vpcID := csiDeploy .Spec .Parameters [vpcID ]
340
+
339
341
subnetID := csiDeploy .Spec .Parameters [subnetID ]
340
- if len (subnetID ) == 0 {
341
- subnetID = e .config .SubnetID
342
- }
343
342
344
- if len (secretID ) > 0 && len (secretKey ) > 0 && len (subnetID ) > 0 && len (vpcID ) > 0 {
345
- return & tencentCloudInfo {
346
- SecretID : secretID ,
347
- SecretKey : secretKey ,
348
- VpcID : vpcID ,
349
- SubnetID : subnetID ,
350
- }, nil
343
+ if csiDeploy .Spec .DriverName == csiv1 .CSIDriverTencentCFS {
344
+ if len (vpcID ) == 0 || len (subnetID ) == 0 {
345
+ return nil , fmt .Errorf ("no tencent info of vpcID, subnetID in csiDeploy.Spec.Parameters: %v" , csiDeploy .Spec .Parameters )
346
+ }
351
347
}
352
348
353
- return nil , fmt .Errorf ("no tencent info of secretID, secretKey, vpcID or subnetID found in csiDeploy.Spec.Parameters: %v" , csiDeploy .Spec .Parameters )
349
+ return & tencentCloudInfo {
350
+ SecretID : secretID ,
351
+ SecretKey : secretKey ,
352
+ VpcID : vpcID ,
353
+ SubnetID : subnetID ,
354
+ }, nil
354
355
}
355
356
356
357
// generateCBSSecretAndSCs generates secrets and StorageClasses needed by TencentCloud CBS storage.
0 commit comments