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

Contour ignores key field of genericKey for global rateLimitPolicy #3443

Closed
SimonVHB opened this issue Mar 4, 2021 · 1 comment · Fixed by #3445
Closed

Contour ignores key field of genericKey for global rateLimitPolicy #3443

SimonVHB opened this issue Mar 4, 2021 · 1 comment · Fixed by #3445
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@SimonVHB
Copy link

SimonVHB commented Mar 4, 2021

What steps did you take and what happened:
When applying a rateLimitPolicy on an HTTPProxy using a genericKey entry, the key field of the genericKey is ignored and the default value (generic_key) is passed on to the RLS.

Example configuration (using a kuard deployment as example and the envoy ratelimit service).

HTTPProxy

apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: kuard
  labels:
    app: kuard
spec:
  virtualhost:
    fqdn: local.projectcontour.io
    rateLimitPolicy:
      global:
        descriptors:
          - entries:
            - genericKey:
                key: foo
                value: bar
  routes:
  - services:
    - name: kuard
      port: 80

Envoy ratelimit config

domain: contour
descriptors:
  - key: foo
    value: bar
    rate_limit:
      unit: minute
      requests_per_unit: 100

Envoy ratelimit debug logs

level=debug msg="starting cache lookup"
level=debug msg="returning normal response"
level=debug msg="got descriptor: (generic_key=bar)"
level=debug msg="starting get limit lookup"
level=debug msg="looking up key: generic_key_bar"
level=debug msg="looking up key: generic_key"
level=debug msg="descriptor does not match any limit, no limits applied"

What did you expect to happen:
Contour should set the genericKey key value properly and pass that value on to the RLS.
The RLS should get the following descriptor:

descriptor: (foo=bar)

instead of

descriptor: (generic_key=bar)

Anything else you would like to add:
This happens for a RL policy defined on the virtualhost as well for a RL policy defined at the route.

Environment:

  • Contour version: v1.13.1
  • Kubernetes version: (use kubectl version): v1.19.4+k3s1
  • Kubernetes installer & version: k3d
  • Cloud provider or hardware configuration: k3d local test cluster
  • OS (e.g. from /etc/os-release): /
@SimonVHB SimonVHB added kind/bug Categorizes issue or PR as related to a bug. lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. labels Mar 4, 2021
@skriss skriss self-assigned this Mar 4, 2021
@skriss
Copy link
Member

skriss commented Mar 4, 2021

👀

skriss added a commit to skriss/contour that referenced this issue Mar 4, 2021
Fixes a bug where a generic key descriptor's key
was not being configured in the Envoy descriptor
if it was specified, resulting in Envoy always
generating the default key of "generic_key".

Fixes projectcontour#3443.

Signed-off-by: Steve Kriss <krisss@vmware.com>
@skriss skriss added this to the 1.14.0 milestone Mar 4, 2021
@skriss skriss removed the lifecycle/needs-triage Indicates that an issue needs to be triaged by a project contributor. label Mar 4, 2021
skriss added a commit to skriss/contour that referenced this issue Mar 4, 2021
Fixes a bug where a generic key descriptor's key
was not being configured in the Envoy descriptor
if it was specified, resulting in Envoy always
generating the default key of "generic_key".

Fixes projectcontour#3443.

Signed-off-by: Steve Kriss <krisss@vmware.com>
stevesloka pushed a commit that referenced this issue Mar 8, 2021
Fixes a bug where a generic key descriptor's key
was not being configured in the Envoy descriptor
if it was specified, resulting in Envoy always
generating the default key of "generic_key".

Fixes #3443.

Signed-off-by: Steve Kriss <krisss@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants