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

AWSMachinePool subnet filters ignored if no matches found #3977

Closed
AverageMarcus opened this issue Jan 12, 2023 · 2 comments · Fixed by #3978
Closed

AWSMachinePool subnet filters ignored if no matches found #3977

AverageMarcus opened this issue Jan 12, 2023 · 2 comments · Fixed by #3978
Assignees
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.

Comments

@AverageMarcus
Copy link
Member

/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.

subnet:
  filters:
    - name: tag:subnet-role
      values: ["non-existent"]

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 the AWSMachinePool CR. This will then fall back to fetching any subnet that matches the provided availability zone (or the subnets of the AWSCluster 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.]

  • More discussion can be found in this Slack thread
  • AWSMachine CRs respect the filter and will display an error if no matching subnet is found.
  • Proposed solution: have the SubnetIDs function of the autoscaling service return an error if inputFilters are provided but subnetIDs is empty at the end of the function.

Environment:

  • Cluster-api-provider-aws version: >= 1.5
  • Kubernetes version: (use kubectl version):
  • OS (e.g. from /etc/os-release):
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 12, 2023
@Skarlso
Copy link
Contributor

Skarlso commented Jan 12, 2023

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 12, 2023
@AverageMarcus
Copy link
Member Author

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
3 participants