QuotaSpecBinding not work

we want to use rating-limit on our’s service.

But QuotaSpecBinding does not work


apiVersion: "config.istio.io/v1alpha2"
kind: memquota
metadata:
  name: handler-test
  namespace: istio-system
spec:
  quotas:
  - name: requestcount-test.quota.istio-system
    maxAmount: 1000
    validDuration: 5s
    overrides:
    - dimensions:
        destination: xxx-api
      maxAmount: 1
      validDuration: 5s
    - dimensions:
        source: task-queue
        destination: xxx-api
      maxAmount: 1
      validDuration: 5s
    # The first matching override is applied.
    # A requestcount instance is checked against override dimensions.
---
apiVersion: "config.istio.io/v1alpha2"
kind: quota
metadata:
  name: requestcount-test
  namespace: istio-system
spec:
  dimensions:
    xForwardedFor: request.headers["x-forwarded-for"] | "unknown"
    token: request.headers["token"] | "unknown"
    source: source.workload.name | "unknown"
    destination: destination.workload.name | "unknown"
---
apiVersion: config.istio.io/v1alpha2
kind: rule
metadata:
  name: quota-test
  namespace: istio-system
spec:
  # quota only applies if you are not logged in.
  # match: match(request.headers["cookie"], "session=*") == false
  actions:
  - handler: handler-test.memquota
    instances:
    - requestcount-test.quota
---
apiVersion: config.istio.io/v1alpha2
kind: QuotaSpec
metadata:
  name: requestcount-test
  namespace: istio-system
spec:
  rules:
  - quotas:
    - charge: 1
      quota: requestcount-test
---
apiVersion: config.istio.io/v1alpha2
kind: QuotaSpecBinding
metadata:
  name: requestcount-test
  namespace: istio-system
spec:
  quotaSpecs:
  - name: requestcount-test
    namespace: istio-system
  services: 
  # ours nanespace 
  - service: "*.xxx-test.*"

we found the log

 "src/istio/mixerclient/quota_cache.cc:238] Add a new Referenced for quota cache: requestcount-test, reference: Absence-keys: request.headers[token], request.headers[x-forwarded-for], source.ip, Exact-keys: context.protocol, context.reporter.kind, destination.namespace, destination.port, destination.service, destination.uid, source.uid,

" on “xxx-api” istio-proxy pod ;

but other pod no contains the log.


➜  ~ istioctl version
Version: 1.0.5
GitRevision: c1707e45e71c75d74bf3a5dec8c7086f32f32fad
User: root@6f6ea1061f2b
Hub: docker.io/istio
GolangVersion: go1.10.4
BuildStatus: Clean

Can you give more information about the pod where you are not seeing the log?
Is this your applications pod or a istio-system’s pod?
Also the config_dump of the pod where you are not seeing the log could help figure out why Quotaspecbinding is not working as you expect it to…