Skip to content

Commit

Permalink
NET-6945 - Replace usage of deprecated Envoy field envoy.config.core.…
Browse files Browse the repository at this point in the history
…v3.HeaderValueOption.append
  • Loading branch information
jmurret committed Jan 3, 2024
1 parent d925e4b commit 554a05f
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 33 deletions.
6 changes: 5 additions & 1 deletion agent/xds/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,10 @@ func makeHeadersValueOptions(vals map[string]string, add bool) []*envoy_core_v3.
Key: k,
Value: v,
},
Append: response.MakeBoolValue(add),
}
if !add {
// default is APPEND_IF_EXISTS_OR_ADD
o.AppendAction = envoy_core_v3.HeaderValueOption_OVERWRITE_IF_EXISTS_OR_ADD
}
opts = append(opts, o)
}
Expand Down Expand Up @@ -1130,6 +1133,7 @@ func injectLBToRouteAction(lb *structs.LoadBalancer, action *envoy_route_v3.Rout
}

func injectHeaderManipToRoute(dest *structs.ServiceRouteDestination, r *envoy_route_v3.Route) error {

if !dest.RequestHeaders.IsZero() {
r.RequestHeadersToAdd = append(
r.RequestHeadersToAdd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
},
"requestHeadersToAdd": [
{
"append": true,
"header": {
"key": "X-Header-Add",
"value": "added"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "X-Header-Set",
"value": "set"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
},
"requestHeadersToAdd": [
{
"append": true,
"header": {
"key": "X-Header-Add",
"value": "added"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "X-Header-Set",
"value": "set"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
"name": "db",
"requestHeadersToAdd": [
{
"append": true,
"header": {
"key": "foo",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand All @@ -33,14 +32,13 @@
],
"responseHeadersToAdd": [
{
"append": true,
"header": {
"key": "foo",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand Down Expand Up @@ -408,14 +406,13 @@
},
"requestHeadersToAdd": [
{
"append": true,
"header": {
"key": "request",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand All @@ -427,14 +424,13 @@
],
"responseHeadersToAdd": [
{
"append": true,
"header": {
"key": "response",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,13 @@
},
"requestHeadersToAdd": [
{
"append": true,
"header": {
"key": "request",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand All @@ -389,14 +388,13 @@
],
"responseHeadersToAdd": [
{
"append": true,
"header": {
"key": "response",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"name": "db.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
"requestHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "db"
Expand All @@ -51,7 +51,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "db"
Expand All @@ -64,7 +64,7 @@
"name": "big-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
"requestHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "big"
Expand All @@ -73,7 +73,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "big"
Expand All @@ -86,7 +86,7 @@
"name": "goldilocks-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
"requestHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "goldilocks"
Expand All @@ -95,7 +95,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "goldilocks"
Expand All @@ -108,7 +108,7 @@
"name": "lil-bit-side.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul",
"requestHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "small"
Expand All @@ -117,7 +117,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "small"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,13 @@
},
"requestHeadersToAdd": [
{
"append": true,
"header": {
"key": "request",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand All @@ -389,14 +388,13 @@
],
"responseHeadersToAdd": [
{
"append": true,
"header": {
"key": "response",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,13 @@
},
"requestHeadersToAdd": [
{
"append": true,
"header": {
"key": "request",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand All @@ -388,14 +387,13 @@
],
"responseHeadersToAdd": [
{
"append": true,
"header": {
"key": "response",
"value": "bar"
}
},
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "bar",
"value": "baz"
Expand Down

0 comments on commit 554a05f

Please sign in to comment.