OCPBUGS-88450: Use fixed artifacts directory to prevent stale temp dir accumulation#16606
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe downloads server now uses a fixed ChangesDownloads Config Artifact Directory
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@matzew: This pull request references Jira Issue OCPBUGS-88450, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
…r accumulation The downloads server previously created a new random temp directory via os.MkdirTemp on each startup. When Kubernetes restarts the container (without deleting the pod), the emptyDir volume persists and each restart leaves behind ~3.1G of orphaned artifacts. The defer-based cleanup in main() only runs on graceful exit, not on SIGKILL. Switch to a fixed, well-known path (/tmp/artifacts) and clean it on startup with os.RemoveAll before re-creating it. This guarantees at most one copy of the artifacts exists at any time. Signed-off-by: Matthias Wessendorf <mwessend@redhat.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
|
/cherry-pick release-4.22 |
|
@matzew: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/jira refresh |
|
@matzew: This pull request references Jira Issue OCPBUGS-88450, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/assign @jhadvig |
The downloads server creates a new temporary directory (via Python's `tempfile.mkdtemp()`) each time it starts up and extracts the `oc` CLI artifacts for all platforms into it (~3.1G per directory). The `emptyDir` volume backing `/tmp` persists across container restarts by Kubernetes design, it is only cleared when the pod is deleted from the node. The downloads server does not clean up old temporary directories from previous runs on startup. Each container restart leaves behind a full copy of the CLI artifacts, causing linear disk growth. - https://redhat.atlassian.net/browse/OCPBUGS-88450 This is used as workaround and once openshift/console#16606 is merged and part of OCP payload, will revert this one.
|
This is kind of urgent for us since it is increasing the size of disk can we prioritize it? |
|
/test e2e-playwright |
|
Nice fix! Thanks @matzew Suggestion: clean up pre-existing random temp dirs from the old code The first deployment with this fix won't clean up stale random temp dirs created by the old // Clean up stale temp dirs from previous code versions and current fixed path
matches, _ := filepath.Glob("/tmp/artifacts*")
for _, match := range matches {
os.RemoveAll(match)
}
if err := os.MkdirAll(tempDir, 0755); err != nil {
return nil, fmt.Errorf("failed to create artifacts directory: %w", err)
}This handles both the old random dirs and the new fixed path in one pass, and the existing Request: add unit tests for The existing tests in
|
Address review feedback:
- Use filepath.Glob("/tmp/artifacts*") to also remove stale random
temp directories left by the old os.MkdirTemp code (e.g.
/tmp/artifacts1234567890). The first deployment with the fixed path
would otherwise leave those orphaned dirs behind.
- Add unit tests for NewDownloadsServerConfig directory handling:
1. Clean start creates the directory and populates it
2. Restart with stale data cleans up and recreates correctly
3. Old random temp dirs (/tmp/artifacts*) are also cleaned up
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
|
@jhadvig thx! |
|
@matzew: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/lgtm |
|
@jhadvig: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig, matzew The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@matzew: Jira Issue Verification Checks: Jira Issue OCPBUGS-88450 Jira Issue OCPBUGS-88450 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@matzew: #16606 failed to apply on top of branch "release-4.22": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Fix included in release 5.0.0-0.nightly-2026-06-18-000016 |
The downloads server previously created a new random temp directory via os.MkdirTemp on each startup. When Kubernetes restarts the container (without deleting the pod), the emptyDir volume persists and each restart leaves behind ~3.1G of orphaned artifacts. The defer-based cleanup in main() only runs on graceful exit, not on SIGKILL.
Switch to a fixed, well-known path (/tmp/artifacts) and clean it on startup with os.RemoveAll before re-creating it. This guarantees at most one copy of the artifacts exists at any time.
Summary by CodeRabbit