Documentation ¶
Index ¶
Constants ¶
const (
CPUPeriod = 1000000 // 1 million microseconds which equals 1 second
)
Variables ¶
var DefaultSubsystemer = &ProcSubsystemer{}
var DefaultSubsystems = Subsystems{
CPU: "/cgroup/cpu",
Memory: "/cgroup/memory",
Prefix: "/cgroup",
}
Functions ¶
func CreatePodCgroup ¶
CreatePodCgroup will set cgroup parameters for the specified pod with podID on hostname. In order for nested cgroups to work correctly, the path used here must match the path used in pkg/servicebuilder
Types ¶
type CgroupID ¶
type CgroupID string
func CgroupIDForLaunchable ¶
func CgroupIDForLaunchable(s Subsystemer, podID types.PodID, nodeName types.NodeName, launchableID string) (*CgroupID, error)
CgroupIDForLaunchable encapsulates the cgroup path for launchable cgroups. launchableID is a string because I am too cowardly to break the import cycle caused by importing `launch` here.
func CgroupIDForPod ¶
CgroupIDForPod encapsulates the cgroup path for pod cgroups. This function should match CgroupIDForLaunchable
type Config ¶
type Config struct { Name CgroupID `yaml:"-"` // The name of the cgroup in cgroupfs CPUs int `yaml:"cpus,omitempty"` // The number of logical CPUs Memory size.ByteCount `yaml:"memory,omitempty"` // The number of bytes of memory }
Config combines an ID and subsystem limits
type ProcSubsystemer ¶
type ProcSubsystemer struct {
CachedSubsystems *Subsystems
}
ProcSubsystemer returns cgroup mountpoints based on the /proc filesystem
func (*ProcSubsystemer) Find ¶
func (ps *ProcSubsystemer) Find() (Subsystems, error)
type Subsystemer ¶
type Subsystemer interface {
Find() (Subsystems, error)
}
Subsystemer is anything that can find a set of Subsystems
type Subsystems ¶
maps cgroup subsystems to their respective paths
func (Subsystems) SetCPU ¶
func (subsys Subsystems) SetCPU(name CgroupID, cpus int) error
SetCPU will set a number of CPU limits in the cgroup specified by the argument. A sentinel value of 0 will create an unrestricted CPU subsystem https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt
func (Subsystems) SetMemory ¶
func (subsys Subsystems) SetMemory(name CgroupID, bytes int) error
SetMemory will set several memory limits in the cgroup specified in the argument. A sentinel value of 0 will create an unrestricted memory subsystem https://www.kernel.org/doc/Documentation/cgroups/memory.txt
func (Subsystems) Write ¶
func (subsys Subsystems) Write(config Config) error
type UnsupportedError ¶
type UnsupportedError string
func (UnsupportedError) Error ¶
func (err UnsupportedError) Error() string