forked from kgateway-dev/kgateway
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[backport] gateway2: use safer merging to avoid assuming zero values …
…as being unset (#10559) Signed-off-by: Shashank Ram <[email protected]>
- Loading branch information
1 parent
f0be1ac
commit 7b72f42
Showing
4 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
changelog: | ||
- type: NON_USER_FACING | ||
resolvesIssue: false | ||
description: | | ||
gateway2: use safer merging to avoid assuming zero values as being unset | ||
The legacy Edge code uses ShallowMerge() which can undesirably overwrite | ||
zero values mistaking them for unset values. RouteOptions merging in | ||
GatewayV2 uses the same API, but this can result in undesirable effects | ||
if the merging considers zero valued fields as being unset. To avoid | ||
this, the options merging used by GatewayV2 relies on a safer merge | ||
that only allows merging of values that can be set to Nil (pointers, | ||
slices, maps, etc.) which works since all user-facing fields on the | ||
RouteOptions are nil-able. Functionally, this is the same as before | ||
due to all fields being nil-able, but is a bit clearer to readers. | ||
Moreover, trying to merge a non-nil field will panic which can catch | ||
potential misuse of the API. |
This file contains 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
This file contains 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
This file contains 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