remove uses of github.com/runc/libcontainer/cgroups#9045
Merged
AkihiroSuda merged 2 commits intocontainerd:mainfrom Sep 1, 2023
Merged
remove uses of github.com/runc/libcontainer/cgroups#9045AkihiroSuda merged 2 commits intocontainerd:mainfrom
AkihiroSuda merged 2 commits intocontainerd:mainfrom
Conversation
runc considers libcontainer to be "unstable" (not for external use), so we try not to use it. Commit ed47d6b brought back the dependency on other parts of libcontainer, but looks to be only depending on a single utility, which in itself was borrowed from github.com/coreos/go-systemd to not introduce CGO code in the same package. This patch copies the version from github.com/coreos/go-systemd (adding proper attribution, although the function is pretty trivial). runc is in process of moving the libcontainer/user package to an external module, which means we can remove the dependency on libcontainer entirely in the near future. There is one more use of `libcontainer` in our vendor tree; it looks like CDI is depending on one utility (devices.DeviceFromPath); https://github.com/containerd/containerd/blob/a943033a8b6d8dd94a171c6e9528ef413b5b22f3/vendor/github.com/container-orchestrated-devices/container-device-interface/pkg/cdi/container-edits_unix.go#L38 We should remove the dependency on that utility, and add a CI check to prevent bringing it back. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This brings over the enhancement from moby/moby@a506630. We don't expect the systemd state to change while containerd is running, so we can use a `sync.Once` for this, to prevent stat'ing each time. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
fuweid
reviewed
Sep 1, 2023
Member
Author
|
This was referenced Sep 1, 2023
AkihiroSuda
reviewed
Sep 1, 2023
| @@ -0,0 +1,58 @@ | |||
| //go:build linux | |||
Member
There was a problem hiding this comment.
The file name should be _linux.go
Member
Author
There was a problem hiding this comment.
Heh, I was considering that, but also knew there were some other PR's being reviewed for "no_systemd" build-tags, so thought I could reduce some churn by using build-tags inside the file, but happy to rename if it's a blocker for you
AkihiroSuda
approved these changes
Sep 1, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
remove uses of github.com/runc/libcontainer/cgroups
runc considers libcontainer to be "unstable" (not for external use),
so we try not to use it. Commit ed47d6b (#8722)
brought back the dependency on other parts of libcontainer, but looks to
be only depending on a single utility, which in itself was borrowed from
github.com/coreos/go-systemd to not introduce CGO code in the same package.
This patch copies the version from github.com/coreos/go-systemd (adding
proper attribution, although the function is pretty trivial).
runc is in process of moving the libcontainer/user package to an external
module, which means we can remove the dependency on libcontainer entirely
in the near future. There is one more use of
libcontainerin our vendortree; it looks like CDI is depending on one utility (devices.DeviceFromPath);
containerd/vendor/github.com/container-orchestrated-devices/container-device-interface/pkg/cdi/container-edits_unix.go
Line 38 in a943033
We should remove the dependency on that utility, and add a CI check to
prevent bringing it back.
pkg/systemd: use sync.Once for systemd detection
This brings over the enhancement from moby/moby@a506630 (moby/moby#41656).
We don't expect the systemd state to change while containerd is running,
so we can use a
sync.Oncefor this, to prevent stat'ing each time.