Fix route options serialization to preserve explicitly removed values#5010
Open
hoffmaen wants to merge 1 commit intocloudfoundry:mainfrom
Open
Fix route options serialization to preserve explicitly removed values#5010hoffmaen wants to merge 1 commit intocloudfoundry:mainfrom
hoffmaen wants to merge 1 commit intocloudfoundry:mainfrom
Conversation
f5d30c4 to
9d54abd
Compare
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a route option (e.g.,
loadbalancing) is explicitly removed via the API, the value is set tonilinternally. Theoptions=setter previously called.compacton the options hash, which removed nil keys entirely from the serialized JSON. This made the resulting"options":{}indistinguishable from a route that never had options set, preventing downstream consumers (e.g., gorouter) from detecting the explicit removal and reverting to the platform default.Fixes cloudfoundry/routing-release#551
Changes
.compactwith.transform_values { |v| v.nil? ? '' : v }inRoute#options_with_serialization=, so that explicitly removed options are serialized as empty strings (e.g.,"options":{"loadbalancing":""}) instead of being droppedroute_update_spec.rbandmanifest_route_update_spec.rbto expect{ 'loadbalancing' => '' }instead of{}route_spec.rbthat explicitly verifies nil option values are serialized as empty stringsContext
This is the Cloud Controller counterpart to a gorouter issue (cloudfoundry/routing-release#551) that adds support for reverting a per-route load balancing algorithm to the platform default. Without this CC change, the removal signal is lost before it reaches gorouter via NATS.
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests