Skip to content

Commit

Permalink
Merge pull request vmware-tanzu#393 from zhengxiexie/timeout
Browse files Browse the repository at this point in the history
Support setting http timeout for nsx-t
  • Loading branch information
zhengxiexie authored Nov 17, 2023
2 parents 706a0dc + 1130bae commit c87fcdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type NsxConfig struct {
DefaultProject string `ini:"default_project"`
ExternalIPv4Blocks []string `ini:"external_ipv4_blocks"`
DefaultSubnetSize int `ini:"default_subnet_size"`
DefaultTimeout int `ini:"default_timeout"`
}

type K8sConfig struct {
Expand Down
7 changes: 6 additions & 1 deletion pkg/nsx/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ func GetClient(cf *config.NSXOperatorConfig) *Client {
// Set log level for vsphere-automation-sdk-go
logger := logrus.New()
vspherelog.SetLogger(logger)
c := NewConfig(strings.Join(cf.NsxApiManagers, ","), cf.NsxApiUser, cf.NsxApiPassword, cf.CaFile, 10, 3, 20, 20, true, true, true, ratelimiter.AIMD, cf.GetTokenProvider(), nil, cf.Thumbprint)
defaultHttpTimeout := 20
if cf.DefaultTimeout > 0 {
defaultHttpTimeout = cf.DefaultTimeout
}
c := NewConfig(strings.Join(cf.NsxApiManagers, ","), cf.NsxApiUser, cf.NsxApiPassword, cf.CaFile, 10, 3, defaultHttpTimeout, 20, true, true, true,
ratelimiter.AIMD, cf.GetTokenProvider(), nil, cf.Thumbprint)
cluster, _ := NewCluster(c)

queryClient := search.NewQueryClient(restConnector(cluster))
Expand Down

0 comments on commit c87fcdd

Please sign in to comment.