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

🐛 Don't error if ASG is missing when deciding to refresh instances #4660

Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions pkg/cloud/services/autoscaling/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ func (s *Service) CanStartASGInstanceRefresh(scope *scope.MachinePoolScope) (boo
describeInput := &autoscaling.DescribeInstanceRefreshesInput{AutoScalingGroupName: aws.String(scope.Name())}
refreshes, err := s.ASGClient.DescribeInstanceRefreshesWithContext(context.TODO(), describeInput)
if err != nil {
if awserrors.IsNotFound(err) {
return false, nil
}
return false, err
}
hasUnfinishedRefresh := false
Expand Down
11 changes: 11 additions & 0 deletions pkg/cloud/services/autoscaling/autoscalinggroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,17 @@ func TestServiceCanStartASGInstanceRefresh(t *testing.T) {
name: "should return error if describe instance refresh failed",
wantErr: true,
canStart: false,
expect: func(m *mock_autoscalingiface.MockAutoScalingAPIMockRecorder) {
m.DescribeInstanceRefreshesWithContext(context.TODO(), gomock.Eq(&autoscaling.DescribeInstanceRefreshesInput{
AutoScalingGroupName: aws.String("machinePoolName"),
})).
Return(nil, awserrors.NewConflict("some error"))
},
},
{
name: "should NOT return error if describe instance failed due to 'not found'",
wantErr: false,
canStart: false,
expect: func(m *mock_autoscalingiface.MockAutoScalingAPIMockRecorder) {
m.DescribeInstanceRefreshesWithContext(context.TODO(), gomock.Eq(&autoscaling.DescribeInstanceRefreshesInput{
AutoScalingGroupName: aws.String("machinePoolName"),
Expand Down