Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Envoy Buffer Per Route not being applied #48939

Open
MaggGomes opened this issue Jan 23, 2024 · 2 comments
Open

Envoy Buffer Per Route not being applied #48939

MaggGomes opened this issue Jan 23, 2024 · 2 comments
Labels
lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while

Comments

@MaggGomes
Copy link

MaggGomes commented Jan 23, 2024

Description:

Hey! First of all, I am new to Istio/Envoyproxy, so the issue that I am describing here, may have been already mentioned, although I did not find anyghin related to the subject. So my sincere apologies if I am mistaken.

What I am trying to achieve:
I am trying to use Istio configured with an Envoy filter in order to have a global buffer, in order to filter requests bigger than 10 MB. Moreover, I want that for some particular routes/endpoints (i.e. /shipments), the max request size is smaller than the global filter (i.e. 5 MB).

What I did:
The following yaml describes the implementation of a global filter of 10 MB using envoy.extensions.filters.http.buffer.v3.Buffer, as well as the implementation of a more specific filter of 5 MB to the route /shipments using envoy.extensions.filters.http.buffer.v3.Buffer.

What is not working:
Although the global filter is working, the buffer per route is not. I already tried reading the documentation more carefully, but without success.

I'm not sure the yaml is 100% correct, neither if this is the best way to implement this as I don't fully grasp Envoy's capabilities.
Any suggestion is welcomed

Thanks

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: global-buffer
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
    - applyTo: HTTP_FILTER
      match:
        context: GATEWAY
        listener:
          filterChain:
            filter:
              name: "envoy.filters.network.http_connection_manager"
              subFilter:
                name: "envoy.filters.http.router"
      patch:
        operation: INSERT_BEFORE
        value:
          name: envoy.filters.http.buffer
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.http.buffer.v3.Buffer
            max_request_bytes: 104857606 # 10 MB.

---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: buffer-per-route-filter
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
    - applyTo: HTTP_ROUTE
      match:
        context: GATEWAY
        routeConfiguration:
          vhost:
            name: ""
            route:
              action: ANY
      patch:
        operation: INSERT_BEFORE
        value:
          name: envoy.filters.buffer.BufferPerRoute
          match:
            prefix: "/shipments"
          typed_per_filter_config:
            envoy.filters.http.buffer:
              "@type": type.googleapis.com/envoy.extensions.filters.http.buffer.v3.BufferPerRoute
              buffer:
                max_request_bytes: 5242880 # 5 MB.
@zengyuxing007
Copy link
Contributor

Maybe vhost needs to be set and the route match should be written above.

---
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: buffer-per-route-filter
  namespace: istio-system
spec:
  workloadSelector:
    labels:
      istio: ingressgateway
  configPatches:
    - applyTo: HTTP_ROUTE
      match:
        routeConfiguration:
          vhost:
            name: "xxxx" ## your vhost name, such as "*:80", you can find the name by envoy configdump
            route: 
                name: "yyyy"  ## the route config name       
      patch:
        operation: MERGE
        value:
          typed_per_filter_config:
            envoy.filters.http.buffer:
              "@type": type.googleapis.com/envoy.extensions.filters.http.buffer.v3.BufferPerRoute
              value:
                 buffer:
                    max_request_bytes: 5242880 # 5 MB.

@istio-policy-bot
Copy link

🧭 This issue or pull request has been automatically marked as stale because it has not had activity from an Istio team member since 2024-01-24. It will be closed on 2024-05-08 unless an Istio team member takes action. Please see this wiki page for more information. Thank you for your contributions.

Created by the issue and PR lifecycle manager.

@istio-policy-bot istio-policy-bot added the lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while
Projects
None yet
Development

No branches or pull requests

3 participants