cgroups

package
v0.0.0-...-04f2983 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2021 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const CgroupKataPrefix = "kata"

prepend a kata specific string to oci cgroup path to form a different cgroup path, thus cAdvisor couldn't find kata containers cgroup path on host to prevent it from grabbing the stats data.

View Source
const DefaultCgroupPath = "/vc"

DefaultCgroupPath runtime-determined location in the cgroups hierarchy.

Variables

This section is empty.

Functions

func DeviceToCgroupDevice

func DeviceToCgroupDevice(device string) (*configs.Device, error)

func DeviceToLinuxDevice

func DeviceToLinuxDevice(device string) (specs.LinuxDeviceCgroup, error)

func IsSystemdCgroup

func IsSystemdCgroup(cgroupPath string) bool

func RenameCgroupPath

func RenameCgroupPath(path string) (string, error)

func SetLogger

func SetLogger(logger *logrus.Entry)

SetLogger sets up a logger for this pkg

func ValidCgroupPath

func ValidCgroupPath(path string, systemdCgroup bool) (string, error)

validCgroupPath returns a valid cgroup path. see https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#cgroups-path

Types

type Config

type Config struct {
	// Cgroups specifies specific cgroup settings for the various subsystems that the container is
	// placed into to limit the resources the container has available
	// If nil, New() will create one.
	Cgroups *configs.Cgroup

	// CgroupPaths contains paths to all the cgroups setup for a container. Key is cgroup subsystem name
	// with the value as the path.
	CgroupPaths map[string]string

	// Resources represents the runtime resource constraints
	Resources specs.LinuxResources

	// CgroupPath is the OCI spec cgroup path
	CgroupPath string
}

type Manager

type Manager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(config *Config) (*Manager, error)

New creates a new CgroupManager

func (*Manager) Add

func (m *Manager) Add(pid int) error

Add pid to cgroups

func (*Manager) AddDevice

func (m *Manager) AddDevice(device string) error

AddDevice adds a device to the device cgroup

func (*Manager) Apply

func (m *Manager) Apply() error

Apply constraints

func (*Manager) Destroy

func (m *Manager) Destroy() error

func (*Manager) GetCgroups

func (m *Manager) GetCgroups() (*configs.Cgroup, error)

func (*Manager) GetPaths

func (m *Manager) GetPaths() map[string]string

func (*Manager) RemoveDevice

func (m *Manager) RemoveDevice(device string) error

RemoceDevice removed a device from the device cgroup

func (*Manager) SetCPUSet

func (m *Manager) SetCPUSet(cpuset, memset string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL