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 (hashicorp#20078)

* NET-6945 - Replace usage of deprecated Envoy field envoy.config.core.v3.HeaderValueOption.append

* update proto for v2 and then update xds v2 logic

* add changelog

* Update 20078.txt to be consistent with existing changelog entries

* swap enum values tomatch envoy.
  • Loading branch information
jmurret authored Jan 4, 2024
1 parent 55d7e95 commit 7a410d7
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 97 deletions.
3 changes: 3 additions & 0 deletions .changelog/20078.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
connect: Replace usage of deprecated Envoy field `envoy.config.core.v3.HeaderValueOption.append`.
```
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 @@ -23,7 +23,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 @@ -32,7 +32,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "big"
Expand All @@ -45,7 +45,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 @@ -54,7 +54,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "goldilocks"
Expand All @@ -67,7 +67,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 @@ -76,7 +76,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 @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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 @@ -50,7 +50,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "db"
Expand All @@ -63,7 +63,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 @@ -72,7 +72,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "big"
Expand All @@ -85,7 +85,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 @@ -94,7 +94,7 @@
],
"responseHeadersToAdd": [
{
"append": false,
"appendAction": "OVERWRITE_IF_EXISTS_OR_ADD",
"header": {
"key": "x-split-leg",
"value": "goldilocks"
Expand All @@ -107,7 +107,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 @@ -116,7 +116,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 @@ -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
Loading

0 comments on commit 7a410d7

Please sign in to comment.