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 4a172d3 commit a9cd814
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/cloudprovider/aws/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ 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, since the constraints may be violated and
// node cannot connect to the API Server.
if len(subnets) == 0 {
return nil, fmt.Errorf("no subnets exist given constraints")
}
return subnets, nil
}

Expand Down

0 comments on commit a9cd814

Please sign in to comment.