Skip to content

Commit

Permalink
*: update ec2 poll timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
  • Loading branch information
gyuho committed May 24, 2020
1 parent 9352ba6 commit 9423d17
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion ec2/asgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,9 @@ func (ts *Tester) createASGs() (err error) {
zap.String("asg-name", asgName),
zap.Strings("instance-ids", instanceIDs),
)
waitDur := 3*time.Minute + time.Duration(10*cur.ASGDesiredCapacity)*time.Second
ec2Instances, err := aws_ec2.PollUntilRunning(
10*time.Minute,
waitDur,
ts.lg,
ts.ec2API,
instanceIDs...,
Expand Down
2 changes: 1 addition & 1 deletion eks/mng/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,6 @@ func (ts *tester) waitForNodes(mngName string) error {
if !ok {
return fmt.Errorf("Managed Node Group %q not found", mngName)
}
waitDur := 2*time.Minute + time.Duration(15*cur.ASGDesiredCapacity)*time.Second

ts.cfg.Logger.Info("checking MNG", zap.String("mng-name", cur.Name))
dout, err := ts.cfg.EKSAPI.DescribeNodegroup(&eks.DescribeNodegroupInput{
Expand Down Expand Up @@ -824,6 +823,7 @@ func (ts *tester) waitForNodes(mngName string) error {
zap.String("asg-name", cur.ASGName),
zap.Strings("instance-ids", instanceIDs),
)
waitDur := 3*time.Minute + time.Duration(10*cur.ASGDesiredCapacity)*time.Second
ec2Instances, err := aws_ec2.PollUntilRunning(
waitDur,
ts.cfg.Logger,
Expand Down
2 changes: 1 addition & 1 deletion eks/ng/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ func (ts *tester) waitForNodes(asgName string) error {
if !ok {
return fmt.Errorf("Node Group %q not found", asgName)
}
waitDur := 3*time.Minute + time.Duration(15*cur.ASGDesiredCapacity)*time.Second

aout, err := ts.cfg.ASGAPI.DescribeAutoScalingGroups(&autoscaling.DescribeAutoScalingGroupsInput{
AutoScalingGroupNames: aws.StringSlice([]string{cur.Name}),
Expand All @@ -727,6 +726,7 @@ func (ts *tester) waitForNodes(asgName string) error {
zap.Strings("instance-ids", instanceIDs),
zap.Duration("wait", waitDur),
)
waitDur := 3*time.Minute + time.Duration(10*cur.ASGDesiredCapacity)*time.Second
ec2Instances, err := aws_ec2.PollUntilRunning(
waitDur,
ts.cfg.Logger,
Expand Down
8 changes: 4 additions & 4 deletions pkg/aws/ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ func PollUntilRunning(
lg.Info("polling instance status", zap.Int("target-total", targetN))
retryStart := time.Now()
for time.Now().Sub(retryStart) < timeout {
// batch by 10
batch := make([]string, 0, 10)
// batch by 30
batch := make([]string, 0, 30)
for id := range left {
batch = append(batch, id)
if len(batch) >= 10 {
if len(batch) >= 30 {
break
}
}
Expand Down Expand Up @@ -71,7 +71,7 @@ func PollUntilRunning(
if len(left) == 0 {
break
}
time.Sleep(15 * time.Second)
time.Sleep(10 * time.Second)
}

return ec2Instances, err
Expand Down

0 comments on commit 9423d17

Please sign in to comment.