Documentation ¶
Index ¶
- Constants
- Variables
- func GetMountDir() string
- func GetV2Dir() string
- func NewFsiMock(files map[string]mockFile) fsiIface
- func ResetBlkioParameters(groupDir string, blockIO BlockIOParameters) error
- func SetBlkioParameters(group string, blockIO BlockIOParameters) error
- func SetMountDir(dir string)
- func SetV2Dir(dir string)
- type BlockIOParameters
- type CgroupID
- type Controller
- type DeviceParameters
- type DeviceRate
- type DeviceRates
- type DeviceWeight
- type DeviceWeights
- type Group
- func (g Group) AddProcesses(pids ...string) error
- func (g Group) AddTasks(pids ...string) error
- func (g Group) Controller() Controller
- func (g Group) GetProcesses() ([]string, error)
- func (g Group) GetTasks() ([]string, error)
- func (g Group) Read(entry string) (string, error)
- func (g Group) Write(entry, format string, args ...interface{}) error
Constants ¶
const ( // Tasks is a cgroup's "tasks" entry. Tasks = "tasks" // Procs is cgroup's "cgroup.procs" entry. Procs = "cgroup.procs" CpuShares = "cpu.shares" // CpuPeriod is the cpu controller's "cpu.cfs_period_us" entry. CpuPeriod = "cpu.cfs_period_us" // CpuQuota is the cpu controller's "cpu.cfs_quota_us" entry. CpuQuota = "cpu.cfs_quota_us" // CpusetCpus is the cpuset controller's cpuset.cpus entry. CpusetCpus = "cpuset.cpus" // CpusetMems is the cpuset controller's cpuset.mems entry. CpusetMems = "cpuset.mems" )
nolint
Variables ¶
var (
// KubeletRoot is the --cgroup-root option the kubelet is running with.
KubeletRoot = ""
)
Functions ¶
func GetMountDir ¶
func GetMountDir() string
GetMountDir returns the common mount point for cgroup v1 controllers.
func NewFsiMock ¶
func NewFsiMock(files map[string]mockFile) fsiIface
func ResetBlkioParameters ¶
func ResetBlkioParameters(groupDir string, blockIO BlockIOParameters) error
ResetBlkioParameters adds new, changes existing and removes missing blockIO parameters in cgroupsDir.
func SetBlkioParameters ¶
func SetBlkioParameters(group string, blockIO BlockIOParameters) error
SetBlkioParameters writes BlockIO parameters to files in cgroups blkio contoller directory.
func SetMountDir ¶
func SetMountDir(dir string)
SetMountDir sets the common mount point for the cgroup v1 controllers.
Types ¶
type BlockIOParameters ¶
type BlockIOParameters struct { Weight int64 WeightDevice DeviceWeights ThrottleReadBpsDevice DeviceRates ThrottleWriteBpsDevice DeviceRates ThrottleReadIOPSDevice DeviceRates ThrottleWriteIOPSDevice DeviceRates }
BlockIOParameters contains cgroups blockio controller parameters.
Effects of Weight and Rate values in SetBlkioParameters(): Value | Effect -------+-------------------------------------------------------------------
-1 | Do not write to cgroups, value is missing. 0 | Write to cgroups, will clear the setting as specified in cgroups blkio interface. other | Write to cgroups, sets the value.
func GetBlkioParameters ¶
func GetBlkioParameters(group string) (BlockIOParameters, error)
GetBlkioParameters returns BlockIO parameters from files in cgroups blkio controller directory.
func NewBlockIOParameters ¶
func NewBlockIOParameters() BlockIOParameters
NewBlockIOParameters creates new BlockIOParameters instance.
type CgroupID ¶
CgroupID implements mapping kernel cgroup IDs to cgroupfs paths with transparent caching.
func NewCgroupID ¶
NewCgroupID creates a new CgroupID map/cache.
type Controller ¶
type Controller int
Controller is our enumerated type for cgroup controllers.
const ( // UnkownController represents a controller of unknown type. UnknownController Controller = iota // blkio cgroup controller. Blkio // cpu cgroup controller. Cpu // cpuacct cgroup controller. Cpuacct // cpuset cgroup controller. Cpuset // devices cgroup controller. Devices // freezer cgroup controller. Freezer // hugetlb cgroup controller. Hugetlb // memory cgroup controller. Memory // net_cls cgroup controller. NetCls // net_prio cgroup controller. NetPrio // per_event cgroup controller. PerfEvent // pids cgroup controller. Pids )
nolint
func (Controller) Group ¶
func (c Controller) Group(group string) Group
Group returns the given group for the controller.
func (Controller) Path ¶
func (c Controller) Path() string
Path returns the absolute path of the given controller.
func (Controller) RelPath ¶
func (c Controller) RelPath() string
RelPath returns the relative path of the given controller.
func (Controller) String ¶
func (c Controller) String() string
String returns the name of the given controller.
type DeviceParameters ¶
DeviceParameters interface provides functions common to DeviceWeights and DeviceRates.
type DeviceRate ¶
DeviceRate contains values for - blkio.throttle.read_bps_device - blkio.throttle.write_bps_device - blkio.throttle.read_iops_device - blkio.throttle.write_iops_device
type DeviceRates ¶
type DeviceRates []DeviceRate
DeviceRates contains throttling rates for devices.
func (*DeviceRates) Append ¶
func (r *DeviceRates) Append(maj, min, val int64)
Append appends (major, minor, value) to DeviceRates slice.
func (*DeviceRates) Update ¶
func (r *DeviceRates) Update(maj, min, val int64)
Update updates device rate in DeviceRates slice, or appends it if not found.
type DeviceWeight ¶
DeviceWeight contains values for - blkio.[io-scheduler].weight
func NewDeviceWeight ¶
func NewDeviceWeight() DeviceWeight
NewDeviceWeight creates new DeviceWeight instance.
type DeviceWeights ¶
type DeviceWeights []DeviceWeight
DeviceWeights contains weights for devices.
func (*DeviceWeights) Append ¶
func (w *DeviceWeights) Append(maj, min, val int64)
Append appends (major, minor, value) to DeviceWeights slice.
func (*DeviceWeights) Update ¶
func (w *DeviceWeights) Update(maj, min, val int64)
Update updates device weight in DeviceWeights slice, or appends it if not found.
type Group ¶
type Group string
Group represents a control group.
func (Group) AddProcesses ¶
AddProcesses writes the given process pids to the group.
func (Group) Controller ¶
func (g Group) Controller() Controller
Controller returns the controller for the group.
func (Group) GetProcesses ¶
GetProcesses reads the pids of processes currently assigned to the group.