diff --git a/changelog/v1.17.0-rc2/passthrough-json-to-proto.yaml b/changelog/v1.17.0-rc2/passthrough-json-to-proto.yaml new file mode 100644 index 00000000000..8d7460cdadd --- /dev/null +++ b/changelog/v1.17.0-rc2/passthrough-json-to-proto.yaml @@ -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. diff --git a/projects/gloo/pkg/plugins/transformation/plugin.go b/projects/gloo/pkg/plugins/transformation/plugin.go index b1d981380c7..daf62264673 100644 --- a/projects/gloo/pkg/plugins/transformation/plugin.go +++ b/projects/gloo/pkg/plugins/transformation/plugin.go @@ -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(), }, diff --git a/projects/gloo/pkg/plugins/transformation/plugin_test.go b/projects/gloo/pkg/plugins/transformation/plugin_test.go index 29355bd65ed..ababf0c271e 100644 --- a/projects/gloo/pkg/plugins/transformation/plugin_test.go +++ b/projects/gloo/pkg/plugins/transformation/plugin_test.go @@ -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"}, }, @@ -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"}, }, @@ -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{