diff --git a/controllers/nginx/pkg/template/template.go b/controllers/nginx/pkg/template/template.go index 1f1251237..18373bda0 100644 --- a/controllers/nginx/pkg/template/template.go +++ b/controllers/nginx/pkg/template/template.go @@ -346,10 +346,10 @@ func buildRateLimitZones(input interface{}) []string { } if loc.RateLimit.RPS.Limit > 0 { - zone := fmt.Sprintf("limit_conn_zone $binary_remote_addr zone=%v:%vm rate=%vr/s;", - loc.RateLimit.Connections.Name, - loc.RateLimit.Connections.SharedSize, - loc.RateLimit.Connections.Limit) + zone := fmt.Sprintf("limit_req_zone $binary_remote_addr zone=%v:%vm rate=%vr/s;", + loc.RateLimit.RPS.Name, + loc.RateLimit.RPS.SharedSize, + loc.RateLimit.RPS.Limit) zones = append(zones, zone) } } @@ -376,7 +376,7 @@ func buildRateLimit(input interface{}) []string { if loc.RateLimit.RPS.Limit > 0 { 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) } diff --git a/core/pkg/ingress/annotations/ratelimit/main.go b/core/pkg/ingress/annotations/ratelimit/main.go index 83ce4d2c0..f3ca328b7 100644 --- a/core/pkg/ingress/annotations/ratelimit/main.go +++ b/core/pkg/ingress/annotations/ratelimit/main.go @@ -91,7 +91,7 @@ func (a ratelimit) Parse(ing *extensions.Ingress) (interface{}, error) { RPS: Zone{ Name: fmt.Sprintf("%v_rps", zoneName), Limit: rps, - Burst: conn * defBurst, + Burst: rps * defBurst, SharedSize: defSharedSize, }, }, nil