solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.03k stars 433 forks source link

Multiple transformations in a chain #4989

Open antonioberben opened 3 years ago

antonioberben commented 3 years ago

Is your feature request related to a problem? Please describe. As a user I cannot define transformations in a chain which will be executed in the way I define.

i.e. Following VS specifies two transformations, to happen at the early stage. The first transformation is expected to be executed always and adds a header: x-first: true The second transformation is expected to be executed only if x-first: true exists and adds a another header: x-second: true Both will be executed under the same path prefix: / (for all the requests)

apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
  name: demo
  namespace: gloo-system
spec:
[...]
    options:
      stagedTransformations:
        early:
          requestTransforms:
          - requestTransformation:
              transformationTemplate:
                parseBodyBehavior: DontParse
                headers:
                  x-second:
                    text: 'true'
            matcher:
              prefix: /
              headers:
                - name: "x-first"
                  value: "true"
    routes:
      - options:
          stagedTransformations:
            inheritTransformation: true
            early:
              requestTransforms:
                - requestTransformation:
                    transformationTemplate:
                      headers:
                        x-first:
                          text: 'true'
                  matcher:
                    prefix: /
        matchers:
          - prefix: /
        routeAction:
          single:
            upstream:
              name: default-httpbin-80
              namespace: gloo-system

So far, only one is executed. The second one is omitted.

Describe the solution you'd like Given the VS from above, I would be able to execute both transformations in a chain.

Describe alternatives you've considered An alternative is to define a mechanism like the Istio offers which allows you to explicitly decide where the filter will be injected. i.e.: operation: INSERT_BEFORE https://istio.io/latest/docs/reference/config/networking/envoy-filter/#EnvoyFilter-Patch-Operation

Thank you!

murphye commented 2 years ago

I believe this to be related/duplicate of: https://github.com/solo-io/gloo/issues/4063

github-actions[bot] commented 1 month ago

This issue has been marked as stale because of no activity in the last 180 days. It will be closed in the next 180 days unless it is tagged "no stalebot" or other activity occurs.