mirror of https://github.com/k3s-io/k3s
add timeout for Openstack cloud provider
parent
3eb5ba805c
commit
fe92a55425
|
@ -52,6 +52,7 @@ import (
|
||||||
const (
|
const (
|
||||||
ProviderName = "openstack"
|
ProviderName = "openstack"
|
||||||
AvailabilityZone = "availability_zone"
|
AvailabilityZone = "availability_zone"
|
||||||
|
defaultTimeOut = 60 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrNotFound = errors.New("Failed to find object")
|
var ErrNotFound = errors.New("Failed to find object")
|
||||||
|
@ -101,7 +102,8 @@ type RouterOpts struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetadataOpts struct {
|
type MetadataOpts struct {
|
||||||
SearchOrder string `gcfg:"search-order"`
|
SearchOrder string `gcfg:"search-order"`
|
||||||
|
RequestTimeout MyDuration `gcfg:"request-timeout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenStack is an implementation of cloud provider Interface for OpenStack.
|
// OpenStack is an implementation of cloud provider Interface for OpenStack.
|
||||||
|
@ -290,6 +292,12 @@ func newOpenStack(cfg Config) (*OpenStack, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emptyDuration := MyDuration{}
|
||||||
|
if cfg.Metadata.RequestTimeout == emptyDuration {
|
||||||
|
cfg.Metadata.RequestTimeout.Duration = time.Duration(defaultTimeOut)
|
||||||
|
}
|
||||||
|
provider.HTTPClient.Timeout = cfg.Metadata.RequestTimeout.Duration
|
||||||
|
|
||||||
os := OpenStack{
|
os := OpenStack{
|
||||||
provider: provider,
|
provider: provider,
|
||||||
region: cfg.Global.Region,
|
region: cfg.Global.Region,
|
||||||
|
|
Loading…
Reference in New Issue