Skip to content

Commit

Permalink
Update cgroupsPath to cgroupName and clarify the semantics around that.
Browse files Browse the repository at this point in the history
Signed-off-by: Vishnu kannan <vishnuk@google.com>
  • Loading branch information
vishh committed Dec 28, 2015
1 parent 7c17452 commit a9a943b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
20 changes: 15 additions & 5 deletions runtime-config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,29 @@ Also known as cgroups, they are used to restrict resource usage for a container
cgroups provide controls to restrict cpu, memory, IO, pids and network for the container.
For more information, see the [kernel cgroups documentation](https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt).

The path to the cgroups can be specified in the Spec via `cgroupsPath`.
`cgroupsPath` is expected to be relative to the cgroups mount point.
If `cgroupsPath` is not specified, implementations can define the default cgroup path.
The name of the cgroups can be specified in the Spec via `cgroupsName`.
Cgroup names mimic filesystem paths closely since they express a hierarchy of cgroups.
`cgroupsName` is expected to be absolute.
An absolute name is one that is defined from the root cgroup `/`.
For example, `/foo/bar` is acceptable. `foo/bar` is not acceptable.
Allowable characters for cgroup names are,
Alpha numeric ([a-zA-Z0-9]+)
Underscores (_)
Dashes (-)
Periods (.)
In general and unless otherwise specified, regular filesystem path rules apply.

If `cgroupsName` is not specified, implementations can choose to use (or not use) any cgroups.
Implementations of the Spec can choose to name cgroups in any manner.
The Spec does not include naming schema for cgroups.
The Spec does not support [split hierarchy](https://www.kernel.org/doc/Documentation/cgroups/unified-hierarchy.txt).
The cgroups will be created if they don't exist.

```json
"cgroupsPath": "/myRuntime/myContainer"
"cgroupsName": "/foo-runtime/bar.container"
```

`cgroupsPath` can be used to either control the cgroups hierarchy for containers or to run a new process in an existing container.
`cgroupsName` can be used to either control the cgroups for new containers or to run a new process in an existing container.

You can configure a container's cgroups via the `resources` field of the Linux configuration.
Do not specify `resources` unless limits have to be updated.
Expand Down
8 changes: 4 additions & 4 deletions runtime_config_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ type LinuxRuntime struct {
// Resources contain cgroup information for handling resource constraints
// for the container
Resources *Resources `json:"resources"`
// CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
// The path is expected to be relative to the cgroups mountpoint.
// If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
CgroupsPath string `json:"cgroupsPath"`
// CgroupsName specifies the name of to cgroups that are created and/or joined by the container.
// The name is expected to be absolute.
// If resources are specified, the CgroupsName cgroups will be updated based on resources.
CgroupsName string `json:"cgroupsName"`
// Namespaces contains the namespaces that are created and/or joined by the container
Namespaces []Namespace `json:"namespaces"`
// Devices are a list of device nodes that are created and enabled for the container
Expand Down

0 comments on commit a9a943b

Please sign in to comment.