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

Support gw hostlevel ratelimiter #173

Merged
merged 1 commit into from
Sep 22, 2022
Merged

Support gw hostlevel ratelimiter #173

merged 1 commit into from
Sep 22, 2022

Conversation

MouceL
Copy link
Contributor

@MouceL MouceL commented Aug 24, 2022

This pr mainly supports vhost level ratelimit

** there is a problem with this feature on the data plane, envoy community will fix it recently, this pr is mainly to achieve control plane configuration down**

Related pr: #156

The main configuration changes arr in target.host, if you want to apply the plugin to vhost you can do this as following

apiVersion: microservice.slime.io/v1alpha2
kind: SmartLimiter
metadata:
  name: prod-gateway
  namespace: gateway-v112
spec:
  gateway: true  
  sets:
    _base:
      descriptor:
      - action:
          fill_interval:
            seconds: 60
          quota: "3"
          strategy: single
        condition: "true"
        target:
          direction: outbound
          port: 80
          host:
          - a.test.com
  workloadSelector:
    gw_cluster: prod-gateway   

or you can apply following

apiVersion: microservice.slime.io/v1alpha2
kind: SmartLimiter
metadata:
  name: prod-gateway
  namespace: gateway-v112
spec:
  target:
    direction: outbound
    port: 80
    host:
     - a.test.com
  gateway: true  
  sets:
    _base:
      descriptor:
      - action:
          fill_interval:
            seconds: 60
          quota: "3"
          strategy: single
        condition: "true"
  workloadSelector:
    gw_cluster: prod-gateway   

or apply plugin to route

apiVersion: microservice.slime.io/v1alpha2
kind: SmartLimiter
metadata:
  name: prod-gateway
  namespace: gateway-v112
spec:
  gateway: true  
  sets:
    _base:
      descriptor:
      - action:
          fill_interval:
            seconds: 60
          quota: "3"
          strategy: single
        condition: "true"
        target:
          direction: outbound
          port: 80
          route:
          - a.test.com/route1
  workloadSelector:
    gw_cluster: prod-gateway   

@MouceL MouceL requested a review from cywang1905 August 24, 2022 03:15
@MouceL
Copy link
Contributor Author

MouceL commented Aug 24, 2022

目前envoy社区的 host 级别限流存在问题,社区会尽快修复

@MouceL MouceL requested a review from YonkaFang August 24, 2022 03:30
@MouceL MouceL changed the title Support hostlevel ratelimiter Support gw hostlevel ratelimiter Aug 29, 2022
@@ -84,6 +84,8 @@ message SmartLimiterSpec {
bool gateway = 5;
// hostname specify svc host
string host = 6;
// rate limit target
Target target = 7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the scenario when target in spec directly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the target will apply to all actions,it will reduces api complexity in multiple actions

@YonkaFang YonkaFang merged commit 64cc1c3 into slime-io:master Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants