Skip to content

Mount /sys/fs/cgroup as cgroup2 type if supported - #9094

Merged
taylorsilva merged 1 commit into
concourse:masterfrom
mariash:cgroup2-mount
Mar 6, 2025
Merged

taylorsilva merged 1 commit into
concourse:masterfrom
mariash:cgroup2-mount

Conversation

@mariash

@mariash mariash commented Mar 5, 2025 •

Copy link
Copy Markdown
Contributor

Changes proposed by this PR

Closes #9063

Concourse is failing to run on systems that only support cgroup v2 since it is trying to mount /sys/fs/cgroup into container as "cgroup" type. For cgroups v2 it should be "cgroup2" type. Use "cgroups.IsCgroup2UnifiedMode()" method to determine if system supports cgroups v2 and if it is then mount it inside of container.

Notes to reviewer

IsCgroup2UnifiedMode method is memoizing the cgroup mode.

Release Note

  • Enable cgroupv2 support for the Guardian runtime by mounting /sys/fs/cgroup as cgroup2 type if supported. Requires Garden v1.67.0 or greater

@mariash
mariash requested a review from a team March 5, 2025 00:27
@taylorsilva

Copy link
Copy Markdown
Member

@taylorsilva

Copy link
Copy Markdown
Member

Looks like unit tests flaked. Running again for you.

@taylorsilva

Copy link
Copy Markdown
Member

This all relies on a certain version of Garden, correct? Anything >= 1.67.0?

@taylorsilva

Copy link
Copy Markdown
Member

Updated OP to state that this PR closes #9063
Maria, please update if this is incorrect.

@taylorsilva taylorsilva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - Please sign-off your commits and then I can merge this.

@mariash

mariash commented Mar 6, 2025

Copy link
Copy Markdown
Contributor Author

@taylorsilva I signed off the commit. Yes, it needs garden 1.67.0 Thank you!

@taylorsilva
taylorsilva merged commit 8503568 into concourse:master Mar 6, 2025
@aliculPix4D

Copy link
Copy Markdown
Contributor

@taylorsilva FYI after this PR, we can't build concourse worker binaries on darwin and windows anymore

  1. windows
+ CGO=0 GOOS=windows GOARCH=amd64 go build -o concourse/bin/concourse.exe -ldflags '-X github.com/concourse/concourse.Version=((redacted))' ./cmd/concourse
# github.com/opencontainers/runc/libcontainer/devices
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/devices/device.go:173:9: undefined: mkDev
# github.com/opencontainers/runc/libcontainer/utils
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:35:21: undefined: unix.CmsgSpace
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:45:29: undefined: unix.Recvmsg
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:45:66: undefined: unix.MSG_CMSG_CLOEXEC
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:56:20: undefined: unix.ParseSocketControlMessage
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:73:13: undefined: unix.Close
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:78:30: undefined: unix.SCM_RIGHTS
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:79:24: undefined: unix.ParseUnixRights
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:117:14: undefined: unix.UnixRights
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:118:14: undefined: unix.Sendmsg
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils.go:19:29: undefined: unix.WaitStatus
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:118:14: too many errors
  1. darwin
+ CGO=0 GOOS=darwin GOARCH=arm64 go build -o concourse/bin/concourse -ldflags '-X github.com/concourse/concourse.Version=((redacted))' ./cmd/concourse
# github.com/opencontainers/runc/libcontainer/utils
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/cmsg.go:45:66: undefined: unix.MSG_CMSG_CLOEXEC
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:27:22: undefined: unix.PROC_SUPER_MAGIC
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:47:14: undefined: unix.CloseRange
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:47:56: undefined: unix.CLOSE_RANGE_CLOEXEC
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:105:15: undefined: unix.CloseRange
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:105:58: undefined: unix.CLOSE_RANGE_CLOEXEC
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:152:67: undefined: unix.SOCK_CLOEXEC
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:177:36: undefined: unix.O_PATH
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:232:55: undefined: unix.Gettid
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:245:140: undefined: unix.Gettid
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/utils/utils_unix.go:245:140: too many errors
# github.com/opencontainers/runc/libcontainer/configs
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/configs/config.go:224:15: undefined: LinuxPersonality
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/configs/config.go:234:47: undefined: unix.SchedAttr
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/configs/config.go:277:15: undefined: unix.SchedAttr
/go/pkg/mod/github.com/opencontainers/[email protected]/libcontainer/configs/config.go:278:18: undefined: unix.SizeofSchedAttr

@taylorsilva

taylorsilva commented Mar 7, 2025 •

Copy link
Copy Markdown
Member

Thanks for the heads up. I should add this as a check to the PRs pipeline.

I'll work on a fix.

taylorsilva added a commit that referenced this pull request Mar 7, 2025
We've had a few PR's that are specific to our linux-containerd
implementation: #9017 and #9094

After these PR's folks in the community found that they couldn't compile
Concourse for non-Linux platforms. This commit tries to make it easier
for future contributors to make changes to the containerd-linux runtime
and not accidently break things for non-linux platforms.

Signed-off-by: Taylor Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support cgroups v2 with garden

3 participants