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

How to config rate-limit plugin on a combination of service/route/+consumer? #367

Closed
lionel1993 opened this issue Aug 22, 2019 · 4 comments

Comments

@lionel1993
Copy link

Kong Ingress controller version
image

What happened

The rate-limiting plugin only works for the specified ingress,no matter what the user

Expected behvaior

The rate-limiting plugin only works for the specified user and the specified ingress

Steps To Reproduce

1.install rate-limiting plugin and key-auth plugin

echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: my-rate-limit
consumerRef: user1
config:
  minute: 5
  policy: redis
  redis_host: redis
plugin: rate-limiting
" | kubectl apply -n ai-test -f  - 

2.create user and credential

echo "
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
  name: user1
username: user1
" | kubectl apply -n ai-test -f - 

  
echo "
apiVersion: configuration.konghq.com/v1
kind: KongCredential
metadata:
  name: user1-key
consumerRef: user1
type: key-auth
config:
  key: user1-secret1
  " | kubectl apply -n ai-test -f -  
  
 
echo "
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
  name: user2
username: user2
" | kubectl apply -n ai-test -f - 
  
  
echo "
apiVersion: configuration.konghq.com/v1
kind: KongCredential
metadata:
  name: user2-key
consumerRef: user2
type: key-auth
config:
  key: user2-secret
  " | kubectl apply -n ai-test -f -  

3.associate rate-limiting plugin with user1

kubectl -n ai-test patch KongConsumer user1 \
-p '{"metadata":{"annotations":{"plugins.konghq.com":"my-rate-limit\n"}}}' 

4.add annotations to service(ingress)

kubectl -n ai-test patch ingress aigeomancyjava-test-ingress \
-p '{"metadata":{"annotations":{"plugins.konghq.com":"httpbin-auth,my-rate-limit\n"}}}'   

5.call url

  • test user1
    image

  • test user2
    image

in addition

While,I saw it on konga
image

thx for help!

@hbagdi
Copy link
Member

hbagdi commented Aug 22, 2019

Configuring a plugin for a combination of a Consumer and a Route or a Consumer and a Service via Kubernetes resources is not yet supported.
It is something we would like to add but we don't have a design yet on how to go about exposing this capability. Ideas/thoughts welcome here.

@lionel1993
Copy link
Author

Oh no,but I saw it in 0.5 chagnelog
image

Did I misunderstand it ?

@hbagdi
Copy link
Member

hbagdi commented Aug 23, 2019

@lionel1993 What exactly are you referring to in the changelog?

Consumer-level plugin support means that a plugin can be configured for a specific consumer (and not a combination of consumer and a route (yet)).

@hbagdi
Copy link
Member

hbagdi commented Sep 6, 2019

Tracking this in #386

@hbagdi hbagdi closed this as completed Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants