-
Notifications
You must be signed in to change notification settings - Fork 84
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
Use multiple zones in case of multiple subnets #1793
Use multiple zones in case of multiple subnets #1793
Conversation
Hi @Shilpa-Gokul. 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 Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about handling this in webhooks, Having a default webhook which adds unique zone to subnets if it does not present.
Also I think we can error out if the user specifies more subnets than zone.
@dharaneeshvrd will there be any uses cases of user setting more subnets? like vpc region has 2 zones but user wants to create 4 subnets?
its possible, we can just round robin the zones once subnets created for all zones. |
ed9c04c
to
666b32f
Compare
666b32f
to
b56cac6
Compare
b56cac6
to
2d53312
Compare
0cdecca
to
8fac823
Compare
8fac823
to
292d3fa
Compare
42195bc
to
836bbc9
Compare
Tested the following scenarios Case 1: When user provides more subnets than the available vpczones and provides no zone information with each subnet (subnets are created in the available vpc zones in a round robin method)
Case 2: When user provides 2 subnets in the same zone to be created
Case 3: User provides 1 subnet and the zone to be created in
Case 4: When user provides already created subnet
Log- [manager] I0723 12:15:38.121366 1 powervs_cluster.go:1103] "VPC subnet ID is set, fetching details" controller="ibmpowervscluster" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="IBMPowerVSCluster" IBMPowerVSCluster="default/capi-test-cluster-sg" namespace="default" name="capi-test-cluster-sg" reconcileID="19a61637-59a3-4ea0-896f-6bb3a4616902" cluster="default/capi-test-cluster-sg" id="02w7-e123549e-4414-480c-b018-7017492889b3" Case 5: When user provides subnets with no zone information
@Karthik-K-N @Amulyam24 Please check this and let me know if I have to test anything else |
836bbc9
to
2f22b36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to this case?
vpcSubnets:
- name: subnet-1
zone: eu-es-2
- name: subnet-2
Again it will get a collision I guess, since we are not handling the combination of both user provided and not provided.
Please handle this as well and if you can add UT with different corner cases that would be good for ReconcileVPCSubnets
.
4b297fc
to
adcd9ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a UT for index rotating logic as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been one of the difficult feature to implement and it has gone through lots of iteration during implementation as well, Thanks @Shilpa-Gokul for take care of this. Appreciate your commitment and ownership on this feature.
/lgtm
/assign @dharaneeshvrd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just few nits.
Overall LGTM!
61414f2
to
4877746
Compare
4877746
to
02e1446
Compare
02e1446
to
b4bd92b
Compare
/test pull-cluster-api-provider-ibmcloud-coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Thanks @Shilpa-Gokul
/hold for @Amulyam24 review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/unhold
Thank you @Shilpa-Gokul!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Amulyam24, Prajyot-Parab, Shilpa-Gokul 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 |
Thanks @Shilpa-Gokul for fixing this, it was a tricky one to solve. |
@mkumatag @Karthik-K-N @Amulyam24 @Prajyot-Parab @dharaneeshvrd Thanks to you all for helping me understand the codebase, different usecases and scenarios |
What this PR does / why we need it:
Currently when there are multiple subnets specified, it uses the first available vpcZone for all subnets by default and as a result, there is a clash in the CIDR. Hence added logic to use the subsequent vpcZones for the subnets.
If there are multiple subnets provided than the available vpcZones, the zones are selected based on round robin method.
This PR contains change to use vpcSubnetIPAddressCount, where when two subnets are to be created in the same zone, the subnets are created with the next available address prefix based on the vpcSubnetIPAddressCount.
Taking one of the below examples for reference
The zone selection is done as below, considering index 0 -> Madrid 1, index 1 -> Madrid 2, index 2 -> Madrid 3
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 #1779
Special notes for your reviewer:
/area provider/ibmcloud
Release note: