emissary-ingress / emissary

open source Kubernetes-native API gateway for microservices built on the Envoy Proxy
https://www.getambassador.io
Apache License 2.0
4.38k stars 688 forks source link

Rate Limit documentation is incorrect #5374

Open gecube opened 1 year ago

gecube commented 1 year ago

Good day Sirs,

I read Rate Limit documentation that is published by the link https://www.getambassador.io/docs/emissary/latest/topics/using/rate-limits/#attaching-labels-to-requests And found that it is completely misleading.

First of all, all keys are described like

generic_key:
  key: mykey
  value: myvalue

or

request_headers:
  header_name: "header-name"
  key: mykey

If I paste such a value into emissary Mapping manifest:

apiVersion: getambassador.io/v3alpha1
kind: Mapping
metadata:
  name: mapping-my-top-level-domain
  namespace: emissary
spec:
  ambassador_id: [ "public" ]
  hostname: my.top.level.domain
  prefix: /api/v4
  rewrite: ""
  add_request_headers:
    Site-Enum:
      value: _HEADER_COM
      append: False
  service: service.namespace:8484
  labels:
    emissary:
      - request_label_group:
          - request_headers:
              header_name: "CF-Connecting-IP"
              key: remote_address
          - generic_key:
              key: endpoint
              value: api_v4

I am getting the next object in the cluster:

apiVersion: getambassador.io/v2
kind: Mapping
metadata:
  name: mapping-my-top-level-domain
  namespace: emissary
spec:
  add_request_headers:
    Site-Enum:
      append: false
      value: _HEADER_COM
  ambassador_id:
    - '--apiVersion-v3alpha1-only--public'
  host: my.top.level.domain
  labels:
    emissary:
      - request_label_group:
          - remote_address:
              header: CF-Connecting-IP
          - generic_key: api_v4
            v3Key: endpoint
  prefix: /api/v4
  rewrite: ''
  service: 'service.namespace:8484'

Looks very weird. I am stating that values are mangled.

Expected behaviour:

cindymullins-dw commented 1 year ago

Hi @gecube , can you give us an example of the Mapping yaml you'd expect, so we can better understand how the values seem mangled?