Skip to content

Commit

Permalink
Merge pull request #115 from rhatdan/version
Browse files Browse the repository at this point in the history
Add support for cgroups configuration
  • Loading branch information
TomSweeneyRedHat authored Apr 13, 2020
2 parents 93df73b + 475398c commit d6d7acf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/containers.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ The default profile name is "container-default".
`private` Create private Cgroup Namespace for the container.
`host` Share host Cgroup Namespace with the container.

**cgroups**="enabled"
Determines whether the container will create CGroups.
Options are:
`enabled` Enable cgroup support within container
`disabled` Disable cgroup support, will inherit cgroups from parent
`no-conmon` Container engine runs run without conmon

**default_capabilities**=[]
List of default capabilities for containers.

Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ type ContainersConfig struct {
// Default way to create a cgroup namespace for the container
CgroupNS string `toml:"cgroupns"`

// Default cgroup configuration
Cgroups string `toml:"cgroups"`

// Capabilities to add to all containers.
DefaultCapabilities []string `toml:"default_capabilities"`

Expand Down
9 changes: 9 additions & 0 deletions pkg/config/containers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
#
# cgroupns = "private"

# Control container cgroup configuration
# Determines whether the container will create CGroups.
# Options are:
# `enabled` Enable cgroup support within container
# `disabled` Disable cgroup support, will inherit cgroups from parent
# `no-conmon` Container engine runs run without conmon
#
# cgroups = "enabled"

# List of default capabilities for containers. If it is empty or commented out,
# the default capabilities defined in the container engine will be added.
#
Expand Down
6 changes: 6 additions & 0 deletions pkg/config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func DefaultConfig() (*Config, error) {
Annotations: []string{},
ApparmorProfile: DefaultApparmorProfile,
CgroupNS: "private",
Cgroups: "enabled",
DefaultCapabilities: DefaultCapabilities,
DefaultSysctls: []string{},
DefaultUlimits: getDefaultProcessLimits(),
Expand Down Expand Up @@ -439,6 +440,11 @@ func (c *Config) CgroupNS() string {
return c.Containers.CgroupNS
}

// Cgroups returns whether to containers with cgroup confinement
func (c *Config) Cgroups() string {
return c.Containers.Cgroups
}

// UTSNS returns the default UTS Namespace configuration to run containers with
func (c *Config) UTSNS() string {
return c.Containers.UTSNS
Expand Down

0 comments on commit d6d7acf

Please sign in to comment.