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

support vpc configuration of multiple external network segments through label and crd #3264

Merged
merged 22 commits into from
Oct 18, 2023

Conversation

zhaocongqi
Copy link
Member

@zhaocongqi zhaocongqi commented Sep 27, 2023

What type of this PR

Examples of user facing changes:

  • Features

Which issue(s) this PR fixes:

Fixes #(issue-number)

WHAT

🤖 Generated by Copilot at 6ac6836

This pull request adds support for multiple external subnets for a VPC in the kubeovn API and controller. It modifies the VpcSpec and VpcStatus structs, the vpc.go and subnet.go files, and comments out the BFD and custom VPC static route features, which are incompatible with the new feature.

🤖 Generated by Copilot at 6ac6836

No more static routes, no more BFD
We unleash the power of multiple subnets
We reconcile the VPCs with a new spec
We handle the gateways with a new logic

HOW

🤖 Generated by Copilot at 6ac6836

  • Add support for multiple external subnets for a VPC (link, link, link, link, link, link, link, link, link, link, link)
  • Add a new field ExternalSubnets to the VpcSpec and VpcStatus structs in types.go to store the desired and actual external subnets for a VPC (link, link)
  • Import the sort package in vpc.go to sort the external subnets in the handleAddOrUpdateVpc function (link)
  • Modify the handleDelVpc function in vpc.go to loop over the external subnets in the VPC spec and call handleDelVpcExternalSubnets for each subnet (link)
  • Modify the handleAddOrUpdateVpc function in vpc.go to check the external subnets in the VPC spec and status, and call handleAddVpcExternalSubnets or handleDelVpcExternalSubnets for each subnet that is added or removed (link)
  • Rename the handleAddVpcExternal function in vpc.go to handleAddVpcExternalSubnets and add a parameter subnet to specify the external subnet to connect (link)
  • Change the references to the c.config.ExternalGatewaySwitch to the subnet parameter in the handleAddVpcExternalSubnets function in vpc.go, and replace the logic to get the gateway chassis from the config map to the node labels (link)
  • Change the call to c.acquireIPAddress and c.createOrUpdateCrdOvnEip in the handleAddVpcExternalSubnets function in vpc.go to use the subnet parameter instead of the c.config.ExternalGatewaySwitch (link)
  • Change the call to c.OVNNbClient.CreateLogicalPatchPort in the handleAddVpcExternalSubnets function in vpc.go to use the subnet parameter instead of the c.config.ExternalGatewaySwitch, and the lspName and lrpName variables to use the subnet parameter instead of the c.config.ExternalGatewaySwitch (link)
  • Append the external subnet to the vpc.Status.ExternalSubnets slice in the handleAddVpcExternalSubnets function in vpc.go if it is not already in the slice (link)
  • Rename the handleDelVpcExternal function in vpc.go to handleDelVpcExternalSubnets and add a parameter subnet to specify the external subnet to disconnect (link)
  • Change the references to the c.config.ExternalGatewaySwitch to the subnet parameter in the handleDelVpcExternalSubnets function in vpc.go, and the lspName and lrpName variables to use the subnet parameter instead of the c.config.ExternalGatewaySwitch (link)
  • Remove the external subnet from the vpc.Status.ExternalSubnets slice in the handleDelVpcExternalSubnets function in vpc.go if it is in the slice (link)
  • Comment out the call to reconcileCustomVpcStaticRoute in the reconcileSubnet function in subnet.go, which is used to reconcile the static routes for a custom VPC (link)
  • Comment out the code related to the BFD feature in the handleAddOrUpdateVpc function in vpc.go, which is not compatible with the multiple external subnets feature (link)

pkg/controller/subnet.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
@lelvisl
Copy link

lelvisl commented Oct 5, 2023

@zcq98 this is a really cool feature! i'm waiting for merging this pr =)

let me know if i can help you.

pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
pkg/controller/vpc.go Outdated Show resolved Hide resolved
Signed-off-by: zcq98 <[email protected]>
pkg/controller/vpc.go Outdated Show resolved Hide resolved
Signed-off-by: zcq98 <[email protected]>
@zbb88888 zbb88888 marked this pull request as ready for review October 11, 2023 05:40
@zbb88888
Copy link
Collaborator

hi @oilbeater , could you help review this ?

@zbb88888 zbb88888 requested a review from oilbeater October 12, 2023 06:31
pkg/apis/kubeovn/v1/types.go Outdated Show resolved Hide resolved
pkg/apis/kubeovn/v1/types.go Outdated Show resolved Hide resolved
@zbb88888 zbb88888 merged commit a94eade into kubeovn:master Oct 18, 2023
zbb88888 pushed a commit that referenced this pull request Oct 18, 2023
…gh label and crd (#3264)

* add externalSubnet field support for vpc

* custom vpc get chassis from node label

* custom vpc add external based on ExternalSubnets

* support externalsubnets update

* compatible with default external

* fix custom vpc default external localnet create

* update addExternalSubnets status

* crd for addExternalSubnets

* add additionalPrinterColumn extraExternalSubnets


---------

Signed-off-by: zcq98 <[email protected]>
@zhaocongqi zhaocongqi deleted the dev branch October 25, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants