Skip to content

Commit bc702f1

Browse files
authored
fix(k8s): no more crashes on waiting helpers (#1472)
1 parent e0f8387 commit bc702f1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

api/k8s/v1/k8s_helpers.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ type WaitForClusterRequest struct {
2626

2727
// WaitForCluster waits for the cluster to be in a "terminal state" before returning.
2828
func (s *API) WaitForCluster(req *WaitForClusterRequest, opts ...scw.RequestOption) (*Cluster, error) {
29-
timeout := *req.Timeout
30-
if timeout == 0 {
31-
timeout = waitForClusterDefaultTimeout
29+
timeout := waitForClusterDefaultTimeout
30+
if req.Timeout != nil {
31+
timeout = *req.Timeout
3232
}
3333
retryInterval := defaultRetryInterval
3434
if req.RetryInterval != nil {
@@ -75,9 +75,9 @@ type WaitForPoolRequest struct {
7575

7676
// WaitForPool waits for a pool to be ready
7777
func (s *API) WaitForPool(req *WaitForPoolRequest, opts ...scw.RequestOption) (*Pool, error) {
78-
timeout := *req.Timeout
79-
if timeout == 0 {
80-
timeout = waitForPoolDefaultTimeout
78+
timeout := waitForPoolDefaultTimeout
79+
if req.Timeout != nil {
80+
timeout = *req.Timeout
8181
}
8282
retryInterval := defaultRetryInterval
8383
if req.RetryInterval != nil {
@@ -170,11 +170,11 @@ type WaitForClusterPoolRequest struct {
170170
RetryInterval *time.Duration
171171
}
172172

173-
// WaitForClusterPool waits for the pool be associated with a cluster as a "terminal state" before returning.
173+
// WaitForClusterPool waits for the pool associated with a cluster to be in a "terminal state" before returning.
174174
func (s *API) WaitForClusterPool(req *WaitForClusterRequest, opts ...scw.RequestOption) (*Cluster, error) {
175-
timeout := *req.Timeout
176-
if timeout == 0 {
177-
timeout = waitForClusterDefaultTimeout
175+
timeout := waitForClusterDefaultTimeout
176+
if req.Timeout != nil {
177+
timeout = *req.Timeout
178178
}
179179
retryInterval := defaultRetryInterval
180180
if req.RetryInterval != nil {

0 commit comments

Comments
 (0)