-
Notifications
You must be signed in to change notification settings - Fork 360
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
Implement per-route options in Cloud Controller #4080
base: main
Are you sure you want to change the base?
Conversation
This commit adds a configurable load-balancing algorithm as a first example of per-route options. It adds the 'options' field to the route object in the V3 API, and the app manifest. The options field is an object storing key-value pairs, with 'lb_algo' being the only supported key for now. The supported load-balancing algorithms are 'round-robin' and 'least-connections'. The options field is introduced as a column in the database route table, and forwarded to the Diego backend. Co-authored-by: Alexander Nicke <[email protected]> See: cloudfoundry/capi-release#482 See: https://github.com/cloudfoundry/community/blob/main/toc/rfc/rfc-0027-generic-per-route-features.md
Add documentation for the route options object, and its supported fields.
4ce58eb
to
d5e369c
Compare
Overwrite behaviour for route options is now fixed and tested: Existing options are not modified if options is nil, {} or not provided A single option (e.g. loadbalancing-algorithm) can be removed by setting its value to nil
33d7efb
to
35d8b72
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test the proposed changes on a dev landscape.
I've tested the new feature on a dev landscape and everything works as expected. There are however a few corner cases that we should discuss: 1. "options" with This request is accepted:
It doesn't change anything. Is that intended or should the request be rejected? 2. Valid option key with
Accepted and sets the "options" field to {} (empty map). Shouldn't this be rejected? 3. Create new route without "options" Use the CF CLI to create a new route:
This will send a POST request:
Now the "option" field in the database is set to "null" (text "null"). For existing routes the option field is initially 4. "options" in app manifest Pushing an app with manifest works:
For configuration with |
|
||
record.errors.add(:routes, message: 'must be a list of route objects') | ||
if contains_invalid_route_options?(record.routes) | ||
record.errors.add(:routes, message: 'contains invalid route options') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good if all validation error messages contained the list of valid options.
Did you plan to create a new acceptance test for this feature? You could add it to this capi-bara-test: |
options {key:nil} should not modify the existing value
fd56bc8
to
7f6cc57
Compare
7f6cc57
to
af076fe
Compare
Thanks for your review @jochenehret
You found a recently introduced bug, we fix it. According to the tracking issue, this request should unset all options (which it does now again).
No, this is the expected behavior, as documented in the tracking issue.
There is another post in the tracking issue. @Gerg argues for always providing the
We fixed this - unsetting options in general or loadbalancing-algorithm in particular is not possible any more. |
options default: {} API: options is not nullable specific option is additive specific option is nullable empty hash does not change anything (additive) get empty options -> {} manifest: options and specific option is not nullable
A short explanation of the proposed change:
This Pull-Request adds per-route options to the Cloud Controller. Support is added for the following APIs:
Per-route options support is also added to the manifest.
An explanation of the use cases your change solves
Users / app developers want to define load-balancing algorithms per route, instead of being forced to use the globally defined algorithm.
Links to any other associated PRs
RFC for per-route options: https://github.com/cloudfoundry/community/blob/main/toc/rfc/rfc-0027-generic-per-route-features.md
capi-release issue: Implement per-route options in Cloud Controller capi-release#482
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
main
branchI have run all the unit tests using
bundle exec rake
I have run CF Acceptance Tests