Fix issue for ratelimit
Signed-off-by: Tang Le <tangle3@wanda.cn>
This commit is contained in:
parent
8f9b71002b
commit
50297c8f47
2 changed files with 6 additions and 6 deletions
|
@ -346,10 +346,10 @@ func buildRateLimitZones(input interface{}) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
if loc.RateLimit.RPS.Limit > 0 {
|
if loc.RateLimit.RPS.Limit > 0 {
|
||||||
zone := fmt.Sprintf("limit_conn_zone $binary_remote_addr zone=%v:%vm rate=%vr/s;",
|
zone := fmt.Sprintf("limit_req_zone $binary_remote_addr zone=%v:%vm rate=%vr/s;",
|
||||||
loc.RateLimit.Connections.Name,
|
loc.RateLimit.RPS.Name,
|
||||||
loc.RateLimit.Connections.SharedSize,
|
loc.RateLimit.RPS.SharedSize,
|
||||||
loc.RateLimit.Connections.Limit)
|
loc.RateLimit.RPS.Limit)
|
||||||
zones = append(zones, zone)
|
zones = append(zones, zone)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ func buildRateLimit(input interface{}) []string {
|
||||||
|
|
||||||
if loc.RateLimit.RPS.Limit > 0 {
|
if loc.RateLimit.RPS.Limit > 0 {
|
||||||
limit := fmt.Sprintf("limit_req zone=%v burst=%v nodelay;",
|
limit := fmt.Sprintf("limit_req zone=%v burst=%v nodelay;",
|
||||||
loc.RateLimit.Connections.Name, loc.RateLimit.Connections.Burst)
|
loc.RateLimit.RPS.Name, loc.RateLimit.RPS.Burst)
|
||||||
limits = append(limits, limit)
|
limits = append(limits, limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (a ratelimit) Parse(ing *extensions.Ingress) (interface{}, error) {
|
||||||
RPS: Zone{
|
RPS: Zone{
|
||||||
Name: fmt.Sprintf("%v_rps", zoneName),
|
Name: fmt.Sprintf("%v_rps", zoneName),
|
||||||
Limit: rps,
|
Limit: rps,
|
||||||
Burst: conn * defBurst,
|
Burst: rps * defBurst,
|
||||||
SharedSize: defSharedSize,
|
SharedSize: defSharedSize,
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
|
|
Loading…
Reference in a new issue