Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Generic Per-Route Options incl. Load Balancing Algorithm#428

Merged
maxmoehl merged 33 commits intocloudfoundry:mainfrom
sap-contributions:per-route-options-lb-algo
Jul 23, 2024
Merged

Generic Per-Route Options incl. Load Balancing Algorithm#428
maxmoehl merged 33 commits intocloudfoundry:mainfrom
sap-contributions:per-route-options-lb-algo

Conversation

@Dariquest
Copy link
Copy Markdown
Contributor

@Dariquest Dariquest commented Jul 11, 2024

Summary

Detailed specification including that of for all the involved components is provided in the RFC

Route definition is extended by generic options map with a load balancing algorithm. Options can be optionally specified in the following way with a json key lb_algo for the load balancing algorithm, e.g.

{
  "host": "127.0.0.1",
  "port": 4567,
  "protocol": "http1",
  "uris": ["url.localhost.routing.cf-app.com"],
  "options": {
    "lb_algo": "least-connection"
  },
  "app": "some_app_guid",
  "stale_threshold_in_seconds": 120,
  "server_cert_domain_san": "some_subject_alternative_name"
}

Supported load-balancing algorithms are specified in the Gorouter configuration in the LoadBalancingStrategies list. If a load balancing algorithm, provided for a route, is not in this configured list, the pool load balancing algorithm is kept and the error invalid-endpoint-load-balancing-algorithm-provided-keeping-pool-lb-algo is logged.

RegistryMessage structure is extended by an Options field of type RegistryMessageOpts structure, currently only containing the LoadBalancingAlgorithm field. Endpoint structure is extended by LoadBalancingAlgorithm field.

When initialising new endpoints, the load balancing algorithm is initialised to the value from the corresponding registry message option. When endpoints are registered and added to the pool, the load balancing algorithm of a pool is set to that one of a new endpoint.

RouteRegistry structure is extended by a new field DefaultLoadBalancingAlgorithm, which is initialised by the Gorouter default load balancing configuration property LoadBalance. This default value is a default load balancing algorithm for a new pool.

Since the route options are optional, not providing them has no effect on the existing default load balancing algorithm logic.

Backward Compatibility

Breaking Change? No

Check list

Resolves: cloudfoundry/routing-release#421

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Jul 11, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@Dariquest Dariquest force-pushed the per-route-options-lb-algo branch from f119e46 to 1025d7f Compare July 17, 2024 09:32
@Dariquest Dariquest changed the title Per route options lb algo Generic Per-Route Options including Load Balancing Algorithm json: lb_algo Jul 17, 2024
@Dariquest Dariquest changed the title Generic Per-Route Options including Load Balancing Algorithm json: lb_algo Generic Per-Route Options including Load Balancing Algorithm Jul 17, 2024
@Dariquest Dariquest changed the title Generic Per-Route Options including Load Balancing Algorithm Generic Per-Route Options incl. Load Balancing Algorithm Jul 17, 2024
@Dariquest Dariquest marked this pull request as ready for review July 17, 2024 15:11
@Dariquest Dariquest requested a review from a team as a code owner July 17, 2024 15:11
@Dariquest Dariquest marked this pull request as draft July 17, 2024 17:20
Copy link
Copy Markdown
Member

@maxmoehl maxmoehl left a comment

Choose a reason for hiding this comment

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

I've focused on the actual code, I'll review the tests once we have the first round of reviews in.

@Dariquest Dariquest requested a review from maxmoehl July 19, 2024 10:48
Copy link
Copy Markdown
Member

@stefanlay stefanlay left a comment

Choose a reason for hiding this comment

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

Found a small typo, looks good overall.

@Dariquest
Copy link
Copy Markdown
Contributor Author

Dariquest commented Jul 19, 2024

Found a small typo, looks good overall.

@stefanlay Thanks!

@Dariquest Dariquest requested review from peanball and stefanlay July 22, 2024 06:36
@maxmoehl maxmoehl merged commit 1fd3db3 into cloudfoundry:main Jul 23, 2024
@Dariquest Dariquest deleted the per-route-options-lb-algo branch July 24, 2024 09:27
a18e added a commit to sap-contributions/gorouter that referenced this pull request Oct 22, 2024
Shows the lb algorithm of each endpoint in Gorouters /routes page.
This simplifies debugging of related issues.
The option to set route-specific load balancing algorithms was
introduced in cloudfoundry#428.
MarcPaquette pushed a commit that referenced this pull request Oct 22, 2024
Shows the lb algorithm of each endpoint in Gorouters /routes page.
This simplifies debugging of related issues.
The option to set route-specific load balancing algorithms was
introduced in #428.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Implement per-route options in gorouter

4 participants