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

refactor: Move anonymous_ratelimit to shared_config #2067

Open
wants to merge 4 commits into
base: 04-25-DDoS_prevention_for_anonymous_manager_API_requests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/2067.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move `anonymous_ratelimit` to shared_config
2 changes: 1 addition & 1 deletion src/ai/backend/manager/api/ratelimit.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def rlim_middleware(
return response
else:
root_ctx: RootContext = app["_root.context"]
rate_limit = root_ctx.local_config["manager"]["anonymous-ratelimit"]
rate_limit = root_ctx.shared_config["anonymous_ratelimit"]

ip_address = get_client_ip(request)

Expand Down
2 changes: 1 addition & 1 deletion src/ai/backend/manager/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@
"agent-selection-resource-priority",
default=["cuda", "rocm", "tpu", "cpu", "mem"],
): t.List(t.String),
t.Key("anonymous-ratelimit", default=None): t.Null | t.ToInt,
t.Key("importer-image", default="lablup/importer:manylinux2010"): t.String,
t.Key("max-wsmsg-size", default=16 * (2**20)): t.ToInt, # default: 16 MiB
tx.AliasedKey(["aiomonitor-termui-port", "aiomonitor-port"], default=48100): t.ToInt[
Expand Down Expand Up @@ -474,6 +473,7 @@ def container_registry_serialize(v: dict[str, Any]) -> dict[str, str]:
): session_hang_tolerance_iv,
},
).allow_extra("*"),
t.Key("anonymous_ratelimit", default=None): t.Null | t.ToInt,
}).allow_extra("*")

_volume_defaults: dict[str, Any] = {
Expand Down
Loading