Skip to content

Commit c600c5c

Browse files
authored
fix(k8s): make WaitForPool coherent with others (#333)
Signed-off-by: Patrik Cyvoct <[email protected]>
1 parent 5988b6a commit c600c5c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

api/k8s/v1beta4/k8s_helpers.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ func (s *API) WaitForCluster(req *WaitForClusterRequest) (*Cluster, error) {
5757
return cluster.(*Cluster), nil
5858
}
5959

60-
// WaitForClusterPoolsRequest is used by WaitForClusterPools method.
61-
type WaitForClusterPoolsRequest struct {
62-
ClusterID string
63-
Region scw.Region
64-
Timeout *time.Duration
65-
}
66-
6760
// WaitForPoolRequest is used by WaitForPool method.
6861
type WaitForPoolRequest struct {
6962
PoolID string
@@ -72,7 +65,7 @@ type WaitForPoolRequest struct {
7265
}
7366

7467
// WaitForPool waits for a pool to be ready
75-
func (s *API) WaitForPool(req *WaitForPoolRequest) error {
68+
func (s *API) WaitForPool(req *WaitForPoolRequest) (*Pool, error) {
7669
terminalStatus := map[PoolStatus]struct{}{
7770
PoolStatusReady: {},
7871
PoolStatusWarning: {},
@@ -83,7 +76,7 @@ func (s *API) WaitForPool(req *WaitForPoolRequest) error {
8376
timeout = *req.Timeout
8477
}
8578

86-
_, err := async.WaitSync(&async.WaitSyncConfig{
79+
pool, err := async.WaitSync(&async.WaitSyncConfig{
8780
Get: func() (interface{}, bool, error) {
8881
res, err := s.GetPool(&GetPoolRequest{
8982
PoolID: req.PoolID,
@@ -95,11 +88,11 @@ func (s *API) WaitForPool(req *WaitForPoolRequest) error {
9588
}
9689
_, isTerminal := terminalStatus[res.Status]
9790

98-
return nil, isTerminal, nil
91+
return res, isTerminal, nil
9992
},
10093
Timeout: timeout,
10194
IntervalStrategy: async.LinearIntervalStrategy(5 * time.Second),
10295
})
10396

104-
return err
97+
return pool.(*Pool), err
10598
}

0 commit comments

Comments
 (0)