-
Notifications
You must be signed in to change notification settings - Fork 72
fix(container-cache): cap emptyDir cache zones with max_size so nginx evicts before kubelet does #1577
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
Open
balajinvda
wants to merge
1
commit into
main
Choose a base branch
from
fix/container-cache-emptydir-max-size
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix(container-cache): cap emptyDir cache zones with max_size so nginx evicts before kubelet does #1577
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
51 changes: 51 additions & 0 deletions
51
deploy/helm/container-cache/tests/render-emptydir-max-size-test.sh
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #!/usr/bin/env bash | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Rendered-output regression tests for cache eviction sizing. An emptyDir | ||
| # shares the node filesystem, so min_free alone never fires there; the chart | ||
| # must add a per-zone max_size in that mode and only in that mode. Run from | ||
| # the chart subtree: | ||
| # bash tests/render-emptydir-max-size-test.sh | ||
| set -euo pipefail | ||
| CHART_DIR="$(cd "$(dirname "$0")/.." && pwd)/deploy" | ||
| TMP="$(mktemp -d)" | ||
| trap 'rm -rf "$TMP"' EXIT | ||
| fail() { echo "FAIL: $*" >&2; exit 1; } | ||
| count() { grep -Ec "$1" "$2" || true; } | ||
| paths() { grep -E '^\s*proxy_cache_path ' "$1"; } | ||
|
|
||
| helm template t "$CHART_DIR" > "$TMP/default.yaml" 2>/dev/null | ||
| helm template t "$CHART_DIR" --set persistentVolumeClaim.storageClassName=nvcf-cc-sc > "$TMP/pvc.yaml" 2>/dev/null | ||
| helm template t "$CHART_DIR" --set persistentVolumeClaim.sizeProxyGB=5000 --set persistentVolumeClaim.sizeGB=1000 --set persistentVolumeClaim.freeProxyPct=15 > "$TMP/big.yaml" 2>/dev/null | ||
| helm template t "$CHART_DIR" --set persistentVolumeClaim.freeProxyPct=100 > "$TMP/edge.yaml" 2>/dev/null | ||
|
|
||
| echo "1. every render declares exactly three cache paths" | ||
| for f in default pvc big edge; do | ||
| [ "$(count '^\s*proxy_cache_path ' "$TMP/$f.yaml")" = 3 ] || fail "$f: expected 3 proxy_cache_path directives" | ||
| done | ||
|
|
||
| echo "2. emptydir (chart default 200/100/15): max_size is 85 percent of each zone's own size" | ||
| paths "$TMP/default.yaml" | grep -q '/container_cache levels=1:2 max_size=85g min_free=30g' || fail "container zone: expected max_size=85g min_free=30g" | ||
| paths "$TMP/default.yaml" | grep -q '/proxy_cache/s3 levels=1:2 max_size=170g min_free=30g' || fail "s3 zone: expected max_size=170g min_free=30g" | ||
| paths "$TMP/default.yaml" | grep -q '/proxy_cache/ngc levels=1:2 max_size=170g min_free=30g' || fail "ngc zone: expected max_size=170g min_free=30g" | ||
|
|
||
| echo "3. emptydir: max_size stays below the emptyDir sizeLimit kubelet enforces" | ||
| grep -q 'sizeLimit: "200Gi"' "$TMP/default.yaml" || fail "proxy-cache emptyDir sizeLimit must be 200Gi" | ||
| grep -q 'sizeLimit: "100Gi"' "$TMP/default.yaml" || fail "cache emptyDir sizeLimit must be 100Gi" | ||
|
|
||
| echo "4. PersistentVolume: no max_size renders and min_free is unchanged" | ||
| [ "$(count 'max_size=' "$TMP/pvc.yaml")" = 0 ] || fail "max_size leaked into the PVC render" | ||
| [ "$(count 'min_free=30g' "$TMP/pvc.yaml")" = 3 ] || fail "PVC render must keep min_free=30g on all three zones" | ||
| grep -q 'storageClassName: "nvcf-cc-sc"' "$TMP/pvc.yaml" || fail "PVC render must carry the storage class" | ||
|
|
||
| echo "5. emptydir sized for a large node (5000/1000/15): caps scale with the configured sizes" | ||
| paths "$TMP/big.yaml" | grep -q '/proxy_cache/ngc levels=1:2 max_size=4250g min_free=750g' || fail "ngc zone: expected max_size=4250g min_free=750g" | ||
| paths "$TMP/big.yaml" | grep -q '/container_cache levels=1:2 max_size=850g min_free=750g' || fail "container zone: expected max_size=850g" | ||
| grep -q 'sizeLimit: "5000Gi"' "$TMP/big.yaml" || fail "proxy-cache emptyDir sizeLimit must follow sizeProxyGB" | ||
|
|
||
| echo "6. freeProxyPct=100 clamps max_size to 1g instead of rendering 0g" | ||
| [ "$(count 'max_size=1g' "$TMP/edge.yaml")" = 3 ] || fail "expected max_size=1g on all zones at freeProxyPct=100" | ||
| [ "$(count 'max_size=0g' "$TMP/edge.yaml")" = 0 ] || fail "max_size=0g must never render" | ||
|
|
||
| echo "PASS: emptydir max_size render tests" |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: NVIDIA/nvcf
Length of output: 191
🏁 Script executed:
Repository: NVIDIA/nvcf
Length of output: 9945
🤖 get_repo_knowledge executed:
get_repo_knowledge NVIDIA/nvcf /tmp/coderabbit-repo-knowledge/nvidia-nvcf-193a0c82/architecture /tmp/coderabbit-repo-knowledge/nvidia-nvcf-193a0c82/conventions /tmp/coderabbit-repo-knowledge/nvidia-nvcf-193a0c82/learningsLength of output: 47630
Preserve an explicit
freeProxyPct=0value.$proxyMinFreePctusesdefault, which treats numeric0as empty. The template therefore uses7, caps emptyDir caches at 93% of their configured sizes, and sets PersistentVolumemin_freeto 7% ofsizeProxyGB. Read the chart value directly with integer conversion. Add a rendered zero-value case.🤖 Prompt for AI Agents