topology

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PolicyBestEffort string = "best-effort"

PolicyBestEffort policy name.

View Source
const PolicyNone string = "none"

PolicyNone policy name.

View Source
const PolicyNumeric string = "numeric"

PolicyNumeric policy name.

View Source
const PolicyRestricted string = "restricted"

PolicyRestricted policy name.

View Source
const PolicySingleNumaNode string = "single-numa-node"

PolicySingleNumaNode policy name.

Variables

This section is empty.

Functions

This section is empty.

Types

type HintProvider

type HintProvider interface {
	// GetTopologyHints returns a map of resource names to a list of possible
	// concrete resource allocations in terms of NUMA locality hints. Each hint
	// is optionally marked "preferred" and indicates the set of NUMA nodes
	// involved in the hypothetical allocation. The topology manager calls
	// this function for each hint provider, and merges the hints to produce
	// a consensus "best" hint. The hint providers may subsequently query the
	// topology manager to influence actual resource assignment.
	GetTopologyHints(pod *v1.Pod, container *v1.Container) map[string][]TopologyHint
	// GetPodTopologyHints returns a map of resource names to a list of possible
	// concrete resource allocations per Pod in terms of NUMA locality hints.
	GetPodTopologyHints(pod *v1.Pod) map[string][]TopologyHint
	// Allocate triggers resource allocation to occur on the HintProvider after
	// all hints have been gathered and the aggregated Hint is available via a
	// call to GetAffinity().
	Allocate(pod *v1.Pod, container *v1.Container) error
}

HintProvider is an interface for components that want to collaborate to achieve globally optimal concrete resource alignment with respect to NUMA locality.

type Manager

type Manager interface {
	Admit(pod *v1.Pod) error

	AddHintProvider(provider HintProvider)

	GetAffinity(podUID string, containerName string, resourceName string) TopologyHint

	RemovePod(podUID string)
}

func NewManager

func NewManager(topology []cadvisorapi.Node, topologyPolicyName string, alignResources []string) (Manager, error)

type Policy

type Policy interface {
	// Returns Policy Name
	Name() string
	// Returns a merged TopologyHint based on input from hint providers
	// and a Pod Admit Handler Response based on hints and policy type
	Merge(providersHints []map[string][]TopologyHint) (map[string]TopologyHint, bool)
}

Policy interface for Topology Manager Pod Admit Result

func NewBestEffortPolicy

func NewBestEffortPolicy(numaNodes []int) Policy

NewBestEffortPolicy returns best-effort policy.

func NewNonePolicy

func NewNonePolicy() Policy

NewNonePolicy returns none policy.

func NewNumericPolicy

func NewNumericPolicy(alignResourceNames []string) Policy

NewNumericPolicy returns numeric policy.

func NewRestrictedPolicy

func NewRestrictedPolicy(numaNodes []int) Policy

NewRestrictedPolicy returns restricted policy.

func NewSingleNumaNodePolicy

func NewSingleNumaNodePolicy(numaNodes []int) Policy

NewSingleNumaNodePolicy returns single-numa-node policy.

type TopologyHint

type TopologyHint struct {
	NUMANodeAffinity bitmask.BitMask
	// Preferred is set to true when the NUMANodeAffinity encodes a preferred
	// allocation for the Container. It is set to false otherwise.
	Preferred bool
}

TopologyHint is a struct containing the NUMANodeAffinity for a Container

func DeepCopyTopologyHints

func DeepCopyTopologyHints(srcHints []TopologyHint) []TopologyHint

DeepCopyTopologyHints returns deep copied hints of source hints

func (*TopologyHint) IsEqual

func (th *TopologyHint) IsEqual(topologyHint TopologyHint) bool

IsEqual checks if TopologyHint are equal

func (*TopologyHint) LessThan

func (th *TopologyHint) LessThan(other TopologyHint) bool

LessThan checks if TopologyHint `a` is less than TopologyHint `b` this means that either `a` is a preferred hint and `b` is not or `a` NUMANodeAffinity attribute is narrower than `b` NUMANodeAffinity attribute.

Jump to

Keyboard shortcuts

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