Skip to content

Commit

Permalink
Ensure json_to_proto is passed through to envoy (#9586)
Browse files Browse the repository at this point in the history
* oops

* changelog

* unit test

* Update changelog/v1.17.0-rc2/passthrough-json-to-proto.yaml

Co-authored-by: ashish b <[email protected]>

---------

Co-authored-by: ashish b <[email protected]>
  • Loading branch information
EItanya and ashishb-solo committed Jun 7, 2024
1 parent b7007d9 commit 956610a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changelog/v1.17.0-rc2/passthrough-json-to-proto.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/solo-projects/issues/5890
resolvesIssue: false
description: >-
Properly pass through the `json_to_proto` value from the gloo API to the envoy API for
dynamic metadata transformations.
1 change: 1 addition & 0 deletions projects/gloo/pkg/plugins/transformation/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ func translateTransformationTemplate(in *transformation.Transformation_Transform
outTemplate.GetDynamicMetadataValues()[i] = &envoytransformation.TransformationTemplate_DynamicMetadataValue{
MetadataNamespace: values[i].GetMetadataNamespace(),
Key: values[i].GetKey(),
JsonToProto: values[i].GetJsonToProto(),
Value: &envoytransformation.InjaTemplate{
Text: values[i].GetValue().GetText(),
},
Expand Down
18 changes: 17 additions & 1 deletion projects/gloo/pkg/plugins/transformation/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,14 @@ var _ = Describe("Plugin", func() {
TransformationType: &transformation.Transformation_TransformationTemplate{
TransformationTemplate: &transformation.TransformationTemplate{
AdvancedTemplates: true,
DynamicMetadataValues: []*transformation.TransformationTemplate_DynamicMetadataValue{
{
MetadataNamespace: "namespace",
Key: "key",
Value: &transformation.InjaTemplate{Text: "hello"},
JsonToProto: true,
},
},
BodyTransformation: &transformation.TransformationTemplate_Body{
Body: &transformation.InjaTemplate{Text: "13"},
},
Expand All @@ -865,6 +873,14 @@ var _ = Describe("Plugin", func() {
TransformationType: &envoytransformation.Transformation_TransformationTemplate{
TransformationTemplate: &envoytransformation.TransformationTemplate{
AdvancedTemplates: true,
DynamicMetadataValues: []*envoytransformation.TransformationTemplate_DynamicMetadataValue{
{
MetadataNamespace: "namespace",
Key: "key",
Value: &envoytransformation.InjaTemplate{Text: "hello"},
JsonToProto: true,
},
},
BodyTransformation: &envoytransformation.TransformationTemplate_Body{
Body: &envoytransformation.InjaTemplate{Text: "13"},
},
Expand Down Expand Up @@ -1160,7 +1176,7 @@ var _ = Describe("Plugin", func() {
value = filters[1].Filter.GetTypedConfig()
Expect(value.GetValue()).To(BeEmpty())
})
It("should upstream_http_filters when the postRouting transformation exists", func() {
It("should add upstream_http_filters when the postRouting transformation exists", func() {
out := &envoy_config_route_v3.Route{}
err := p.(plugins.RoutePlugin).ProcessRoute(plugins.RouteParams{VirtualHostParams: plugins.VirtualHostParams{
Params: plugins.Params{
Expand Down

0 comments on commit 956610a

Please sign in to comment.