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

Query AWS to find subnets with explicitely specified subnet IDs #2864

Merged

Conversation

codablock
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:
This basically unifies the code used to find subnets with filters and subnets
by ID. This is done by handling the ID case as a simple filter instead of
looking into the cluster network spec.

The reason is that explicitely specified subnets are not necessarely part
of the cluster network spec. For example, it might be desired to run a
EKS control plane inside 3 specific subnets (so they are part of the
network spec) while running workers in different subnets from the same
VPC.

A side effect of this change is that we don't have to check for the correct
failure domain and/or public/private subnets anymore as this is implicitely
handled by the criterias.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

Release note:

Allow to specify subnets by ID which are not part of the cluster's network spec

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 21, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @codablock. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 21, 2021
@codablock codablock force-pushed the fix-awsmachinespec-subnet-id branch from 6c536a6 to 3c73384 Compare October 21, 2021 16:41
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 21, 2021
@randomvariable
Copy link
Member

Thanks for this. I'm sure you're right, but I need have a think about it, as ever, with any of the networking code.

@randomvariable
Copy link
Member

Still not had time to review this. Will look on monday.

In the meantime,

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 22, 2021
@codablock codablock force-pushed the fix-awsmachinespec-subnet-id branch from 3c73384 to 177cf73 Compare October 23, 2021 08:53
@codablock
Copy link
Contributor Author

FYI, the note about not requiring to check for AZ/publicIPS that I made in the initial commit and in the PR description is not really true anymore. One commit later I decided to re-add comparable checks to the filter code so that error messages are more useful. Always being to told that a subnet does not exist when in reality it simply doesn't match the AZ/IP criteria ist very confusing.

@enxebre
Copy link
Member

enxebre commented Nov 24, 2021

This make sense to me.
Another example where this is natural is externally managed infrastructure. I see this decoupling as a good thing.

@codablock
Copy link
Contributor Author

@randomvariable Sorry to bother you, but did you find time to look into this? :)

@enxebre
Copy link
Member

enxebre commented Jan 10, 2022

cc @richardcase @sedefsavas for awareness, any objections to proceed with this?

@richardcase
Copy link
Member

cc @richardcase @sedefsavas for awareness, any objections to proceed with this?

Will take a look @enxebre

enxebre added a commit to enxebre/hypershift that referenced this pull request Feb 1, 2022
There's an bug in CAPI AWS provider which prevent Machines from targeting subnets ids which are not present on the infra CR.
This PR is a workaround by keeping the infra CR subnets in sync which what is required by NodePools.
This should b dropped once kubernetes-sigs/cluster-api-provider-aws#2864 gets merged.
enxebre added a commit to enxebre/hypershift that referenced this pull request Feb 1, 2022
There's an bug in CAPI AWS provider which prevent Machines from targeting subnets ids which are not present on the infra CR.
This PR is a workaround by keeping the infra CR subnets in sync with what is required by NodePools.
This should b dropped once kubernetes-sigs/cluster-api-provider-aws#2864 gets merged.
enxebre added a commit to enxebre/hypershift that referenced this pull request Feb 1, 2022
There's an bug in CAPI AWS provider which prevent Machines from targeting subnets ids which are not present on the infra CR.
This PR is a workaround by keeping the infra CR subnets in sync with what is required by NodePools.
This should be dropped once kubernetes-sigs/cluster-api-provider-aws#2864 gets merged.
mkumatag pushed a commit to mkumatag/hypershift that referenced this pull request Feb 4, 2022
There's an bug in CAPI AWS provider which prevent Machines from targeting subnets ids which are not present on the infra CR.
This PR is a workaround by keeping the infra CR subnets in sync with what is required by NodePools.
This should be dropped once kubernetes-sigs/cluster-api-provider-aws#2864 gets merged.
mkumatag pushed a commit to mkumatag/hypershift that referenced this pull request Feb 4, 2022
There's an bug in CAPI AWS provider which prevent Machines from targeting subnets ids which are not present on the infra CR.
This PR is a workaround by keeping the infra CR subnets in sync with what is required by NodePools.
This should be dropped once kubernetes-sigs/cluster-api-provider-aws#2864 gets merged.
This basically unifies the code used to find subnets with filters and subnets
by ID. This is done by handling the ID case as a simple filter instead of
looking into the cluster network spec.

The reason is that explicitely specified subnets are not necessarely part
of the cluster network spec. For example, it might be desired to run a
EKS control plane inside 3 specific subnets (so they are part of the
network spec) while running workers in different subnets from the same
VPC.

A side effect of this change is that we don't have to check for the correct
failure domain and/or public/private subnets anymore as this is implicitely
handled by the criterias.
@codablock codablock force-pushed the fix-awsmachinespec-subnet-id branch from f1950e6 to 582357a Compare March 9, 2022 07:57
@codablock
Copy link
Contributor Author

codablock commented Mar 9, 2022

@pydctw @sedefsavas Thanks for your reviews :)
I've rebased on main, fixed the last nit and squashed commits. Hopefully ready to merge now.

@pydctw
Copy link
Contributor

pydctw commented Mar 9, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 9, 2022
@sedefsavas
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sedefsavas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 9, 2022
@k8s-ci-robot k8s-ci-robot merged commit fb12a8b into kubernetes-sigs:main Mar 9, 2022
@k8s-ci-robot k8s-ci-robot modified the milestones: v1.4.0, v1.x Mar 9, 2022
@codablock codablock deleted the fix-awsmachinespec-subnet-id branch March 9, 2022 21:20
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Dec 22, 2022
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Dec 22, 2022
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Dec 22, 2022
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 4, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 4, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 4, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 5, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 5, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 5, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 10, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 10, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 10, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 11, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 17, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 17, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
bryan-cox added a commit to bryan-cox/hypershift that referenced this pull request Jan 17, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
muraee pushed a commit to muraee/hypershift that referenced this pull request Feb 6, 2023
Removed two TODOs waiting on an upstream CAPA PR to be merged and included: kubernetes-sigs/cluster-api-provider-aws#2864.

Signed-off-by: Bryan Cox <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants