Documentation ¶
Index ¶
- func PutConfig(config Config, confPath string) (err error)
- type Config
- type LinuxBlockIO
- type LinuxCPU
- type LinuxDeviceCgroup
- type LinuxHugepageLimit
- type LinuxInterfacePriority
- type LinuxMemory
- type LinuxNetwork
- type LinuxPids
- type LinuxRdma
- type LinuxThrottleDevice
- type LinuxWeightDevice
- type Manager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Devices configures the device whitelist. Devices []LinuxDeviceCgroup `toml:"devices" json:"devices,omitempty"` // Memory restriction configuration Memory *LinuxMemory `toml:"memory" json:"memory,omitempty"` // CPU resource restriction configuration CPU *LinuxCPU `toml:"cpu" json:"cpu,omitempty"` // Task resource restriction configuration. Pids *LinuxPids `toml:"pids" json:"pids,omitempty"` // BlockIO restriction configuration BlockIO *LinuxBlockIO `toml:"blockIO" json:"blockIO,omitempty"` // Hugetlb limit (in bytes) HugepageLimits []LinuxHugepageLimit `toml:"hugepageLimits" json:"hugepageLimits,omitempty"` // Network restriction configuration Network *LinuxNetwork `toml:"network" json:"network,omitempty"` // Rdma resource restriction configuration. // Limits are a set of key value pairs that define RDMA resource limits, // where the key is device name and value is resource limits. Rdma map[string]LinuxRdma `toml:"rdma" json:"rdma,omitempty"` }
Config has container runtime resource constraints
func LoadConfig ¶
LoadConfig opens cgroups controls config file and unmarshals it into structures
type LinuxBlockIO ¶
type LinuxBlockIO struct { // Specifies per cgroup weight Weight *uint16 `toml:"weight" json:"weight,omitempty"` // Specifies tasks' weight in the given cgroup while competing with the cgroup's child cgroups, CFQ scheduler only LeafWeight *uint16 `toml:"leafWeight" json:"leafWeight,omitempty"` // Weight per cgroup per device, can override BlkioWeight WeightDevice []LinuxWeightDevice `toml:"weightDevice" json:"weightDevice,omitempty"` // IO read rate limit per cgroup per device, bytes per second ThrottleReadBpsDevice []LinuxThrottleDevice `toml:"throttleReadBpsDevice" json:"throttleReadBpsDevice,omitempty"` // IO write rate limit per cgroup per device, bytes per second ThrottleWriteBpsDevice []LinuxThrottleDevice `toml:"throttleWriteBpsDevice" json:"throttleWriteBpsDevice,omitempty"` // IO read rate limit per cgroup per device, IO per second ThrottleReadIOPSDevice []LinuxThrottleDevice `toml:"throttleReadIOPSDevice" json:"throttleReadIOPSDevice,omitempty"` // IO write rate limit per cgroup per device, IO per second ThrottleWriteIOPSDevice []LinuxThrottleDevice `toml:"throttleWriteIOPSDevice" json:"throttleWriteIOPSDevice,omitempty"` }
LinuxBlockIO for Linux cgroup 'blkio' resource management
type LinuxCPU ¶
type LinuxCPU struct { uint64 `toml:"shares" json:"shares,omitempty"` // CPU hardcap limit (in usecs). Allowed cpu time in a given period. Quota *int64 `toml:"quota" json:"quota,omitempty"` // CPU period to be used for hardcapping (in usecs). Period *uint64 `toml:"period" json:"period,omitempty"` // How much time realtime scheduling may use (in usecs). RealtimeRuntime *int64 `toml:"realtimeRuntime" json:"realtimeRuntime,omitempty"` // CPU period to be used for realtime scheduling (in usecs). RealtimePeriod *uint64 `toml:"realtimePeriod" json:"realtimePeriod,omitempty"` // CPUs to use within the cpuset. Default is to use any CPU available. Cpus string `toml:"cpus" json:"cpus,omitempty"` // List of memory nodes in the cpuset. Default is to use any available memory node. Mems string `toml:"mems" json:"mems,omitempty"` }Shares *
LinuxCPU for Linux cgroup 'cpu' resource management
type LinuxDeviceCgroup ¶
type LinuxDeviceCgroup struct { // Allow or deny Allow bool `toml:"allow" json:"allow" comment:"test"` // Device type, block, char, etc. Type string `toml:"type" json:"type,omitempty"` // Major is the device's major number. Major *int64 `toml:"major" json:"major,omitempty"` // Minor is the device's minor number. Minor *int64 `toml:"minor" json:"minor,omitempty"` // Cgroup access permissions format, rwm. Access string `toml:"access" json:"access,omitempty"` }
LinuxDeviceCgroup represents a device rule for the whitelist controller
type LinuxHugepageLimit ¶
type LinuxHugepageLimit struct { // Pagesize is the hugepage size Pagesize string `toml:"pageSize" json:"pageSize"` // Limit is the limit of "hugepagesize" hugetlb usage Limit uint64 `toml:"limit" json:"limit"` }
LinuxHugepageLimit structure corresponds to limiting kernel hugepages
type LinuxInterfacePriority ¶
type LinuxInterfacePriority struct { // Name is the name of the network interface Name string `toml:"name" json:"name"` // Priority for the interface Priority uint32 `toml:"priority" json:"priority"` }
LinuxInterfacePriority for network interfaces
type LinuxMemory ¶
type LinuxMemory struct { // Memory limit (in bytes). Limit *int64 `toml:"limit" json:"limit,omitempty"` // Memory reservation or soft_limit (in bytes). Reservation *int64 `toml:"reservation" json:"reservation,omitempty"` // Total memory limit (memory + swap). Swap *int64 `toml:"swap" json:"swap,omitempty"` // Kernel memory limit (in bytes). Kernel *int64 `toml:"kernel" json:"kernel,omitempty"` // Kernel memory limit for tcp (in bytes) KernelTCP *int64 `toml:"kernelTCP" json:"kernelTCP,omitempty"` // How aggressive the kernel will swap memory pages. Swappiness *uint64 `toml:"swappiness" json:"swappiness,omitempty"` // DisableOOMKiller disables the OOM killer for out of memory conditions DisableOOMKiller *bool `toml:"disableOOMKiller" json:"disableOOMKiller,omitempty"` }
LinuxMemory for Linux cgroup 'memory' resource management
type LinuxNetwork ¶
type LinuxNetwork struct { // Set class identifier for container's network packets ClassID *uint32 `toml:"classID" json:"classID,omitempty"` // Set priority of network traffic for container Priorities []LinuxInterfacePriority `toml:"priorities" json:"priorities,omitempty"` }
LinuxNetwork identification and priority configuration
type LinuxPids ¶
type LinuxPids struct { // Maximum number of PIDs. Default is "no limit". Limit int64 `toml:"limit" json:"limit"` }
LinuxPids for Linux cgroup 'pids' resource management (Linux 4.3)
type LinuxRdma ¶
type LinuxRdma struct { // Maximum number of HCA handles that can be opened. Default is "no limit". HcaHandles *uint32 `toml:"hcaHandles" json:"hcaHandles,omitempty"` // Maximum number of HCA objects that can be created. Default is "no limit". HcaObjects *uint32 `toml:"hcaObjects" json:"hcaObjects,omitempty"` }
LinuxRdma for Linux cgroup 'rdma' resource management (Linux 4.11)
type LinuxThrottleDevice ¶
type LinuxThrottleDevice struct { // Major is the device's major number. Major int64 `toml:"major" json:"major"` // Minor is the device's minor number. Minor int64 `toml:"minor" json:"minor"` // Rate is the IO rate limit per cgroup per device Rate uint64 `toml:"rate" json:"rate"` }
LinuxThrottleDevice struct holds a `major:minor rate_per_second` pair
type LinuxWeightDevice ¶
type LinuxWeightDevice struct { // Major is the device's major number. Major int64 `toml:"major" json:"major"` // Minor is the device's minor number. Minor int64 `toml:"minor" json:"minor"` // Weight is the bandwidth rate for the device. Weight *uint16 `toml:"weight" json:"weight,omitempty"` // LeafWeight is the bandwidth rate for the device while competing with the cgroup's child cgroups, CFQ scheduler only LeafWeight *uint16 `toml:"leafWeight" json:"leafWeight,omitempty"` }
LinuxWeightDevice struct holds a `major:minor weight` pair for weightDevice
type Manager ¶
Manager manage container cgroup resources restriction
func (*Manager) ApplyFromFile ¶
ApplyFromFile applies cgroups ressources restriction from TOML configuration file
func (*Manager) ApplyFromSpec ¶
func (m *Manager) ApplyFromSpec(spec *specs.LinuxResources) (err error)
ApplyFromSpec applies cgroups ressources restriction from OCI specification