0

I have service and I need to limit the API based on users and organization.

Example : User A and User B belongs same OrgA. Any user can access the API 5 times a day and Organization can access the API 8 times a day.

Service

apiVersion: v1
kind: Service
metadata:
  name: kong-my-app
  annotations:
    kubernetes.io/ingress.class: kong
    konghq.com/plugins: rate-limiting-myapp-1, rate-limiting-myapp
  labels:
    run: kong-my-app
spec:
  type: NodePort
  ports:
  - nodePort: 31687
    port: 8200
    protocol: TCP
  selector:
    run: kong-my-app
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: rate-limiting-myapp-1
config:
hour: 8
limit_by: header
header_name: ‘x-org-id’
policy: local
plugin: rate-limiting
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: rate-limiting-myapp
config:
hour: 5
limit_by: header
header_name: ‘x-user-id’
policy: local
plugin: rate-limiting

Service is picking the last plugin provided in the annotation. is it possible to apply same plugin of two variant ? In above example, its picking only rate-limiting-myapp which is the last one in the plugin list. Please help me if we have any other way to do.

is it a limitation in kong rate limit plugin ?. Do we need advanced rate limiter(Enterprise) to get this done ?

Abdul Razak AK
  • 405
  • 1
  • 7
  • 17
  • Did you find an answer to this? – Eamonn McEvoy Jun 08 '22 at 08:07
  • Hi @EamonnMcEvoy We don't have option to support 2 variants. Kong Dcoumentaion Example: if the rate-limiting plugin is applied twice (with different configurations): for a Service (Plugin config A), and for a Consumer (Plugin config B), then requests authenticating this Consumer will run Plugin config B and ignore A. However, requests that do not authenticate this Consumer will fallback to running Plugin config A. Note that if config B is disabled (its enabled flag is set to false), config A will apply to requests that would have otherwise matched config B. https://shorturl.at/ptFNX – Abdul Razak AK Jun 08 '22 at 11:43

0 Answers0