Add configuration for specifying cgroup manager
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
parent
a7190853b6
commit
edad8f866d
3 changed files with 17 additions and 0 deletions
|
@ -16,6 +16,7 @@ const (
|
|||
pausePath = "/usr/libexec/ocid/pause"
|
||||
seccompProfilePath = "/etc/ocid/seccomp.json"
|
||||
apparmorProfileName = "ocid-default"
|
||||
cgroupManager = "cgroupfs"
|
||||
)
|
||||
|
||||
var commentedConfigTemplate = template.Must(template.New("config").Parse(`
|
||||
|
@ -69,6 +70,10 @@ seccomp_profile = "{{ .SeccompProfile }}"
|
|||
# default for the runtime.
|
||||
apparmor_profile = "{{ .ApparmorProfile }}"
|
||||
|
||||
# cgroup_manager is the cgroup management implementation to be used
|
||||
# for the runtime.
|
||||
cgroup_manager = "{{ .CgroupManager }}"
|
||||
|
||||
# The "ocid.image" table contains settings pertaining to the
|
||||
# management of OCI images.
|
||||
[ocid.image]
|
||||
|
@ -102,6 +107,7 @@ func DefaultConfig() *server.Config {
|
|||
SELinux: selinux.SelinuxEnabled(),
|
||||
SeccompProfile: seccompProfilePath,
|
||||
ApparmorProfile: apparmorProfileName,
|
||||
CgroupManager: cgroupManager,
|
||||
},
|
||||
ImageConfig: server.ImageConfig{
|
||||
Pause: pausePath,
|
||||
|
|
|
@ -63,6 +63,9 @@ func mergeConfig(config *server.Config, ctx *cli.Context) error {
|
|||
if ctx.GlobalIsSet("apparmor-profile") {
|
||||
config.ApparmorProfile = ctx.GlobalString("apparmor-profile")
|
||||
}
|
||||
if ctx.GlobalIsSet("cgroup-manager") {
|
||||
config.CgroupManager = ctx.GlobalString("cgroup-manager")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -150,6 +153,10 @@ func main() {
|
|||
Name: "selinux",
|
||||
Usage: "enable selinux support",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "cgroup-manager",
|
||||
Usage: "cgroup manager (cgroupfs or systemd)",
|
||||
},
|
||||
}
|
||||
|
||||
// remove once https://github.com/urfave/cli/pull/544 lands
|
||||
|
|
|
@ -72,6 +72,10 @@ type RuntimeConfig struct {
|
|||
// ApparmorProfile is the apparmor profile name which is used as the
|
||||
// default for the runtime.
|
||||
ApparmorProfile string `toml:"apparmor_profile"`
|
||||
|
||||
// CgroupManager is the manager implementation name which is used to
|
||||
// handle cgroups for containers.
|
||||
CgroupManager string `toml:"cgroup_manager"`
|
||||
}
|
||||
|
||||
// ImageConfig represents the "ocid.image" TOML config table.
|
||||
|
|
Loading…
Reference in a new issue