Skip to content

Commit

Permalink
fix(nas): set global query RegionId in v2 sdk client
Browse files Browse the repository at this point in the history
  • Loading branch information
tydra-wang committed Dec 6, 2023
1 parent d5b7b85 commit c753c10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion pkg/nas/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func NewControllerServer(d *csicommon.CSIDriver) (csi.ControllerServer, error) {
}

func validateCreateVolumeRequest(req *csi.CreateVolumeRequest) error {
log.Infof("Starting nfs validate create volume request %s, %v", req.Name, req)
valid, err := utils.CheckRequestArgs(req.GetParameters())
if !valid {
return status.Errorf(codes.InvalidArgument, err.Error())
Expand Down
10 changes: 8 additions & 2 deletions pkg/nas/internal/nas_client_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ import (
)

func newNasClientV2(region string) (*sdk.Client, error) {
config := new(openapi.Config)
config := new(openapi.Config).
SetRegionId(region).
SetGlobalParameters(&openapi.GlobalParameters{
Queries: map[string]*string{
"RegionId": &region,
},
})
// set credential
cred, err := utils.GetCredentialV2()
if err != nil {
return nil, fmt.Errorf("init credential: %w", err)
}
config = config.SetRegionId(region).SetCredential(cred)
config = config.SetCredential(cred)
// set endpoint
ep := os.Getenv("NAS_ENDPOINT")
if ep == "" {
Expand Down

0 comments on commit c753c10

Please sign in to comment.