Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(k8s): add global retry interval for wait func #354

Merged
merged 2 commits into from
Mar 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions api/k8s/v1beta4/k8s_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ import (
"github.com/scaleway/scaleway-sdk-go/scw"
)

var (
// RetryInterval is needed when running recorded tests (e.g. on scaleway-cli)
// it allows to execute the WaitFor funcs immediately
RetryInterval = defaultRetryInterval
)

const (
waitForClusterDefaultTimeout = time.Minute * 15
waitForPoolDefaultTimeout = time.Minute * 15
defaultRetryInterval = time.Second * 5
)

// WaitForClusterRequest is used by WaitForCluster method.
Expand Down Expand Up @@ -49,7 +56,7 @@ func (s *API) WaitForCluster(req *WaitForClusterRequest) (*Cluster, error) {
return cluster, isTerminal, nil
},
Timeout: timeout,
IntervalStrategy: async.LinearIntervalStrategy(5 * time.Second),
IntervalStrategy: async.LinearIntervalStrategy(RetryInterval),
})
if err != nil {
return nil, errors.Wrap(err, "waiting for cluster failed")
Expand Down Expand Up @@ -91,7 +98,7 @@ func (s *API) WaitForPool(req *WaitForPoolRequest) (*Pool, error) {
return res, isTerminal, nil
},
Timeout: timeout,
IntervalStrategy: async.LinearIntervalStrategy(5 * time.Second),
IntervalStrategy: async.LinearIntervalStrategy(RetryInterval),
})

return pool.(*Pool), err
Expand Down