Skip to content
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

Detect support for fuse-overlayfs #198

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cgruver
Copy link

@cgruver cgruver commented Dec 10, 2024

Add logic to entrypoint.sh to detect support for fuse-overlayfs

@cgruver cgruver changed the title Detect fuse Detect support for fuse-overlayfs Dec 10, 2024
@svor svor requested a review from dkwon17 December 11, 2024 10:12
base/ubi9/entrypoint.sh Outdated Show resolved Hide resolved
@@ -5,6 +5,16 @@ if [ ! -d "${HOME}" ]; then
mkdir -p "${HOME}"
fi

# Configure container builds to use vfs or fuse-overlayfs
if [ ! -d "${HOME}/.config/containers" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkwon17 with this change we should probably update the docs as well, right?
e.g. https://docs.redhat.com/en/documentation/red_hat_openshift_dev_spaces/3.17/html-single/user_guide/index?extIdCarryOver=true&sc_cid=701f2000001Css5AAC#enabling-overlay-with-a-configmap
Now UDI will be smart enough to detect fuse automatically

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ibuziuk , yes, a configmap will not be needed anymore if the tooling container image is based on ubi/udi

@ibuziuk
Copy link
Contributor

ibuziuk commented Dec 11, 2024

verified on Developer Sandbox:

containers $ podman version
WARN[0000] Using cgroups-v1 which is deprecated in favor of cgroups-v2 with Podman v5 and will be removed in a future version. Set environment variable `PODMAN_IGNORE_CGROUPSV1_WARNING` to hide this warning. 
Client:       Podman Engine
Version:      5.2.2
API Version:  5.2.2
Go Version:   go1.22.7 (Red Hat 1.22.7-2.el9_5)
Built:        Wed Oct 23 09:08:59 2024
OS/Arch:      linux/amd64
containers $ cat storage.conf 
[storage]
driver = "vfs"
containers $ stat /dev/fuse

@@ -5,6 +5,16 @@ if [ ! -d "${HOME}" ]; then
mkdir -p "${HOME}"
fi

# Configure container builds to use vfs or fuse-overlayfs
if [ ! -d "${HOME}/.config/containers" ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if persistent home is enabled and fuse-overlayfs gets disabled? Would ${HOME}/.config/containers/storage.conf need to be rewritten? Would the outer if block stop that from happening?

Copy link
Author

@cgruver cgruver Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only way to disable fuse-overlayfs would be to apply a machine-config to the cluster, so I would say it's not likely. And if it did happen, that would be a disruptive change.

The reason that I put the first if block there is to not overwrite any existing podman config. The user might have added additional config to storage.conf which we would not want to clobber on a workspace restart.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if block could be a bit more targeted to look specifically for storage.conf I suppose.

if [ ! -f "${HOME}/.config/containers/storage.conf" ]; then

But, there are valid configs where there is no storage.conf file, but other content under ${HOME}/.config/containers. Which is why I just check for the existence of the directory, not the file.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cgruver that makes sense, thanks!

Copy link
Author

@cgruver cgruver Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: As of OCP 4.15 /dev/fuse is available for leaking into a container OOTB. No cluster change required.

With OCP 4.17 /dev/net/tun is also available.

Pod annotation: io.kubernetes.cri-o.Devices: "/dev/fuse,/dev/net/tun"

So, to disable fuse-overlayfs support would require disruptive intervention on the part of cluster admins.

Copy link

openshift-ci bot commented Dec 12, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cgruver, dkwon17, ibuziuk

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants