-
Notifications
You must be signed in to change notification settings - Fork 432
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
Update subnet CIDRs when reconciling existing vnet #2339
Update subnet CIDRs when reconciling existing vnet #2339
Conversation
/hold for confirmation from @evanfreed that this fixes the issue |
0df22e9
to
5a0822d
Compare
@CecileRobertMichon I can confirm your fix seems to work! Example spec used
The machine provisioned in the pre-created CIDR range that we self manage without needing to define it in the spec 🎉 thanks for the help! /lgtm |
@evanfreed: changing LGTM is restricted to collaborators In response to this:
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. |
/retest |
5a0822d
to
eec4ba6
Compare
eec4ba6
to
fe06f87
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.
/lgtm
/assign @mboersma for final review and approval/merge |
/hold cancel |
fe06f87
to
29c9dc5
Compare
/retest |
/retest |
@CecileRobertMichon: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it: This fixes an edge case scenario where the user specifies an existing BYO vnet along with subnets without specifying CIDR ranges. CAPZ will fill out the details in the controller when doing a GET of the existing vnet/subnet. However, in the case that the controller returns in between those reconciling the vnet and the subnets, which it often does as we reconcile resources async, it will attempt to patch the object with the updated vnet CIDR but the wrong defaulted subnet CIDRs, which results in a validation error similar to:
"validation.azurecluster.infrastructure.cluster.x-k8s.io" denied the request: AzureCluster.infrastructure.cluster.x-k8s.io "efreed-workload1" is invalid: [spec.networkSpec.subnets[0].cidrBlocks: Invalid value: "10.0.0.0/16": subnet CIDR not in vnet address space: [10.22.128.0/22],
.This updates the reconciler code to update both vnet and subnet CIDR ranges together when an existing VNet with subnets matching the defined subnet names is found.
Thanks @evanfreed for reporting the issue.
slack thread: https://kubernetes.slack.com/archives/CEX9HENG7/p1653600096205839
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:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
TODOs:
Release note: