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

Add shared VPC networking #991

Closed
wants to merge 1 commit into from
Closed

Conversation

bighiro
Copy link

@bighiro bighiro commented Jul 27, 2023

What type of PR is this?
/kind feature

What this PR does / why we need it:

Support shared VPC networking.

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 #861 #982

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:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Support shared VPC networking.
Able to deploy the cluster with shared VPC network from another project that hosts the networks.

@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. labels Jul 27, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bighiro
Once this PR has been reviewed and has the lgtm label, please assign cecilerobertmichon for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 27, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @bighiro. 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 Jul 27, 2023
@richardcase
Copy link
Member

/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 Aug 15, 2023
@k8s-ci-robot
Copy link
Contributor

@bighiro: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-gcp-apidiff 53a8cb0 link false /test pull-cluster-api-provider-gcp-apidiff
pull-cluster-api-provider-gcp-verify 53a8cb0 link true /test pull-cluster-api-provider-gcp-verify
pull-cluster-api-provider-gcp-test 53a8cb0 link true /test pull-cluster-api-provider-gcp-test

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.

@richardcase
Copy link
Member

Thanks for this @bighiro 🙇

There are a number of jobs failed. Could you do the following:

  • make generate
  • make lint
  • make test

This will highlight some issues that will need to be fixed. Additionally you will need to update the conversions manually as the new field HostProject is failing in the roundtrip fuzzing tests. You will need to add something similar to this:

for _, restoredSubnet := range restored.Spec.Network.Subnets {
for the new field so it can be restored.

Reach out here or in our slack channel if you need any help.

@akshay196
Copy link
Contributor

Adding comment as I happened to worked on GKE with shared VPC recently.

This PR will affect the GKE implementation too as NetworkSpec is common for un-managed and managed GCP clusters. One thing I have seen is that it becomes mandatory to provide secondary Pod and Service ranges for GKE (both auto-pilot and standard) if the cluster is using shared VPC. [1]

So we need to verify this PR with GKE too if that is also in focus of this PR.

[1] https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-shared-vpc#verify_usable_subnets

@richardcase
Copy link
Member

@bighiro - just folllowing up on if you'd be able to review the comments?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 24, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 23, 2024
@@ -93,6 +93,9 @@ type NetworkSpec struct {
// +optional
Name *string `json:"name,omitempty"`

// HostProject is the name of the host project hosting the shared VPC network

Choose a reason for hiding this comment

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

Suggested change
// HostProject is the name of the host project hosting the shared VPC network
// HostProject is the name of the host project hosting the shared VPC network resources.
// +optional

@@ -94,6 +94,11 @@ func (m *MachineScope) Cloud() cloud.Cloud {
return m.ClusterGetter.Cloud()
}

// NetworkCloud returns initialized network cloud

Choose a reason for hiding this comment

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

Suggested change
// NetworkCloud returns initialized network cloud
// NetworkCloud returns initialized network cloud.


// IsSharedVpc returns the cluster network unique identifier.
func (s *ManagedClusterScope) IsSharedVpc() bool {
if s.NetworkProject() != s.Project() {

Choose a reason for hiding this comment

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

nit:

Suggested change
if s.NetworkProject() != s.Project() {
return s.NetworkProject() != s.Project

@@ -41,6 +41,9 @@ func (s *Service) Reconcile(ctx context.Context) error {
// Delete deletes cluster subnetwork components.
func (s *Service) Delete(ctx context.Context) error {
logger := log.FromContext(ctx)
if s.scope.IsSharedVpc() {
return nil

Choose a reason for hiding this comment

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

Nit: Log/Alert that this is a shared VPC.

barbacbd added a commit to barbacbd/k8s-cluster-api-provider-gcp that referenced this pull request Mar 22, 2024
This is an update to the stale PR kubernetes-sigs#991

** Added support for Host Project for a shared VPC in the Network struct.
** Network Resources will now use the host project name if exists, otherwise the normal project.
** Update the cluster getter interface to include the NetworkProject and Indicator for a shared VPC.
** Update reconcilers for girewall rules, subnets and network.
** Update the services to use the host project for resources when a shared vpc is used.
barbacbd added a commit to barbacbd/k8s-cluster-api-provider-gcp that referenced this pull request Mar 22, 2024
This is an update to the stale PR kubernetes-sigs#991

** Added support for Host Project for a shared VPC in the Network struct.
** Network Resources will now use the host project name if exists, otherwise the normal project.
** Update the cluster getter interface to include the NetworkProject and Indicator for a shared VPC.
** Update reconcilers for girewall rules, subnets and network.
** Update the services to use the host project for resources when a shared vpc is used.
barbacbd added a commit to barbacbd/k8s-cluster-api-provider-gcp that referenced this pull request Mar 27, 2024
This is an update to the stale PR kubernetes-sigs#991

** Added support for Host Project for a shared VPC in the Network struct.
** Network Resources will now use the host project name if exists, otherwise the normal project.
** Update the cluster getter interface to include the NetworkProject and Indicator for a shared VPC.
** Update reconcilers for girewall rules, subnets and network.
** Update the services to use the host project for resources when a shared vpc is used.
barbacbd added a commit to barbacbd/k8s-cluster-api-provider-gcp that referenced this pull request Mar 29, 2024
This is an update to the stale PR kubernetes-sigs#991

** Added support for Host Project for a shared VPC in the Network struct.
** Network Resources will now use the host project name if exists, otherwise the normal project.
** Update the cluster getter interface to include the NetworkProject and Indicator for a shared VPC.
** Update reconcilers for girewall rules, subnets and network.
** Update the services to use the host project for resources when a shared vpc is used.
barbacbd added a commit to barbacbd/k8s-cluster-api-provider-gcp that referenced this pull request Apr 11, 2024
This is an update to the stale PR kubernetes-sigs#991

** Added support for Host Project for a shared VPC in the Network struct.
** Network Resources will now use the host project name if exists, otherwise the normal project.
** Update the cluster getter interface to include the NetworkProject and Indicator for a shared VPC.
** Update reconcilers for girewall rules, subnets and network.
** Update the services to use the host project for resources when a shared vpc is used.
barbacbd added a commit to barbacbd/k8s-cluster-api-provider-gcp that referenced this pull request Apr 12, 2024
This is an update to the stale PR kubernetes-sigs#991

** Added support for Host Project for a shared VPC in the Network struct.
** Network Resources will now use the host project name if exists, otherwise the normal project.
** Update the cluster getter interface to include the NetworkProject and Indicator for a shared VPC.
** Update reconcilers for girewall rules, subnets and network.
** Update the services to use the host project for resources when a shared vpc is used.
barbacbd added a commit to barbacbd/k8s-cluster-api-provider-gcp that referenced this pull request Apr 17, 2024
This is an update to the stale PR kubernetes-sigs#991

** Added support for Host Project for a shared VPC in the Network struct.
** Network Resources will now use the host project name if exists, otherwise the normal project.
** Update the cluster getter interface to include the NetworkProject and Indicator for a shared VPC.
** Update reconcilers for girewall rules, subnets and network.
** Update the services to use the host project for resources when a shared vpc is used.
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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
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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can i configured GCP Instance Network Settings more freely?
6 participants