Skip to content

Commit

Permalink
Check if subnets are empty before passing to the instance provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ellistarn committed Jun 24, 2021
1 parent 0f41b13 commit 7a095af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cloudprovider/aws/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func (s *SubnetProvider) Get(ctx context.Context, provisioner *v1alpha1.Provisio
if len(constraints.Zones) != 0 {
subnets = filterSubnets(subnets, withSubnetZone(predicates.WithinStrings(constraints.Zones)))
}
// 4. Fail if no subnets found
if len(subnets) == 0 {
return nil, fmt.Errorf("no subnets exist given constraints")
}
return subnets, nil
}

Expand Down

0 comments on commit 7a095af

Please sign in to comment.