AWSMachinePool subnet filters ignored if no matches found #3977
Labels
kind/bug
Categorizes issue or PR as related to a bug.
needs-priority
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
/kind bug
What steps did you take and what happened:
Create an
AWSMachinePool
CR with a subnet filter that doesn't match any existing subnet in the account.E.g.
When no subnets are found to match the provided filter the SubnetIDs function in the autoscaling service will use an empty array for
subnetIDs
(rather than populating it with the IDs of any subnets found to match the filter). This empty array is then passed on to the SubnetIDs function on the scope which mistakenly treats the empty array of subnets IDs as no desired subnets were provided on theAWSMachinePool
CR. This will then fall back to fetching any subnet that matches the provided availability zone (or the subnets of theAWSCluster
if no AZs provided).What did you expect to happen:
If no matching subnet is found to match the provided filters an error should be shown instead to avoid mistakenly placing instances into incorrect subnets.
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
AWSMachine
CRs respect the filter and will display an error if no matching subnet is found.SubnetIDs
function of the autoscaling service return an error ifinputFilters
are provided butsubnetIDs
is empty at the end of the function.Environment:
kubectl version
):/etc/os-release
):The text was updated successfully, but these errors were encountered: