🐛 Fix cache path to avoid /var/cache/dnf conflict - #2835
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Updates operator-controller’s default filesystem cache directory to avoid permission errors on RHEL-based images where /var/cache/dnf exists and is root-owned, causing startup failure when the cache directory is being emptied.
Changes:
- Change the
--cache-pathflag default from/var/cacheto/var/cache/operator-controller.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The default cache path was /var/cache, which can cause chmod failures when running as non-root (UID 1001) on container images that contain /var/cache/dnf owned by root (e.g., RHEL-based images). EnsureEmptyDirectory() attempts to chmod entries in the cache directory to make them writable before deletion, but non-root users cannot chmod root-owned directories, resulting in: 'chmod /var/cache/dnf: operation not permitted' Change default from /var/cache to /var/cache/operator-controller to avoid conflicts with system directories in base images. Fixes: https://issues.redhat.com/browse/OCPBUGS-89330
8bc8480 to
dcb78f5
Compare
|
Hello @fgiudici @OchiengEd, Could someone approve the workflow runs so the tests can kick off? Thanks! |
rashmigottipati
left a comment
There was a problem hiding this comment.
approved the workflow runs.
|
/approve The alternative would be to update the Helm charts to allow modification of the arguments, so that we can render new arguments into the manifests. This is a much simpler fix, and avoids other potential directories that might be owned by root, regardless of the k8s host. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rashmigottipati, tmshort 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 |
4deb390
into
operator-framework:main
Problem
On RHEL-based container images, operator-controller and catalogd pods crash on startup with:
This happens because:
/var/cache(operator-controller) or/var/cache/(catalogd)/var/cache/dnfowned by rootEnsureEmptyDirectory()tries to chmod root-owned directories, which failsSolution
Change default cache paths to component-specific subdirectories to avoid conflicts with system directories:
/var/cache→/var/cache/operator-controller/var/cache/→/var/cache/catalogdChanges
cmd/operator-controller/main.go
--cache-pathdefault from/var/cacheto/var/cache/operator-controllercmd/catalogd/main.go
--cache-dirdefault from/var/cache/to/var/cache/catalogdBoth changes follow the same pattern: use a component-specific subdirectory under
/var/cache/to avoid conflicts with system directories like/var/cache/dnf.Testing
/var/cache/Related: OCPBUGS-89330