package topologymanager
import "k8s.io/kubernetes/pkg/kubelet/cm/topologymanager"
Index ¶
- Constants
- type HintProvider
- type Manager
- func NewFakeManager() Manager
- func NewManager(topology []cadvisorapi.Node, topologyPolicyName string, topologyScopeName string) (Manager, error)
- type Policy
- func NewBestEffortPolicy(numaNodes []int) Policy
- func NewNonePolicy() Policy
- func NewRestrictedPolicy(numaNodes []int) Policy
- func NewSingleNumaNodePolicy(numaNodes []int) Policy
- type Scope
- type Store
- type TopologyHint
Constants ¶
const PolicyBestEffort string = "best-effort"
PolicyBestEffort policy name.
const PolicyNone string = "none"
PolicyNone policy name.
const PolicyRestricted string = "restricted"
PolicyRestricted policy name.
const PolicySingleNumaNode string = "single-numa-node"
PolicySingleNumaNode policy name.
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 Store.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 { // PodAdmitHandler is implemented by Manager lifecycle.PodAdmitHandler // AddHintProvider adds a hint provider to manager to indicate the hint provider // wants to be consulted with when making topology hints AddHintProvider(HintProvider) // AddContainer adds pod to Manager for tracking AddContainer(pod *v1.Pod, container *v1.Container, containerID string) // RemoveContainer removes pod from Manager tracking RemoveContainer(containerID string) error // Store is the interface for storing pod topology hints Store }
Manager interface provides methods for Kubelet to manage pod topology hints
func NewFakeManager ¶
func NewFakeManager() Manager
NewFakeManager returns an instance of FakeManager
func NewManager ¶
func NewManager(topology []cadvisorapi.Node, topologyPolicyName string, topologyScopeName string) (Manager, error)
NewManager creates a new TopologyManager based on provided policy and scope
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) (TopologyHint, bool) }
Policy interface for Topology Manager Pod Admit Result
func NewBestEffortPolicy ¶
NewBestEffortPolicy returns best-effort policy.
func NewNonePolicy ¶
func NewNonePolicy() Policy
NewNonePolicy returns none policy.
func NewRestrictedPolicy ¶
NewRestrictedPolicy returns restricted policy.
func NewSingleNumaNodePolicy ¶
NewSingleNumaNodePolicy returns single-numa-node policy.
type Scope ¶
type Scope interface { Name() string Admit(pod *v1.Pod) lifecycle.PodAdmitResult // AddHintProvider adds a hint provider to manager to indicate the hint provider // wants to be consoluted with when making topology hints AddHintProvider(h HintProvider) // AddContainer adds pod to Manager for tracking AddContainer(pod *v1.Pod, container *v1.Container, containerID string) // RemoveContainer removes pod from Manager tracking RemoveContainer(containerID string) error // Store is the interface for storing pod topology hints Store }
Scope interface for Topology Manager
func NewContainerScope ¶
NewContainerScope returns a container scope.
func NewPodScope ¶
NewPodScope returns a pod scope.
type Store ¶
type Store interface { GetAffinity(podUID string, containerName string) TopologyHint }
Store interface is to allow Hint Providers to retrieve pod affinity
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 (*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.
Source Files ¶
fake_topology_manager.go policy.go policy_best_effort.go policy_none.go policy_restricted.go policy_single_numa_node.go scope.go scope_container.go scope_pod.go topology_manager.go
Directories ¶
Path | Synopsis |
---|---|
pkg/kubelet/cm/topologymanager/bitmask |
- Version
- v1.21.10
- Published
- Feb 16, 2022
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 4 seconds ago –
Tools for package owners.