Skip to content

feat(proxy): add PROXY_USERS_DEFAULT_QUOTA for personal spaces#2895

Open
flash7777 wants to merge 1 commit into
opencloud-eu:mainfrom
flash7777:feature/users-default-quota
Open

feat(proxy): add PROXY_USERS_DEFAULT_QUOTA for personal spaces#2895
flash7777 wants to merge 1 commit into
opencloud-eu:mainfrom
flash7777:feature/users-default-quota

Conversation

@flash7777
Copy link
Copy Markdown

Summary

  • Adds a new PROXY_USERS_DEFAULT_QUOTA environment variable (config: default_users_quota) that sets a default quota in bytes for newly created personal spaces
  • This quota acts as a fallback when no role-specific quota is configured via role_quotas
  • A value of 0 (default) preserves the existing behavior (unlimited quota)

Motivation

Currently, personal spaces are created without any quota unless a role-specific quota mapping is configured. This means that by default, every user gets unlimited storage on their personal space. On systems with limited storage (e.g. a 100GB volume), a single user can fill the entire disk -- which is what happened on our production system, causing a full outage.

The existing GRAPH_SPACES_DEFAULT_QUOTA only applies to project spaces created via the Graph API. There was no equivalent for personal spaces created during user login.

Usage

PROXY_USERS_DEFAULT_QUOTA=1000000000  # 1 GB default for new personal spaces

Or in proxy.yaml:

default_users_quota: 1000000000

Changes

File Change
services/proxy/pkg/config/config.go New config field DefaultUsersQuota with env PROXY_USERS_DEFAULT_QUOTA
services/proxy/pkg/middleware/options.go New middleware option + setter function
services/proxy/pkg/middleware/create_home.go Fallback to defaultUsersQuota when no role quota matches
services/proxy/pkg/command/server.go Wire config to middleware

Test plan

  • Set PROXY_USERS_DEFAULT_QUOTA=1000000000 and create a new user -- personal space should have 1GB quota
  • Without the env var set (or set to 0) -- existing behavior, unlimited quota
  • With both role quota and default quota configured -- role quota takes precedence
  • Existing personal spaces are not affected (quota is only applied on creation)

With support of Claude Code

When a new user logs in and their personal space is created, the quota
was only set if a role-specific quota was configured via role_quotas.
Without that, personal spaces got unlimited quota by default.

This adds a new PROXY_USERS_DEFAULT_QUOTA environment variable that
serves as a fallback when no role-specific quota is configured. Setting
it to e.g. 1000000000 (1GB) ensures all new personal spaces get a
sensible default quota, preventing individual users from filling up
the entire storage volume.

A value of 0 (default) preserves the existing behavior (unlimited).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -21 duplication

Metric Results
Duplication -21

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant