feat(sandbox): enforce container rootfs disk limit via Docker storage-opt#654
Open
zhangjaycee wants to merge 3 commits intoalibaba:masterfrom
Open
feat(sandbox): enforce container rootfs disk limit via Docker storage-opt#654zhangjaycee wants to merge 3 commits intoalibaba:masterfrom
zhangjaycee wants to merge 3 commits intoalibaba:masterfrom
Conversation
…ction - detect_storage_opt_support(): checks overlay2 driver + xfs backing + prjquota mount option - get_docker_info() / get_docker_root_dir(): thin wrappers around docker info - is_xfs_path(): checks if a filesystem path lives on an XFS mount These utilities are consumed by DockerDeployment to decide whether to apply --storage-opt and xfs_quota at container start time.
Rootfs quota (storage-opt): - Add limit_disk field to DockerDeploymentConfig; default None (no limit). - Pass --storage-opt size=<limit_disk> to docker run when the field is set. - Graceful degradation: if the worker does not support storage-opt (requires overlay2 + xfs + prjquota), effective_limit_disk is set to None while config.limit_disk stays unchanged. - Surface effective_limit_disk in SandboxInfo, sandbox_actor status, and SandboxStatusResponse so callers can observe the applied quota. Log-dir quota (XFS project quota): - Add limit_log_dir field to DockerDeploymentConfig; default None (no limit). - After container start, call xfs_quota to assign a per-project hard limit on ROCK_LOGGING_PATH; skip silently when the path is not on XFS. Server-side configuration: - RuntimeConfig gains default_limit_disk and default_log_dir_quota (both default to None); set in rock-xxx.yml per environment. - _apply_disk_limits() in sandbox_api reads these values and then checks Nacos for runtime overrides (Nacos wins over yml; None in both = no limit). - Remove limit_disk from SandboxStartRequest / SandboxConfig (SDK) — quota policy is server-side only; clients observe it via status responses.
Unit tests: - test_docker_util.py: detect_storage_opt_support, is_xfs_path, get_docker_root_dir - test_docker_deployment_disk_limit.py: _storage_opts(), start() degradation, effective_limit_disk vs config.limit_disk invariants - test_sandbox_manager_disk_limit.py: validate limit_disk format - test_sandbox_response.py: limit_disk field in SandboxStatusResponse Integration tests: - test_disk_limit_enforcement: rootfs quota blocks oversized files (SKIP_IF_NO_STORAGE_OPT) - test_disk_limit_default_value: server-reported limit_disk reflects configured value - test_logging_path_disk_limit_enforcement: log-dir quota is independently enforced (SKIP_IF_NO_STORAGE_OPT + SKIP_IF_LOG_PATH_NOT_XFS)
f8c66a4 to
dfe1e8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #653