istio / old_issues_repo

Deprecated issue-tracking repo, please post new issues or feature requests to istio/istio instead.
37 stars 9 forks source link

Error creating redisquota adapter #238

Open kubeguide opened 6 years ago

kubeguide commented 6 years ago

Is this a BUG or FEATURE REQUEST?: BUG

Did you review https://istio.io/help/ and existing issues to identify if this is already solved or being worked on?: Yes, can't find related error report and solution.

Bug: Y

What Version of Istio and Kubernetes are you using, where did you get Istio from, Installation details

istioctl version: 0.6.0
kubectl version: 1.9.2

Is Istio Auth enabled or not ? no

What happened: Trying to create a redisquota adapter to test rate limit on bookinfo sample applications.

First I found the CRD type "redisquota" is missing in istio.yaml, so I manually create one:

kind: CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1beta1
metadata:
  name: redisquotas.config.istio.io
  labels:
    package: redisquota
    istio: mixer-adapter
spec:
  group: config.istio.io
  names:
    kind: redisquota
    plural: redisquotas
    singular: redisquota
  scope: Namespaced
  version: v1alpha2

Then I try to create a redisquota adapter + quota + rule similar to memquota, refering to example from a source code: https://github.com/istio/istio/blob/master/mixer/adapter/redisquota/redisquota_integration_test.go

When creating api object "quota" with name "requestCount", k8s complains capital letter is not allowed, so I changed to "requestcount". And change namespace to default instead of istio-system. From above example, I also create the attributemanifest "istio-proxy", not sure what its purpose is.

And there's a redis service running in k8s cluster. parameter redisServerUrl is using service clusterIP, not sure if service name is working.

below are my config:

---
apiVersion: config.istio.io/v1alpha2
kind: redisquota
metadata:
  name: handler
  namespace: default
spec:
  # Redis connection pool
  redisServerUrl: 10.1.1.101:6379
  connectionPoolSize: 1
  quotas:
  - name: requestcount.quota.default
    maxAmount: 50
    validDuration: 2s
    bucketDuration: 1s
    rateLimitAlgorithm: ROLLING_WINDOW
    overrides:
    # The following override applies to 'ratings' when
    # the source is 'reviews'.
    - dimensions:
        destination: ratings
        source: reviews
      maxAmount: 1
    # The following override applies to 'ratings' regardless
    # of the source.
    - dimensions:
        destination: reviews
      maxAmount: 5

---
apiVersion: config.istio.io/v1alpha2
kind: quota
metadata:
  name: requestcount
  namespace: default
spec:
  dimensions:
    source: source.labels["app"] | source.service | "unknown"
    sourceVersion: source.labels["version"] | "unknown"
    destination: destination.labels["app"] | destination.service | "unknown"
    destinationVersion: destination.labels["version"] | "unknown"

---
apiVersion: config.istio.io/v1alpha2
kind: rule
metadata:
  name: quota
  namespace: default
spec:
  actions:
  - handler: handler.redisquota
    instances:
    - requestcount.quota

Then I check istio-mixer's log and get following error messages:

......
2018-03-13T12:06:40.649372Z     info    Publishing 2 events
**2018-03-13T12:06:40.649702Z     error   Handler not found: handler='handler.redisquota.default', action='quota.rule.default[0]'
2018-03-13T12:06:40.649714Z     error   No valid actions found in rule: quota.rule.default**
2018-03-13T12:06:40.649720Z     info    Built new config.Snapshot: id='3'
......

Then I run wrk load generator, no rate limit is applied to service "rating".

There's no such error messages when creating "memquota" adapter and rule.

What you expected to happen: redisquota adapter is created and working correctly. I'm wondering if redisquota is not implemented in the v0.6.0 release? Thanks!

How to reproduce it: Use yaml config file above.

Feature Request: N

sakshigoel12 commented 6 years ago

@mandarjog can you add the owner for the redisquota adapter to this issue