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

manage routes for instances in multiple vpcs in a single region #241

Merged
merged 6 commits into from
Nov 14, 2024

Conversation

rahulait
Copy link
Collaborator

@rahulait rahulait commented Nov 5, 2024

General:

  • Have you removed all sensitive information, including but not limited to access keys and passwords?
  • Have you checked to ensure there aren't other open or closed Pull Requests for the same bug/feature/question?

This PR enables route-controller to manage instances running in multiple vpcs. All these instances should still be part of a single k8s cluster where the CCM is running.
This change introduces a new flag vpc-names which is a comma separated list of vpc names which will be managed by the CCM's route-controller. Old flag vpc-name is now deprecated and will be removed in future releases.

To test changes:

Changes in this branch are present in helm chart here: https://github.com/rahulait/linode-cloud-controller-manager/releases/tag/helm-v0.4.16

If one wants to test these changes, simply use helm repo https://rahulait.github.io/linode-cloud-controller-manager/ with version v0.4.16 to test the changes before we merge this branch to main.

Pull Request Guidelines:

  1. Does your submission pass tests?
  2. Have you added tests?
  3. Are you addressing a single feature in this PR?
  4. Are your commits atomic, addressing one change per commit?
  5. Are you following the conventions of the language?
  6. Have you saved your large formatting changes for a different PR, so we can focus on your work?
  7. Have you explained your rationale for why this feature is needed?
  8. Have you linked your PR to an open issue

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 73.00000% with 27 lines in your changes missing coverage. Please review.

Project coverage is 56.06%. Comparing base (dc407dd) to head (5194406).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cloud/linode/vpc.go 60.60% 11 Missing and 2 partials ⚠️
cloud/linode/route_controller.go 86.79% 5 Missing and 2 partials ⚠️
cloud/linode/cloud.go 0.00% 4 Missing and 1 partial ⚠️
cloud/linode/instances.go 77.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #241      +/-   ##
==========================================
+ Coverage   55.33%   56.06%   +0.73%     
==========================================
  Files          12       12              
  Lines        2324     2349      +25     
==========================================
+ Hits         1286     1317      +31     
+ Misses        887      881       -6     
  Partials      151      151              

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

@rahulait rahulait force-pushed the route-controller-multiple-vpcs branch 2 times, most recently from 76e0fc9 to c04ffe9 Compare November 5, 2024 19:59
cloud/linode/cloud.go Outdated Show resolved Hide resolved
@rahulait rahulait force-pushed the route-controller-multiple-vpcs branch from 3e62890 to 913f2b6 Compare November 12, 2024 06:09
@rahulait rahulait force-pushed the route-controller-multiple-vpcs branch from 0637f31 to f5c45fc Compare November 13, 2024 07:29
@rahulait rahulait added the enhancement issues that request a enhancement. label Nov 13, 2024
@rahulait rahulait force-pushed the route-controller-multiple-vpcs branch from f5c45fc to f95b9bd Compare November 13, 2024 18:17
Mu.Lock()
defer Mu.Unlock()

// check if map contains vpc id for given label
if vpcid, ok := vpcIDs[vpcName]; ok {
return vpcid, nil
}
vpcs, err := client.ListVPCs(context.TODO(), &linodego.ListOptions{})
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch 👍

cloud/linode/vpc.go Outdated Show resolved Hide resolved
Copy link
Contributor

@AshleyDumaine AshleyDumaine left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@rahulait rahulait merged commit e3c2045 into main Nov 14, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement issues that request a enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants