-
Notifications
You must be signed in to change notification settings - Fork 102
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 #482
Comments
My major requirement is that the API changes are done in a compatible way. I.e. the new For the route object, there are three variants what to return if no options are set:
For
I don't have a strong opinion here but tend to the merge semantics: it is used before in the API and it may make it easier for clients to set/unset individual route options without changing others. |
Yes, of course! I've updated the description.
Since you mention the last option is probably the most compatible one I've included that one for now, feel free to object if you think another option should be preferred.
I've updated the issue to specify the merge semantics. |
@stephanme @maxmoehl |
This should cover the use-case if I understand you correctly. |
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
Overall, any fields that use the JSON serializer could be good prior art for this: https://github.com/cloudfoundry/cloud_controller_ng/blob/3e1d2f423c5b5d5b959a49e09db6a0e2680ebfdd/lib/cloud_controller/serializer.rb#L5 From a quick survey, that looks like:
However, I suspect most of those are not user-updatable. |
I agree with Stephan regarding "return the options field if at least one option is set": we should always return the
This can be addressed in @tcdowney and my forthcoming manifest RFC. |
We don't seem to have too many cases of object fields that allow updates. I poked around some, and found some examples: App LifecycleOne potentially interesting case of partial update of object fields is app lifecycle:
QuotasI didn't try this myself, but the quota API docs say:
Process Health ChecksThis also appears to deep merge:
And is nullable with an explicit
There are probably some additional cases, but the above should be a good corpus to start from. |
Another option to avoid this whole thing is to move these options to a Pseudo-Resource, nested under a route. This would be similar to app env vars, which are not on the app resource itself. For example, something like:
I think the main issue with this would be that the options would not be present during initial route creation. |
Hi @Gerg , thanks for your comments. This one is contradicting though: Stefan and Max voted for option 3 (no options -> return a route object without options field). This is what we have implemented. You propose to always return options. I agree with @maxmoehl and @stephanme here - we should keep it as compatible as possible, so anyone who's not using the options field will not see any changes in the API fields. Other than that, the options hash and any of its fields are nullable when explicitely setting fields to |
I must have misread @stephanme. I was referencing:
A few points:
cc @cloudfoundry/wg-app-runtime-interfaces-capi-approvers for additional perspectives. |
Hi, better late than never I would like to consider unifying the naming of options used in the API, Gorouter and the CF CLI. Specifically, for Showing a long string like this in the UI (CLI) is quite inconvenient as it uses up a lot of space. The "algorithm" part of the property could also be considered superfluous, as "load balancing: round-robin" is equally telling for how requests will be handled. My proposal (from the cf-cli perspective) is thus to shorten it to From the existing changes, only Gorouter and this PR would need adjustment, as the other components are just passing through the properties without further inspection. See also cloudfoundry/cli#3314 for more details on how the cli might look like and show these options. |
Hi @peanball , thanks for your valuable input! Your suggestion to unify the identifier for the load-balancing algorithm absolutely makes sense. I am neither a fan of |
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
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
* Introduce per-route options 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 route-options documentation Add documentation for the route options object, and its supported fields. * Adjust route options behaviour for manifest push 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 adjust test for manifest push: options {key:nil} should not modify the existing value * Adjust behaviour to new decisions: 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 nullable, but no-op * Remove route option validations from manifest_route * Rename 'lb_algo' and 'loadbalancing-algorithm' to 'algorithm' * Disallow null in manifest; Cleanup error outputs --------- Co-authored-by: Alexander Nicke <[email protected]>
Issue
RFC0027 Generic Per-Route Features got accepted but is not yet implemented in the cloud controller.
Context
See the RFC for details.
Expected result
API Changes
In the RFC there was a discussion about the semantics of the API for this feature, please read it before commenting on that topic. Based on that discussion and some offline consulting with @stephanme I propose we go for the following behaviour:
POST /v3/routes
will accept the optionaloptions
field and add them to the route. For each option only the valid values are acceptable,null
is not.GET /v3/routes(/:guid)?
andGET /v3/apps/:guid/routes
return the options field if at least one option is set. Unset options are not returned, if no option is set theoptions
field is not returned at all.PATCH /v3/routes/:guid
in addition to the valid values also acceptsnull
for each option or the options field as a whole to unset either individual values or the entire set of options. Providing some options will merge them with the existing stored options, with the provided ones overwriting any stored ones. If theoptions
field is not provided in the request the options will not be modified by this operation.POST /v3/spaces/:guid/actions/apply_manifest
is only capable of setting options to a value, existing options which are not specified in the manifest remain untouched. This implies that there is no way to unset a per-route option via the manifest.ping @tcdowney @beyhan @stephanme who took part in the discussion and @Gerg who was also mentioned.
Please raise your comments in this issue, we plan to start working on this soon! If you prefer, we can also join the CAPI office hours to discuss this topic.
The text was updated successfully, but these errors were encountered: