Skip to content

Conversation

@thehajime
Copy link
Contributor

@thehajime thehajime commented Sep 3, 2020

This PR tries to add new platform support with darwin, since we have OCI runtime (https://github.com/ukontainer/runu) running on macos (w/o hypervisor.framework).

The commits include several specific issues (thus draft PR); several are already addressed but I would like to ask opinions from more people if there are better ways to handle.

  • reap process handling is tricky since there are no PR_SET_CHILD_SUBREAPER alike on darwin

  • I'm completely unfamiliar with native snapshotter; thus the current patch (16845ac0b64362186673b6af5873f549904fea01) is a bandaid to pass ctr run without failures.

    • make integration fails right now, thus ignored for the moment (will revert it) (reverted)
  • go-runc package needs to be updated (thus skip validate/vendor for the moment; will revert as well) (reverted)

    • fchown with anonymous pipes on darwin returns EINVAL
  • skip critest since grpc.v1.cri for darwin is not ported yet; disabled the test as well

I have another patchset for dockerd: will work on when everything required is upstreamed to containerd.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 3, 2020

Build succeeded.

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer this to be called io.containerd.runu.v1 and maintained in runu's repo

Copy link
Member

Choose a reason for hiding this comment

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

Or just extend the existing io.containerd.runc.v2 to support Darwin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree; will move those parts (cmd/containerd-shim-darwin-v1) to runu repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did remove cmd/containerd-shim-darwin-v1. I will update the runu part later.

Comment on lines +23 to +33
Copy link
Member

Choose a reason for hiding this comment

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

Do we have snapshotters natively work on darwin? Should we have a new one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at least, make integration reported some of errors related to snapshotters (which I was struggled to interpret them).

https://github.com/containerd/containerd/runs/1064611094?check_suite_focus=true#step:10:13

It would be helpful if somebody let me know what I have to do for a proper snapshotter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because bind mount is faked with a symbolic link, some features are not available. But the current integration test for the native snapshot looks okay to me (I disabled TestSnapshotterClient/ViewReadonly for darwin); how do you think ?

--- PASS: TestSnapshotterClient (0.01s)
    --- PASS: TestSnapshotterClient/Chown (1.07s)
    --- PASS: TestSnapshotterClient/Basic (1.11s)
    --- PASS: TestSnapshotterClient/RemoveDirectoryInLowerLayer (1.57s)
    --- PASS: TestSnapshotterClient/Remove (1.22s)
    --- PASS: TestSnapshotterClient/Walk (1.76s)
    --- PASS: TestSnapshotterClient/PreareViewFailingtest (0.89s)
    --- PASS: TestSnapshotterClient/TransitivityTest (0.56s)
    --- PASS: TestSnapshotterClient/StatComitted (0.23s)
    --- SKIP: TestSnapshotterClient/ViewReadonly (0.00s)
    --- PASS: TestSnapshotterClient/StatActive (0.16s)
    --- PASS: TestSnapshotterClient/RootPermission (0.16s)
    --- PASS: TestSnapshotterClient/CloseTwice (0.42s)
    --- PASS: TestSnapshotterClient/Update (3.24s)
    --- PASS: TestSnapshotterClient/StatInWalk (1.11s)
    --- SKIP: TestSnapshotterClient/Rename (0.00s)
    --- PASS: TestSnapshotterClient/MoveFileFromLowerLayer (1.00s)
    --- PASS: TestSnapshotterClient/DeletedFilesInChildSnapshot (1.76s)
    --- PASS: TestSnapshotterClient/RemoveIntermediateSnapshot (1.05s)
    --- PASS: TestSnapshotterClient/DirectoryPermissionOnCommit (1.37s)
    --- PASS: TestSnapshotterClient/LayerFileupdate (8.69s)
    --- PASS: TestSnapshotterClient/128LayersMount (21.91s)

Copy link
Member

Choose a reason for hiding this comment

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

This should check to make sure the mount is a bind mount before doing the symlink hack.

We should find a better snapshot solution here, what type of block device/file support does runu have here? That and the unpacking are what need to be figured out here to have something closer to a real solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should check to make sure the mount is a bind mount before doing the symlink hack.

Okay, I will add the check before the hack.

We should find a better snapshot solution here, what type of block device/file support does runu have here? That and the unpacking are what need to be figured out here to have something closer to a real solution.

Currently, runu supports two modes for mounting filesystems:

  • a disk image file, formatted with Linux-capable filesystems (ext4, btrfs, etc)
  • 9pfs hosted by server (experimental, running inside runu runtime, still a bit buggy)

So, because applications (with LKL) running over runu mount filesystem by themselves, runtimes (containerd, runu) are required to expose those files or 9pfs server ports to offer file services.

I'm not well understanding what part of unpacking is not a real solution right now.

Copy link
Member

Choose a reason for hiding this comment

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

The unpacking today is done on the host. If the host is unable to mount the snapshot filesystem, then the unpacking will need to be done inside the runtime environment. Using the native snapshotter and simulating bind mounts with symlinks is not a real solution that we would recommend to use, but gets us a test environment.

So I take it from your response that this is using the experimental 9pfs inside the runu runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I got the point of what the native snapshotter is.

A decent snapshotter for darwin would be nice rather than the one of testing purpose, but I would expect this to further contribution because it's not likely to be a trivial component.

Or, is not having a real snapshotter a blocker for this pull request ?

So I take it from your response that this is using the experimental 9pfs inside the runu runtime.

Yes, plus a disk image file unpacked by the snapshotter also can be mounted.

Copy link
Member

Choose a reason for hiding this comment

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

Does the native snapshotter work here? It'll be slower, but it's very simple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the native snapshotter work here? It'll be slower, but it's very simple.

Yes. This PR uses native snapshotter indeed. On darwin there is no bind mount nor nullfs (yes it actually has but depends on fuse/bindfs etc), thus emulates with symlinks.

@thehajime thehajime force-pushed the feature-darwin-runtime branch from 8db7790 to 6bc6efa Compare September 4, 2020 00:58
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@thehajime thehajime force-pushed the feature-darwin-runtime branch from 6bc6efa to a9a3af2 Compare September 4, 2020 01:06
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@thehajime thehajime force-pushed the feature-darwin-runtime branch from a9a3af2 to c3ab5bc Compare September 4, 2020 01:28
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@thehajime thehajime force-pushed the feature-darwin-runtime branch from c3ab5bc to 114d3ca Compare September 4, 2020 01:50
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 4, 2020

Build succeeded.

@thehajime thehajime force-pushed the feature-darwin-runtime branch from 114d3ca to 9948b54 Compare September 11, 2020 05:04
@thehajime
Copy link
Contributor Author

Currently, I'm waiting for a merge containerd/go-runc#64; once it's upstreamed, I'll update this PR too.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 11, 2020

Build succeeded.

@thehajime thehajime marked this pull request as ready for review September 11, 2020 05:18
Copy link
Member

Choose a reason for hiding this comment

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

Should we just exclude this file on darwin? Seems to be a lot cleaner solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the comment.

As I commented at #4526 (comment), there are still valid tests in container_test.go even with darwin and it's worthwhile to have those tests I believe.

Excluding the tests is indeed much cleaner but I'd like to test if it's fine.

@thehajime thehajime force-pushed the feature-darwin-runtime branch 2 times, most recently from e920bbb to d4dfd5b Compare September 24, 2020 04:24
@thehajime
Copy link
Contributor Author

I have (force) pushed the branch to fix several issues.
There is still a blocker of go-runc upstream (containerd/go-runc#65), which should be fixed asap (thus, ../project/script/validate/vendor still reports an error).

@thehajime thehajime force-pushed the feature-darwin-runtime branch from d4dfd5b to dce2648 Compare September 24, 2020 04:31
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 24, 2020

Build succeeded.

@thehajime thehajime force-pushed the feature-darwin-runtime branch from ee24ce0 to dce2648 Compare September 29, 2020 23:20
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 29, 2020

Build succeeded.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 29, 2020

Build succeeded.

@thehajime thehajime force-pushed the feature-darwin-runtime branch from dce2648 to ea87ad8 Compare September 30, 2020 05:58
@theopenlab-ci
Copy link

theopenlab-ci bot commented Sep 30, 2020

Build succeeded.

@AkihiroSuda
Copy link
Member

Though for some reason that doesn't stop #8807 from being merged, what I treat as double standards.

The story is quite different for cimfs (#8807), as it is part of the operating system.

We could probably reach the consensus on merging #8789 if bindfs were part of macOS.

@k8s-ci-robot
Copy link

PR needs rebase.

Details

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/test-infra repository.

@dmcgowan
Copy link
Member

dmcgowan commented Nov 30, 2023

Sparsebundle-based suggested by @thehajime in #5935 might be superior to native snapshotter in terms of performance. But both things got stuck because containerd devs want a pluggable solution that doesn't exist currently.

I don't think the helper binaries with names resolved by the mount type is the right plugin interface to support custom mount types. The goal of a plugin interface is that they would be easy to register and work with other plugins, such as a snapshotter that uses a custom mount type and able to register the custom mount type. Also such a plugin interface needs to worry about lifecycle and device activation which is not relevant for system mount types.

I do think we could have a solution which is less complicated though, we should have support for mounting block devices with natively supported filesystems using hdiutil and bind mounts using bindfs (possibly able to be overwritten via environment but using bindfs cli interface). Currently the helpers just wrap these utilities but I don't see a reason why we can't use them directly in our mount package. Then we can defer the debate/development over custom mount types supported across all OSes.

@github-actions
Copy link

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions bot added the Stale label May 31, 2024
@kjenney
Copy link

kjenney commented May 31, 2024

Up to avoid stale.

@github-actions github-actions bot removed the Stale label Jun 1, 2024
@github-actions
Copy link

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions bot added the Stale label Aug 30, 2024
@9numbernine9
Copy link

Keepalive bump!

@github-actions github-actions bot removed the Stale label Aug 31, 2024
@github-actions
Copy link

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions bot added the Stale label Nov 29, 2024
@xyb
Copy link

xyb commented Nov 29, 2024

ensure this survives the bot

@slonopotamus
Copy link
Contributor

slonopotamus commented Nov 29, 2024

The most important bits of this PR were already merged in #5936. Containerd can run on Darwin.

The key missing part to be usable is lack of bind-mounts. But they are not going to happen because there is no native support. But you can use https://github.com/darwin-containers/containerd with bindfs as a workaround.

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Nov 29, 2024

The key missing part to be usable is lack of bind-mounts. But they are not going to happen because there is no native support.

We couldn't reach consensus on introducing the dependency on macFUSE because it is a third-party kernel extension, but probably it is acceptable to depend on Apple's FSKit

@slonopotamus
Copy link
Contributor

slonopotamus commented Nov 29, 2024

So, I think this PR can be closed. The only useful changes left here are related to tests. But until we have bind-mounts implementation, there's no way to actually run them. And all core changes were already merged.

@github-actions github-actions bot removed the Stale label Nov 30, 2024
@AkihiroSuda
Copy link
Member

@slonopotamus
Copy link
Contributor

slonopotamus commented Jan 10, 2025

Starting with Xcode 15, Apple adds FSKit in betas, and then removes in RC/release. Then adds back in next beta.

@github-actions
Copy link

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions bot added the Stale label Apr 11, 2025
@lelvisl
Copy link

lelvisl commented Apr 11, 2025

mac os 15.4 released, is FSKit available? and what else blocking this PR?

@github-actions github-actions bot removed the Stale label Apr 12, 2025
@github-actions
Copy link

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions bot added the Stale label Jul 11, 2025
@github-actions
Copy link

This PR was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this Jul 18, 2025
@github-project-automation github-project-automation bot moved this from Blocked to Done in Pull Request Review Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Stale status/needs-discussion Needs discussion and decision from maintainers

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.