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

use existing virtualNetwork from a different rg #4606

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

nawazkh
Copy link
Member

@nawazkh nawazkh commented Feb 27, 2024

What type of PR is this?
/kind feature

What this PR does / why we need it:
This PR will enable using existing virtualNetwork from a different rg.
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 #4595

Special notes for your reviewer:

  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

use existing virtualNetwork from a different rg 

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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. labels Feb 27, 2024
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 27, 2024
@nawazkh nawazkh marked this pull request as ready for review February 28, 2024 22:42
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 28, 2024
@nawazkh
Copy link
Member Author

nawazkh commented Feb 28, 2024

/cc @kubernetes-sigs/cluster-api-provider-azure-pms

@k8s-ci-robot k8s-ci-robot requested a review from a team February 28, 2024 22:43
@nawazkh
Copy link
Member Author

nawazkh commented Feb 28, 2024

/retest

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.71%. Comparing base (9724fc0) to head (7c5df96).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4606      +/-   ##
==========================================
+ Coverage   62.47%   62.71%   +0.23%     
==========================================
  Files         192      192              
  Lines       15453    15487      +34     
==========================================
+ Hits         9655     9713      +58     
+ Misses       5131     5107      -24     
  Partials      667      667              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

api/v1beta1/azuremanagedcontrolplane_webhook.go Outdated Show resolved Hide resolved
api/v1beta1/azuremanagedcontrolplane_webhook.go Outdated Show resolved Hide resolved
api/v1beta1/azuremanagedcontrolplane_webhook_test.go Outdated Show resolved Hide resolved
azure/scope/managedcontrolplane.go Outdated Show resolved Hide resolved
@nojnhuh nojnhuh added this to the v1.14 milestone Feb 29, 2024
@nawazkh nawazkh requested a review from nojnhuh February 29, 2024 21:12
@nawazkh nawazkh force-pushed the use_existing_vnet branch 2 times, most recently from 20c05ee to 6a3044e Compare March 1, 2024 00:06
@k8s-ci-robot k8s-ci-robot removed the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 1, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 4, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: aca2741938b9e39dac96f2050d2d01a40f1483f4

- check vnets for azure managed control plane templates
- add tests to GroupSpecs
- update webhooks and add webhook tests
- add AzureName to aso groups
- use AzureName when rgs are different
- normalize Azure name to K8s name
- propogate changes to ClusterScope
@nawazkh nawazkh force-pushed the use_existing_vnet branch from 285e153 to 7c5df96 Compare March 4, 2024 20:15
@nawazkh nawazkh requested review from willie-yao and nojnhuh March 4, 2024 20:15
Copy link
Contributor

@willie-yao willie-yao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@nojnhuh
Copy link
Contributor

nojnhuh commented Mar 4, 2024

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nojnhuh

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 4, 2024
@k8s-ci-robot k8s-ci-robot merged commit 2251753 into kubernetes-sigs:main Mar 4, 2024
18 of 19 checks passed
@nawazkh nawazkh deleted the use_existing_vnet branch March 4, 2024 22:30
@jackfrancis
Copy link
Contributor

@willie-yao @nojnhuh could you investigate if the approach here could potentially solve for #4704

@jackfrancis
Copy link
Contributor

... and maybe #4699

@willie-yao
Copy link
Contributor

... and maybe #4699

@jackfrancis I don't think this approach will work because the error message is coming from k8s itself regarding the metadata.name field, so I'm not sure if this is even possible.

https://github.com/kubernetes/kubernetes/blob/9791f0d1f39f3f1e0796add7833c1059325d5098/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L205

@jackfrancis
Copy link
Contributor

@nojnhuh @willie-yao @mboersma can we get a consensus vote on whether or not to classify this as a bug? Was the BYO VNET story always meant (and documented) to support a VNET from a different resource group than the cluster resource group? If so, I think this is a bug fix and can be backported.

Thoughts?

@willie-yao
Copy link
Contributor

I'd say it counts as a bug since it fixes something that used to work before a certain version and I'm in favor of the backport.

@nojnhuh
Copy link
Contributor

nojnhuh commented Apr 15, 2024

I think this is fair to backport.

@mboersma
Copy link
Contributor

Yes, this seems worthy of backporting.

/cherrypick release-1.14
/cherrypick release-1.13

@k8s-infra-cherrypick-robot

@mboersma: #4606 failed to apply on top of branch "release-1.14":

Applying: check vnets for azure managed control plane and
Using index info to reconstruct a base tree...
M	api/v1beta1/azuremanagedcontrolplane_webhook.go
M	api/v1beta1/azuremanagedcontrolplane_webhook_test.go
M	api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go
M	azure/defaults.go
M	azure/defaults_test.go
M	azure/scope/cluster.go
M	azure/scope/cluster_test.go
M	azure/scope/managedcontrolplane.go
M	azure/scope/managedcontrolplane_test.go
M	azure/services/groups/spec.go
M	azure/services/groups/spec_test.go
Falling back to patching base and 3-way merge...
Auto-merging azure/scope/managedcontrolplane_test.go
CONFLICT (content): Merge conflict in azure/scope/managedcontrolplane_test.go
Auto-merging azure/scope/managedcontrolplane.go
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 check vnets for azure managed control plane and
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

Yes, this seems worthy of backporting.

/cherrypick release-1.14
/cherrypick release-1.13

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.

@willie-yao
Copy link
Contributor

@mboersma I can help manually backport this!

@willie-yao
Copy link
Contributor

/cherrypick release-1.13

@willie-yao
Copy link
Contributor

Oh wait I got confused. This commit is already in release-1.14 😆

@k8s-infra-cherrypick-robot

@willie-yao: #4606 failed to apply on top of branch "release-1.13":

Applying: check vnets for azure managed control plane and
Using index info to reconstruct a base tree...
M	api/v1beta1/azuremanagedcontrolplane_webhook.go
M	api/v1beta1/azuremanagedcontrolplane_webhook_test.go
M	api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go
M	azure/scope/cluster.go
M	azure/scope/cluster_test.go
M	azure/scope/managedcontrolplane.go
M	azure/scope/managedcontrolplane_test.go
M	azure/services/groups/spec.go
M	azure/services/groups/spec_test.go
Falling back to patching base and 3-way merge...
Auto-merging azure/services/groups/spec_test.go
Auto-merging azure/services/groups/spec.go
CONFLICT (content): Merge conflict in azure/services/groups/spec.go
Auto-merging azure/scope/managedcontrolplane_test.go
CONFLICT (content): Merge conflict in azure/scope/managedcontrolplane_test.go
Auto-merging azure/scope/managedcontrolplane.go
CONFLICT (content): Merge conflict in azure/scope/managedcontrolplane.go
Auto-merging azure/scope/cluster_test.go
Auto-merging azure/scope/cluster.go
CONFLICT (content): Merge conflict in azure/scope/cluster.go
Auto-merging api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go
CONFLICT (content): Merge conflict in api/v1beta1/azuremanagedcontrolplanetemplate_webhook.go
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook_test.go
CONFLICT (content): Merge conflict in api/v1beta1/azuremanagedcontrolplane_webhook_test.go
Auto-merging api/v1beta1/azuremanagedcontrolplane_webhook.go
CONFLICT (content): Merge conflict in api/v1beta1/azuremanagedcontrolplane_webhook.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 check vnets for azure managed control plane and
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.13

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.

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/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

CAPZ 1.13.1 fails to use existing virtualNetwork from a different rg
7 participants