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 ( // MemoryResource is the resource name for memory MemoryResource = "memory" // CPUResource is the resource name for CPU CPUResource = "cpu" // MemsetAttribute is the attribute name for assignable memory set MemsetAttribute = "memory set" // CPUsAttribute is the attribute name for the assignable CPU set CPUsAttribute = "cpuset" SharedCPUsAttribute = "shared cpuset" // ReservedCPUsAttribute is the attribute name for assignable the reserved CPU set ReservedCPUsAttribute = "reserved cpuset" // IsolatedCPUsAttribute is the attribute name for the assignable isolated CPU set IsolatedCPUsAttribute = "isolated cpuset" // ExcessCPUsAttribute is the attribute name for CPUs that // have been allocated yet not requested. For instance, // containers in a balloon request 1300 mCPU in total, so at // least 2 CPUs must be allocated to the balloon. This results // in excess 700 mCPUs available for bursting, for instance. ExcessCPUsAttribute = "excess cpus" // ComponentCPUsAttribute lists CPUs of components of a composite balloon ComponentCPUsAttribute = "component cpusets" // Exporting containers as topology subzones ContainerAllocationZoneType = "allocation for container" )
Node resource topology resource and attribute names. XXX TODO(klihub): We'll probably need to add similar unified consts
for resource types (socket, die, NUMA node, etc.) and use them in policies (for instance for TA pool 'kind's)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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
// Setup initializes the policy backend with the given options.
Setup(*BackendOptions) error
// Reconfigure the policy backend.
Reconfigure(interface{}) error
// Start up and sycnhronizes the policy, using the given cache and resource constraints.
Start() 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
// HandleEvent processes the given event. The returned boolean indicates whether
// changes have been made to any of the containers while handling the event.
HandleEvent(*events.Policy) (bool, error)
// ExportResourceData provides resource data to export for the container.
ExportResourceData(cache.Container) map[string]string
// GetTopologyZones returns the policy/pool data for 'topology zone' CRDs.
GetTopologyZones() []*TopologyZone
}
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
// SendEvent is the function for delivering events up to the resource manager.
SendEvent SendEventFn
// Config is the policy-specific configuration.
Config 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.
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 Metrics ¶
type Metrics interface {
Describe(chan<- *prometheus.Desc)
Collect(chan<- prometheus.Metric)
}
Metrics is the interface we expect policy-specific metrics to implement.
type NodeMetric ¶ added in v0.8.0
type Options ¶
type Options struct {
// SendEvent is the function for delivering events back to the resource manager.
SendEvent SendEventFn
}
Options describes policy options
type Policy ¶
type Policy interface {
// ActivePolicy returns the name of the policy backend in use.
ActivePolicy() string
// Start starts up policy, prepare for serving resource management requests.
Start(interface{}) error
// Reconfigure the policy.
Reconfigure(interface{}) error
// Sync synchronizes the state of the active policy.
Sync([]cache.Container, []cache.Container) error
// AllocateResources 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
// HandleEvent passes on the given event to the active policy. The returned boolean
// indicates whether changes have been made to any of the containers while handling
// the event.
HandleEvent(*events.Policy) (bool, error)
// ExportResourceData exports/updates resource data for the container.
ExportResourceData(cache.Container)
// GetTopologyZones returns the policy/pool data for 'topology zone' CRDs.
GetTopologyZones() []*TopologyZone
}
Policy is the exposed interface for container resource allocations decision making.
type SendEventFn ¶
type SendEventFn func(interface{}) error
SendEventFn is the type for a function to send events back to the resource manager.
type SystemCollector ¶ added in v0.8.0
type SystemCollector struct {
Nodes map[int]*NodeMetric
Cpus map[int]*CpuMetric
NodeCapacity metric.Int64Gauge
NodeUsage metric.Int64Gauge
NodeContainers metric.Int64Gauge
CpuAllocation metric.Int64Gauge
CpuContainers metric.Int64Gauge
// contains filtered or unexported fields
}
func (*SystemCollector) Update ¶ added in v0.8.0
func (s *SystemCollector) Update()
type TopologyZone ¶
type TopologyZone struct {
Name string
Parent string
Type string
Resources []*ZoneResource
Attributes []*ZoneAttribute
}
TopologyZone provides policy-/pool-specific data for 'node resource topology' CRs.
type ZoneAttribute ¶
ZoneAttribute represents additional, policy-specific information about a zone.