Support Hash-Based Routing
This Pull-Request adds support for hash-based routing to Cloud Controller.
Summary: The routes model is enhanced as follows:
-
hashis added as a validloadbalancingoption -
hash_headeris added as a per-route option. The option is mandatory whenloadbalancing=hash -
hash_balanceis added as a per-route option. The option is optional whenloadbalancing=hash
Validation of these options is added when creating and updating both via API and via manifest. When hash_balance is provided as an option, its value must be a float or a string representing a float.
The options are still stored as a raw JSON string in the routes table. The value for hash_balance is always stored as a string inside the JSON for consistency.
Logic is introduced to remove hash_balance and hash_header when switching from hash to another load-balancing algorithm. Incremental updates on per-route options are allowed, e.g. only updating hash_header or hash_balance while keeping other previously set per-route options is possible.
Links:
-
[x] I have reviewed the contributing guide
-
[x] I have viewed, signed, and submitted the Contributor License Agreement
-
[x] I have made this pull request to the
mainbranch -
[x] I have run all the unit tests using
bundle exec rake -
[ ] I have run CF Acceptance Tests