Skip to content

Commit a9a943b

Browse files
committed
Update cgroupsPath to cgroupName and clarify the semantics around that.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
1 parent 7c17452 commit a9a943b

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

runtime-config-linux.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,29 @@ Also known as cgroups, they are used to restrict resource usage for a container
144144
cgroups provide controls to restrict cpu, memory, IO, pids and network for the container.
145145
For more information, see the [kernel cgroups documentation](https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt).
146146

147-
The path to the cgroups can be specified in the Spec via `cgroupsPath`.
148-
`cgroupsPath` is expected to be relative to the cgroups mount point.
149-
If `cgroupsPath` is not specified, implementations can define the default cgroup path.
147+
The name of the cgroups can be specified in the Spec via `cgroupsName`.
148+
Cgroup names mimic filesystem paths closely since they express a hierarchy of cgroups.
149+
`cgroupsName` is expected to be absolute.
150+
An absolute name is one that is defined from the root cgroup `/`.
151+
For example, `/foo/bar` is acceptable. `foo/bar` is not acceptable.
152+
Allowable characters for cgroup names are,
153+
Alpha numeric ([a-zA-Z0-9]+)
154+
Underscores (_)
155+
Dashes (-)
156+
Periods (.)
157+
In general and unless otherwise specified, regular filesystem path rules apply.
158+
159+
If `cgroupsName` is not specified, implementations can choose to use (or not use) any cgroups.
150160
Implementations of the Spec can choose to name cgroups in any manner.
151161
The Spec does not include naming schema for cgroups.
152162
The Spec does not support [split hierarchy](https://www.kernel.org/doc/Documentation/cgroups/unified-hierarchy.txt).
153163
The cgroups will be created if they don't exist.
154164

155165
```json
156-
"cgroupsPath": "/myRuntime/myContainer"
166+
"cgroupsName": "/foo-runtime/bar.container"
157167
```
158168

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

161171
You can configure a container's cgroups via the `resources` field of the Linux configuration.
162172
Do not specify `resources` unless limits have to be updated.

runtime_config_linux.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ type LinuxRuntime struct {
2525
// Resources contain cgroup information for handling resource constraints
2626
// for the container
2727
Resources *Resources `json:"resources"`
28-
// CgroupsPath specifies the path to cgroups that are created and/or joined by the container.
29-
// The path is expected to be relative to the cgroups mountpoint.
30-
// If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
31-
CgroupsPath string `json:"cgroupsPath"`
28+
// CgroupsName specifies the name of to cgroups that are created and/or joined by the container.
29+
// The name is expected to be absolute.
30+
// If resources are specified, the CgroupsName cgroups will be updated based on resources.
31+
CgroupsName string `json:"cgroupsName"`
3232
// Namespaces contains the namespaces that are created and/or joined by the container
3333
Namespaces []Namespace `json:"namespaces"`
3434
// Devices are a list of device nodes that are created and enabled for the container

0 commit comments

Comments
 (0)