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

feat: add support for single controller, multi gateway deployments #3268

Merged
merged 1 commit into from
Jan 18, 2023

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Dec 16, 2022

What this PR does / why we need it:

This PR implements multi Gateways support via single KIC instance.

The configuration is being done the same way as it has been before i.e. through the --kong-admin-url flag and corresponding environment variable CONTROLLER_KONG_ADMIN_URL but when more than 1 address is provided then , (comma) is to be used as a separator.

Which issue this PR fixes:

Related #702

Special notes for your reviewer:

There are a handful of simplifications like e.g. not sending telemetry reports for each kong instance since the telemetry report schema only allows for one db setting and one kong version to be set.

There are corresponding notes and linked issues in the source comments.

No test for this yet. I might create it as part of this one (will make it even bigger :/) or as a separate PR. Up to reviewers.

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@pmalek pmalek self-assigned this Dec 16, 2022
@pmalek pmalek force-pushed the single-controller-deployments branch 5 times, most recently from 9625713 to ec47f2c Compare December 16, 2022 16:54
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Base: 73.9% // Head: 74.0% // Increases project coverage by +0.1% 🎉

Coverage data is based on head (447ecc4) compared to base (a5d9e78).
Patch coverage: 70.3% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3268     +/-   ##
=======================================
+ Coverage   73.9%   74.0%   +0.1%     
=======================================
  Files        111     113      +2     
  Lines      13688   13896    +208     
=======================================
+ Hits       10116   10287    +171     
- Misses      2933    2963     +30     
- Partials     639     646      +7     
Impacted Files Coverage Δ
internal/manager/utils/reports.go 0.0% <0.0%> (ø)
internal/util/plugin_schema_helper.go 66.6% <ø> (ø)
internal/manager/utils/kongconfig/root.go 49.5% <49.5%> (ø)
internal/controllers/gateway/gateway_controller.go 67.9% <50.0%> (+1.1%) ⬆️
internal/dataplane/sendconfig/sendconfig.go 78.8% <76.0%> (+0.6%) ⬆️
internal/dataplane/sendconfig/kong.go 76.3% <76.3%> (ø)
internal/manager/run.go 53.8% <76.4%> (+6.2%) ⬆️
internal/manager/config.go 90.2% <76.9%> (-1.7%) ⬇️
internal/dataplane/kong_client.go 87.1% <80.7%> (+1.0%) ⬆️
internal/dataplane/synchronizer.go 93.7% <100.0%> (+0.1%) ⬆️
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pmalek pmalek force-pushed the single-controller-deployments branch from ec47f2c to c0d5766 Compare January 4, 2023 14:41
@pmalek pmalek linked an issue Jan 11, 2023 that may be closed by this pull request
12 tasks
@pmalek pmalek mentioned this pull request Jan 11, 2023
12 tasks
@pmalek pmalek force-pushed the single-controller-deployments branch from d745fe5 to c5ffc77 Compare January 11, 2023 14:46
@pmalek pmalek force-pushed the single-controller-deployments branch 2 times, most recently from 1d05fb8 to ccbfbc2 Compare January 11, 2023 18:38
@pmalek pmalek added the area/feature New feature or request label Jan 11, 2023
@pmalek pmalek added this to the KIC v2.9.0 milestone Jan 11, 2023
@pmalek pmalek force-pushed the single-controller-deployments branch from ccbfbc2 to 7e7e120 Compare January 11, 2023 20:49
@pmalek pmalek changed the title Single controller deployments feat: add support for single controller, multi gateway deployments Jan 11, 2023
@pmalek pmalek marked this pull request as ready for review January 11, 2023 20:50
@pmalek pmalek requested a review from a team as a code owner January 11, 2023 20:50
Copy link
Contributor

@czeslavo czeslavo left a comment

Choose a reason for hiding this comment

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

Good stuff here! :) Left some comments, mostly in regards to readability. From the functional perspective - I think we're fine.

A general comment regarding testing: I'd love to have the code running the config updates unit tested as it's something that we're lacking, even before the changes this PR introduces. Now extending that, we stack even more complexity (concurrency 😬) in there which still remains untested. If possible, I'd try to make that unit-testable by extracting some interfaces. Doesn't have to be done in this PR though. WDYT?

Makefile Outdated Show resolved Hide resolved
internal/dataplane/kong_client.go Outdated Show resolved Hide resolved
internal/manager/config.go Outdated Show resolved Hide resolved
internal/manager/config.go Outdated Show resolved Hide resolved
internal/dataplane/kong_client.go Outdated Show resolved Hide resolved
internal/dataplane/kong_client.go Outdated Show resolved Hide resolved
internal/dataplane/sendconfig/kong.go Show resolved Hide resolved
internal/manager/config.go Outdated Show resolved Hide resolved
internal/manager/run.go Outdated Show resolved Hide resolved
internal/manager/run.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
internal/dataplane/kong_client.go Show resolved Hide resolved
internal/dataplane/kong_client.go Outdated Show resolved Hide resolved
internal/dataplane/kong_client.go Outdated Show resolved Hide resolved
internal/dataplane/synchronizer.go Show resolved Hide resolved
internal/dataplane/kong_client.go Outdated Show resolved Hide resolved
@randmonkey
Copy link
Contributor

I think we could add some integration test cases for configuring more than 1 kong instances and KongAdminURLs.

Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

Thanks for this effort, @pmalek. It looks like a big bunch of complex code 🚀

docs/api-reference.md Outdated Show resolved Hide resolved
internal/dataplane/kong_client.go Show resolved Hide resolved
internal/dataplane/kong_client.go Outdated Show resolved Hide resolved
internal/dataplane/sendconfig/kong.go Outdated Show resolved Hide resolved
internal/dataplane/sendconfig/kong.go Show resolved Hide resolved
internal/manager/run.go Outdated Show resolved Hide resolved
internal/manager/setup.go Outdated Show resolved Hide resolved
internal/manager/utils/reports.go Show resolved Hide resolved
internal/util/plugin_schema_helper.go Show resolved Hide resolved
pkg/apis/configuration/v1/kongprotocol_types.go Outdated Show resolved Hide resolved
@pmalek pmalek force-pushed the single-controller-deployments branch 2 times, most recently from ac8f3d7 to 7896368 Compare January 13, 2023 11:03
@pmalek
Copy link
Member Author

pmalek commented Jan 13, 2023

@mlavacca I extracted the changes for KongProtocol to a separate PR: #3371

@pmalek pmalek force-pushed the single-controller-deployments branch from 7896368 to 21119c8 Compare January 13, 2023 12:10
internal/manager/config.go Outdated Show resolved Hide resolved
internal/manager/config.go Outdated Show resolved Hide resolved
@pmalek pmalek force-pushed the single-controller-deployments branch 3 times, most recently from ae82347 to 5317416 Compare January 16, 2023 18:46
@pmalek pmalek force-pushed the single-controller-deployments branch 2 times, most recently from 10e431d to 1159f64 Compare January 17, 2023 09:17
@pmalek pmalek force-pushed the single-controller-deployments branch from 1159f64 to 447ecc4 Compare January 17, 2023 13:11
Copy link
Contributor

@czeslavo czeslavo left a comment

Choose a reason for hiding this comment

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

Two notes from my side:

  • Let's not forget about backfilling our test suite with tests covering this functionality before closing the issue.
  • In cases in which the PR evolves and the comments are being addressed (like this one), I would prefer to have granular commits history to be able to see changes that happened since my last review - it would save some time looking for the places that were changed. Was there any specific reason to always force push the changes as a single commit?

@pmalek
Copy link
Member Author

pmalek commented Jan 17, 2023

Was there any specific reason to always force push the changes as a single commit?

IMHO it's messy and I always feel that I need to come up with a contrived commit message that won't matter in the end, like : "wip", "review comments" and so on.

Gerrit workflow for the win! If only git allowed something like this :(

Feedback noted!

One more point on this is that I prefer to have clean history and with these types of commits it becomes hard to work on multiple branches that depend on each other (or work on the same piece of code). When you don't rebase and create more and more commits then you end up in merged spaghetti history (arguable) that's nearly impossible to use with rebasing workflow. With 1 (or handful but manageable amount) it's easier to reason about the history and easier to rebase.

Copy link
Member

@mlavacca mlavacca left a comment

Choose a reason for hiding this comment

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

🚢

Let's not forget about backfilling our test suite with tests covering this functionality before closing the issue.

+1 on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/feature New feature or request size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support single controller deployments
5 participants