fluxninja / aperture

Rate limiting, caching, and request prioritization for modern workloads
https://docs.fluxninja.com
Apache License 2.0
645 stars 25 forks source link

A quota_scheduler's denied_response_status_code setting doesn't work #3263

Open jgoeres opened 6 months ago

jgoeres commented 6 months ago

Due to https://github.com/fluxninja/aperture/issues/3258 I am currently creating a few simple policies manually based on examples and the Policy Language Spec https://docs.fluxninja.com/reference/configuration/spec. I defined a few policies for different "QoS classes", like this one:

apiVersion: fluxninja.com/v1alpha1
kind: Policy
metadata:
  labels:
    fluxninja.com/validate: "true"
  name: static-rate-limiting-tokens-platinum
spec:
  circuit:
    components:
      - flow_control:
          quota_scheduler:
            in_ports:
              bucket_capacity:
                constant_signal:
                  value: 20000
              fill_amount:
                constant_signal:
                  value: 20000
            out_ports:
              accept_percentage:
                signal_name: ACCEPT_PERCENTAGE
            scheduler:
              tokens_label_key: estimated_tokens
              # this doesn't work, still getting 503
              denied_response_status_code: "429"
            rate_limiter:
              interval: 60s
              continuous_fill: true
              limit_by_label_key: tenant
            selectors:
              - control_point: "awesome-feature-tokens"
                agent_group: default
                label_matcher:
                  match_list:
                    - key: qos
                      operator: In
                      values:
                      - platinum
[...]

Alas, despite setting the denied_response_status_code to 429, my simply Java test app receives 503 response codes for rejected requests.

I am running local agents and control plane, version 2.34.0