keep zones unique per ingress resource
This commit is contained in:
parent
ed3803cf58
commit
a3594f6c4c
2 changed files with 11 additions and 5 deletions
|
|
@ -292,22 +292,23 @@ http {
|
|||
{{ end }}
|
||||
|
||||
{{ if ne $location.RateLimit.Name "" }}
|
||||
{{ if ne (whitelistExists $location.RateLimit.Name) true }}
|
||||
# Ratelimit {{ $location.RateLimit.Name }}
|
||||
{{ $rln := (print $server.Hostname "_" $location.RateLimit.Name) }}
|
||||
geo $whitelist_{{ buildWhitelistVariable $rln }} {
|
||||
geo $whitelist_{{ buildWhitelistVariable $location.RateLimit.Name }} {
|
||||
default 0;
|
||||
{{ range $ip := $location.RateLimit.Whitelist }}
|
||||
{{ $ip }} 1;{{ end }}
|
||||
}
|
||||
|
||||
# Ratelimit {{ $location.RateLimit.Name }}
|
||||
map $whitelist_{{ buildWhitelistVariable $rln }} $limit_{{ buildWhitelistVariable $rln }} {
|
||||
map $whitelist_{{ buildWhitelistVariable $location.RateLimit.Name }} $limit_{{ buildWhitelistVariable $location.RateLimit.Name }} {
|
||||
0 {{ $cfg.LimitConnZoneVariable }};
|
||||
1 "";
|
||||
}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* build all the required rate limit zones. Each annotation requires a dedicated zone */}}
|
||||
{{/* 1MB -> 16 thousand 64-byte states or about 8 thousand 128-byte states */}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue