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

ignition, machine: delegate cpu,io,memory,pid cgroup controllers to machine's non-root users. #13061

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pkg/machine/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ netns="bridge"
`
rootContainers := `[engine]
machine_enabled=true
`

delegateConf := `[Service]
Delegate=memory pids cpu io
`

// Add a fake systemd service to get the user socket rolling
Expand Down Expand Up @@ -280,6 +284,24 @@ machine_enabled=true
Mode: intToPtr(0744),
},
})

// Set delegate.conf so cpu,io subsystem is delegated to non-root users as well for cgroupv2
// by default
files = append(files, File{
Node: Node{
Group: getNodeGrp("root"),
Path: "/etc/systemd/system/[email protected]/delegate.conf",
User: getNodeUsr("root"),
},
FileEmbedded1: FileEmbedded1{
Append: nil,
Contents: Resource{
Source: encodeDataURLPtr(delegateConf),
},
Mode: intToPtr(0644),
},
})

// Add a file into linger
files = append(files, File{
Node: Node{
Expand Down