Documentation ¶
Index ¶
Constants ¶
const ( // ExportedResources is the basename of the file container resources are exported to. ExportedResources = "resources.sh" ExportSharedCPUs = "SHARED_CPUS" // ExportIsolatedCPUs is the shell variable used to export isolated container CPUs. ExportIsolatedCPUs = "ISOLATED_CPUS" // ExportExclusiveCPUs is the shell variable used to export exclusive container CPUs. ExportExclusiveCPUs = "EXCLUSIVE_CPUS" )
const (
// NullPolicy is the reserved name for disabling policy altogether.
NullPolicy = "null"
)
Variables ¶
This section is empty.
Functions ¶
func ActivePolicy ¶
func ActivePolicy() string
ActivePolicy returns the name of the policy to be activated.
func ConstraintToString ¶
func ConstraintToString(value Constraint) string
ConstraintToString returns the given constraint as a string.
Types ¶
type Backend ¶
type Backend interface { // Name gets the well-known name of this policy. Name() string // Description gives a verbose description about the policy implementation. Description() string // Start up and sycnhronizes the policy, using the given cache and resource constraints. Start([]cache.Container, []cache.Container) error // Sync synchronizes the policy, allocating/releasing the given containers. Sync([]cache.Container, []cache.Container) error // AllocateResources allocates resources to/for a container. AllocateResources(cache.Container) error // ReleaseResources release resources of a container. ReleaseResources(cache.Container) error // UpdateResources updates resource allocations of a container. UpdateResources(cache.Container) error // Rebalance tries an optimal allocation of resources for the current container. Rebalance() (bool, error) // ExportResourceData provides resource data to export for the container. ExportResourceData(cache.Container) map[string]string }
Backend is the policy (decision making logic) interface exposed by implementations.
A backends operates in a set of policy domains. Currently each policy domain corresponds to some particular hardware resource (CPU, memory, cache, etc).
type BackendOptions ¶
type BackendOptions struct { // System provides system/HW/topology information System *system.System // System state/cache Cache cache.Cache // Resource availibility constraint Available ConstraintSet // Resource reservation constraint Reserved ConstraintSet // Client interface to cri-resmgr agent AgentCli agent.Interface }
BackendOptions describes the options for a policy backend instance
type Constraint ¶
type Constraint interface{}
Constraint describes constraint of one hardware domain
type ConstraintSet ¶
type ConstraintSet map[Domain]Constraint
ConstraintSet describes, per hardware domain, the resources available for a policy.
func (ConstraintSet) MarshalJSON ¶
func (cs ConstraintSet) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON marshalling for ConstraintSets.
func (*ConstraintSet) String ¶
func (cs *ConstraintSet) String() string
func (*ConstraintSet) UnmarshalJSON ¶
func (cs *ConstraintSet) UnmarshalJSON(raw []byte) error
UnmarshalJSON implements JSON unmarshalling for ConstraintSets.
type CreateFn ¶
type CreateFn func(*BackendOptions) Backend
CreateFn is the type for functions used to create a policy instance.
type Domain ¶
type Domain string
Domain represents a hardware resource domain that can be policied by a backend.
const ( // DomainCPU is the CPU resource domain. DomainCPU Domain = "CPU" // DomainMemory is the memory resource domain. DomainMemory Domain = "Memory" // DomainHugePage is the hugepages resource domain. DomainHugePage Domain = "HugePages" // DomainCache is the CPU cache resource domain. DomainCache Domain = "Cache" // DomainMemoryBW is the memory resource bandwidth. DomainMemoryBW Domain = "MBW" )
type Policy ¶
type Policy interface { // Start starts up policy, prepare for serving resource management requests. Start([]cache.Container, []cache.Container) error // Sync synchronizes the state of the active policy. Sync([]cache.Container, []cache.Container) error // AlocateResources allocates resources to a container. AllocateResources(cache.Container) error // ReleaseResources releases resources of a container. ReleaseResources(cache.Container) error // UpdateResources updates resource allocations of a container. UpdateResources(cache.Container) error // Rebalance tries to find an optimal allocation of resources for the current containers. Rebalance() (bool, error) // ExportResourceData exports/updates resource data for the container. ExportResourceData(cache.Container) }
Policy is the exposed interface for container resource allocations decision making.