-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backport: Expose initial_metadata in GrpcHealthCheck [1.14] (#8530)
* feat: Expose initial_metadata in GrpcHealthCheck (#8511) * feat: Expose initial_metadata in GrpcHealthCheck * Trigger CI * Fix uneven whitespace Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io> * Adding changelog file to new location * Avoid code duplcation * Removing duplicate changelog * fix test * Add check for forbidden custom headers --------- Co-authored-by: David Jumani <djumani@Solo-System-DJumani.local> Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io> Co-authored-by: changelog-bot <changelog-bot> * Move changelog * Update changelog --------- Co-authored-by: David Jumani <djumani@Solo-System-DJumani.local> Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Nathan Fudenberg <nathan.fudenberg@solo.io>
- Loading branch information
1 parent
0842751
commit cdfdb14
Showing
13 changed files
with
534 additions
and
160 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
changelog/v1.14.14/expose-initialmetadata-grpchealthcheck.yaml
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,6 @@ | ||
changelog: | ||
- type: FIX | ||
issueLink: https://github.com/solo-io/gloo/issues/8490 | ||
resolvesIssue: true | ||
description: >- | ||
Adds the ability to pass `initial_metadata` while configuring a GrpcHealthCheck. It specifies a list of key-value pairs that should be added to the metadata of each GRPC call that is sent to the health checked cluster. |
2 changes: 2 additions & 0 deletions
2
...o-io/gloo/projects/gloo/api/external/envoy/api/v2/core/health_check.proto.sk.md
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package api_conversion_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestChannelutils(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "API Conversion Suite") | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package api_conversion_test | ||
|
||
import ( | ||
"github.com/golang/protobuf/ptypes/wrappers" | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" | ||
. "github.com/solo-io/gloo/pkg/utils/api_conversion" | ||
envoycore_sk "github.com/solo-io/solo-kit/pkg/api/external/envoy/api/v2/core" | ||
) | ||
|
||
var _ = Describe("Type conversion", func() { | ||
Context("ToEnvoyHeaderValueOptionList", func() { | ||
It("should convert allowed headers", func() { | ||
allowedHeaders := []*envoycore_sk.HeaderValueOption{ | ||
{ | ||
HeaderOption: &envoycore_sk.HeaderValueOption_Header{ | ||
Header: &envoycore_sk.HeaderValue{ | ||
Key: "allowed", | ||
Value: "header", | ||
}, | ||
}, | ||
Append: &wrappers.BoolValue{ | ||
Value: true, | ||
}, | ||
}, | ||
} | ||
|
||
expectedHeaders := []*envoy_config_core_v3.HeaderValueOption{ | ||
{ | ||
Header: &envoy_config_core_v3.HeaderValue{ | ||
Key: "allowed", | ||
Value: "header", | ||
}, | ||
Append: &wrappers.BoolValue{ | ||
Value: true, | ||
}, | ||
}, | ||
} | ||
headers, err := ToEnvoyHeaderValueOptionList(allowedHeaders, nil, HeaderSecretOptions{}) | ||
Expect(err).To(BeNil()) | ||
Expect(headers).To(Equal(expectedHeaders)) | ||
}) | ||
|
||
DescribeTable("should error out forbidden headers", func(key string) { | ||
allowedHeaders := []*envoycore_sk.HeaderValueOption{ | ||
{ | ||
HeaderOption: &envoycore_sk.HeaderValueOption_Header{ | ||
Header: &envoycore_sk.HeaderValue{ | ||
Key: key, | ||
Value: "value", | ||
}, | ||
}, | ||
Append: &wrappers.BoolValue{ | ||
Value: true, | ||
}, | ||
}, | ||
} | ||
|
||
_, err := ToEnvoyHeaderValueOptionList(allowedHeaders, nil, HeaderSecretOptions{}) | ||
Expect(err).To(MatchError(ContainSubstring(": -prefixed or host headers may not be modified"))) | ||
}, | ||
Entry("host header", "host"), | ||
Entry(": prefixed header header", ":path")) | ||
}) | ||
}) |
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
17 changes: 17 additions & 0 deletions
17
projects/gloo/pkg/api/external/envoy/api/v2/core/health_check.pb.equal.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
105 changes: 61 additions & 44 deletions
105
projects/gloo/pkg/api/external/envoy/api/v2/core/health_check.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.