@@ -163,6 +163,13 @@ type Linux struct {
163163 // The path is expected to be relative to the cgroups mountpoint.
164164 // If resources are specified, the cgroups at CgroupsPath will be updated based on resources.
165165 CgroupsPath string `json:"cgroupsPath,omitempty"`
166+ // SystemdCgroup controls whether to enable systemd cgroup support.
167+ SystemdCgroup bool `json:"systemdCgroup,omitempty"`
168+ // SystemdCgroupsPath specifies the transient systemd unit to create for the container and the
169+ // containing slice which hosts the unit. The systemd units directly map to objects in the
170+ // cgroup tree. When these units are activated, they map directly to cgroup paths built from the
171+ // unit names.
172+ SystemdCgroupsPath LinuxSystemdCgroupsPath `json:"systemdCgroupsPath,omitempty"`
166173 // Namespaces contains the namespaces that are created and/or joined by the container
167174 Namespaces []LinuxNamespace `json:"namespaces,omitempty"`
168175 // Devices are a list of device nodes that are created for the container
@@ -184,6 +191,36 @@ type Linux struct {
184191 Personality * LinuxPersonality `json:"personality,omitempty"`
185192}
186193
194+ // LinuxSystemdCgroupsPath specifies the transient systemd unit to create for the container and the
195+ // containing slice which hosts the unit.
196+ type LinuxSystemdCgroupsPath struct {
197+ // Type is the type of the systemd unit.
198+ Type SystemdUnitType `json:"type"`
199+ // ParentSlice specifies the name of the parent slice with type suffix, under which the
200+ // container is placed. Some examples below:
201+ // `-.slice` - the root slice;
202+ // `system.slice` - the default place for all system services;
203+ // `user.slice` - the default place for all user sessions.
204+ ParentSlice string `json:"parentSlice,omitempty"`
205+ // Name is the systemd unit name (without type suffix).
206+ Name string `json:"name,omitempty"`
207+ }
208+
209+ // SystemdUnitType defines the type of the systemd unit.
210+ type SystemdUnitType string
211+
212+ // SystemdUnitType defines the type of the systemd unit.
213+ const (
214+ // Scope is a group of externally created processes.
215+ // Scopes encapsulate processes that are started and stopped by arbitrary processes through the
216+ // fork() function and then registered by systemd at runtime.
217+ Scope SystemdUnitType = "scope"
218+ // Slice is a group of hierarchically organized units.
219+ // Slices do not contain processes, they organize a hierarchy in which scopes and services are
220+ // placed.
221+ Slice SystemdUnitType = "slice"
222+ )
223+
187224// LinuxNamespace is the configuration for a Linux namespace
188225type LinuxNamespace struct {
189226 // Type is the type of namespace
0 commit comments