nodenumaresource

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotFoundCPUTopology          = "node(s) CPU Topology not found"
	ErrInvalidCPUTopology           = "node(s) invalid CPU Topology"
	ErrSMTAlignmentError            = "node(s) requested cpus not multiple cpus per core"
	ErrRequiredFullPCPUsPolicy      = "node(s) required FullPCPUs policy"
	ErrInvalidCPUAmplificationRatio = "node(s) invalid CPU amplification ratio"
	ErrInsufficientAmplifiedCPU     = "Insufficient amplified cpu"
)
View Source
const (
	Name = "NodeNUMAResource"
)

Variables

This section is empty.

Functions

func AllowUseCPUSet added in v1.0.0

func AllowUseCPUSet(pod *corev1.Pod) bool

func GetDefaultNUMAAllocateStrategy added in v0.7.0

func GetDefaultNUMAAllocateStrategy(pluginArgs *schedulingconfig.NodeNUMAResourceArgs) schedulingconfig.NUMAAllocateStrategy

func GetNUMAAllocateStrategy added in v1.4.0

func GetNUMAAllocateStrategy(node *corev1.Node, defaultNUMAtAllocateStrategy schedulingconfig.NUMAAllocateStrategy) schedulingconfig.NUMAAllocateStrategy

func New

func New(args runtime.Object, handle framework.Handle) (framework.Plugin, error)

func NewWithOptions added in v0.7.0

func NewWithOptions(args runtime.Object, handle framework.Handle, opts ...Option) (framework.Plugin, error)

Types

type CPUDetails

type CPUDetails map[int]CPUInfo

CPUDetails is a map from logical CPU ID to CPUInfo.

func NewCPUDetails

func NewCPUDetails() CPUDetails

NewCPUDetails returns CPUDetails instance

func (CPUDetails) CPUs

func (d CPUDetails) CPUs() cpuset.CPUSet

CPUs returns the logical CPU IDs in this CPUDetails.

func (CPUDetails) CPUsInCores

func (d CPUDetails) CPUsInCores(ids ...int) cpuset.CPUSet

CPUsInCores returns the logical CPU IDs associated with the given core IDs in this CPUDetails.

func (CPUDetails) CPUsInNUMANodes

func (d CPUDetails) CPUsInNUMANodes(ids ...int) cpuset.CPUSet

CPUsInNUMANodes returns the logical CPU IDs associated with the given NUMANode IDs in this CPUDetails.

func (CPUDetails) CPUsInSockets

func (d CPUDetails) CPUsInSockets(ids ...int) cpuset.CPUSet

CPUsInSockets returns logical CPU IDs associated with the given socket IDs in this CPUDetails.

func (CPUDetails) Clone

func (d CPUDetails) Clone() CPUDetails

Clone clones the CPUDetails

func (CPUDetails) Cores

func (d CPUDetails) Cores() cpuset.CPUSet

Cores returns the core IDs associated with the CPUs in this CPUDetails.

func (CPUDetails) CoresInNUMANodes

func (d CPUDetails) CoresInNUMANodes(ids ...int) cpuset.CPUSet

CoresInNUMANodes returns the core IDs associated with the given NUMANode IDs in this CPUDetails.

func (CPUDetails) CoresInSockets

func (d CPUDetails) CoresInSockets(ids ...int) cpuset.CPUSet

CoresInSockets returns the core IDs associated with the given socket IDs in this CPUDetails.

func (CPUDetails) KeepOnly

func (d CPUDetails) KeepOnly(cpus cpuset.CPUSet) CPUDetails

KeepOnly returns a new CPUDetails object with only the supplied cpus.

func (CPUDetails) NUMANodes

func (d CPUDetails) NUMANodes() cpuset.CPUSet

NUMANodes returns the NUMANode IDs associated with the CPUs in this CPUDetails.

func (CPUDetails) NUMANodesInSockets

func (d CPUDetails) NUMANodesInSockets(ids ...int) cpuset.CPUSet

NUMANodesInSockets returns the logical NUMANode IDs associated with the given socket IDs in this CPUDetails.

func (CPUDetails) Sockets

func (d CPUDetails) Sockets() cpuset.CPUSet

Sockets returns the socket IDs associated with the CPUs in this CPUDetails.

func (CPUDetails) SocketsInNUMANodes

func (d CPUDetails) SocketsInNUMANodes(ids ...int) cpuset.CPUSet

SocketsInNUMANodes returns the socket IDs associated with the given NUMANode IDs in this CPUDetails.

type CPUInfo

type CPUInfo struct {
	CPUID           int                                 `json:"cpuID"`
	CoreID          int                                 `json:"coreID"`
	NodeID          int                                 `json:"nodeID"`
	SocketID        int                                 `json:"socketID"`
	RefCount        int                                 `json:"refCount"`
	ExclusivePolicy schedulingconfig.CPUExclusivePolicy `json:"exclusivePolicy"`
}

CPUInfo contains the NUMA, socket, and core IDs associated with a CPU.

type CPUTopology

type CPUTopology struct {
	NumCPUs    int        `json:"numCPUs"`
	NumCores   int        `json:"numCores"`
	NumNodes   int        `json:"numNodes"`
	NumSockets int        `json:"numSockets"`
	CPUDetails CPUDetails `json:"cpuDetails"`
}

CPUTopology contains details of node cpu

func (*CPUTopology) CPUsPerCore

func (topo *CPUTopology) CPUsPerCore() int

CPUsPerCore returns the number of logical CPUs are associated with each core.

func (*CPUTopology) CPUsPerNode

func (topo *CPUTopology) CPUsPerNode() int

CPUsPerNode returns the number of logical CPUs are associated with each node.

func (*CPUTopology) CPUsPerSocket

func (topo *CPUTopology) CPUsPerSocket() int

CPUsPerSocket returns the number of logical CPUs are associated with each socket.

func (*CPUTopology) IsValid

func (topo *CPUTopology) IsValid() bool

IsValid checks if the topology is valid

type CPUTopologyBuilder added in v0.7.0

type CPUTopologyBuilder struct {
	// contains filtered or unexported fields
}

func NewCPUTopologyBuilder added in v0.7.0

func NewCPUTopologyBuilder() *CPUTopologyBuilder

func (*CPUTopologyBuilder) AddCPUInfo added in v0.7.0

func (b *CPUTopologyBuilder) AddCPUInfo(socketID, nodeID, coreID, cpuID int) *CPUTopologyBuilder

func (*CPUTopologyBuilder) Result added in v0.7.0

func (b *CPUTopologyBuilder) Result() *CPUTopology

type NUMANodeResource added in v1.4.0

type NUMANodeResource struct {
	Node      int                 `json:"node"`
	Resources corev1.ResourceList `json:"resources,omitempty"`
}

type NodeAllocation added in v1.4.0

type NodeAllocation struct {
	// contains filtered or unexported fields
}

func NewNodeAllocation added in v1.4.0

func NewNodeAllocation(nodeName string) *NodeAllocation

type NodeResponse added in v1.4.0

type NodeResponse struct {
	Name                       string `json:"name,omitempty"`
	TopologyOptions            `json:",inline"`
	RemainingNUMANodeResources []NUMANodeResource `json:"remainingNUMANodeResources"`
	AllocatedNUMANodeResources []NUMANodeResource `json:"allocatedNUMANodeResources"`
	AvailableCPUs              cpuset.CPUSet      `json:"availableCPUs"`
	AllocatedCPUs              CPUDetails         `json:"allocatedCPUs"`
	AllocatedPods              []PodAllocation    `json:"allocatedPods"`
}

type Option added in v0.7.0

type Option func(*pluginOptions)

func WithResourceManager added in v1.4.0

func WithResourceManager(resourceManager ResourceManager) Option

func WithTopologyOptionsManager added in v1.4.0

func WithTopologyOptionsManager(topologyOptionsManager TopologyOptionsManager) Option

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Allocate added in v1.4.0

func (p *Plugin) Allocate(ctx context.Context, cycleState *framework.CycleState, affinity topologymanager.NUMATopologyHint, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) EventsToRegister added in v1.3.0

func (p *Plugin) EventsToRegister() []framework.ClusterEvent

func (*Plugin) Filter

func (p *Plugin) Filter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeInfo *framework.NodeInfo) *framework.Status

func (*Plugin) FilterByNUMANode added in v1.4.0

func (p *Plugin) FilterByNUMANode(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string, policyType apiext.NUMATopologyPolicy, topologyOptions TopologyOptions) *framework.Status

func (*Plugin) FinalRestoreReservation added in v1.3.0

func (p *Plugin) FinalRestoreReservation(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeToStates frameworkext.NodeReservationRestoreStates) *framework.Status

func (*Plugin) GetPodTopologyHints added in v1.4.0

func (p *Plugin) GetPodTopologyHints(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) (map[string][]topologymanager.NUMATopologyHint, *framework.Status)

func (*Plugin) GetResourceManager added in v1.4.0

func (p *Plugin) GetResourceManager() ResourceManager

func (*Plugin) GetTopologyOptionsManager added in v1.4.0

func (p *Plugin) GetTopologyOptionsManager() TopologyOptionsManager

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) PreBind

func (p *Plugin) PreBind(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) PreBindReservation added in v1.2.0

func (p *Plugin) PreBindReservation(ctx context.Context, cycleState *framework.CycleState, reservation *schedulingv1alpha1.Reservation, nodeName string) *framework.Status

func (*Plugin) PreFilter

func (p *Plugin) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod) (*framework.PreFilterResult, *framework.Status)

func (*Plugin) PreFilterExtensions

func (p *Plugin) PreFilterExtensions() framework.PreFilterExtensions

func (*Plugin) PreRestoreReservation added in v1.3.0

func (p *Plugin) PreRestoreReservation(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod) *framework.Status

func (*Plugin) RegisterEndpoints added in v0.7.0

func (p *Plugin) RegisterEndpoints(group *gin.RouterGroup)

func (*Plugin) Reserve

func (p *Plugin) Reserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) *framework.Status

func (*Plugin) RestoreReservation added in v1.3.0

func (p *Plugin) RestoreReservation(ctx context.Context, cycleState *framework.CycleState, podToSchedule *corev1.Pod, matched []*frameworkext.ReservationInfo, unmatched []*frameworkext.ReservationInfo, nodeInfo *framework.NodeInfo) (interface{}, *framework.Status)

func (*Plugin) Score

func (p *Plugin) Score(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string) (int64, *framework.Status)

func (*Plugin) ScoreExtensions

func (p *Plugin) ScoreExtensions() framework.ScoreExtensions

func (*Plugin) Unreserve

func (p *Plugin) Unreserve(ctx context.Context, cycleState *framework.CycleState, pod *corev1.Pod, nodeName string)

type PodAllocation added in v1.4.0

type PodAllocation struct {
	UID                types.UID                           `json:"uid,omitempty"`
	Namespace          string                              `json:"namespace,omitempty"`
	Name               string                              `json:"name,omitempty"`
	CPUSet             cpuset.CPUSet                       `json:"cpuset,omitempty"`
	CPUExclusivePolicy schedulingconfig.CPUExclusivePolicy `json:"cpuExclusivePolicy,omitempty"`
	NUMANodeResources  []NUMANodeResource                  `json:"numaNodeResources,omitempty"`
}

type ResourceManager added in v1.4.0

type ResourceManager interface {
	GetTopologyHints(node *corev1.Node, pod *corev1.Pod, options *ResourceOptions) (map[string][]topologymanager.NUMATopologyHint, error)
	Allocate(node *corev1.Node, pod *corev1.Pod, options *ResourceOptions) (*PodAllocation, error)

	Update(nodeName string, allocation *PodAllocation)
	Release(nodeName string, podUID types.UID)

	GetNodeAllocation(nodeName string) *NodeAllocation
	GetAllocatedCPUSet(nodeName string, podUID types.UID) (cpuset.CPUSet, bool)
	GetAvailableCPUs(nodeName string, preferredCPUs cpuset.CPUSet) (availableCPUs cpuset.CPUSet, allocated CPUDetails, err error)
}

func NewResourceManager added in v1.4.0

func NewResourceManager(
	handle framework.Handle,
	defaultNUMAAllocateStrategy schedulingconfig.NUMAAllocateStrategy,
	topologyOptionsManager TopologyOptionsManager,
) ResourceManager

type ResourceOptions added in v1.4.0

type ResourceOptions struct {
	// contains filtered or unexported fields
}

type TopologyOptions added in v1.4.0

type TopologyOptions struct {
	CPUTopology         *CPUTopology                            `json:"cpuTopology"`
	ReservedCPUs        cpuset.CPUSet                           `json:"reservedCPUs"`
	MaxRefCount         int                                     `json:"maxRefCount"`
	Policy              *extension.KubeletCPUManagerPolicy      `json:"policy,omitempty"`
	NUMATopologyPolicy  extension.NUMATopologyPolicy            `json:"numaTopologyPolicy"`
	NUMANodeResources   []NUMANodeResource                      `json:"numaNodeResources"`
	AmplificationRatios map[corev1.ResourceName]extension.Ratio `json:"amplificationRatios,omitempty"`
}

func NewTopologyOptions added in v1.4.0

func NewTopologyOptions(nrt *nrtv1alpha1.NodeResourceTopology) TopologyOptions

type TopologyOptionsManager added in v1.4.0

type TopologyOptionsManager interface {
	GetTopologyOptions(nodeName string) TopologyOptions
	UpdateTopologyOptions(nodeName string, updateFn func(options *TopologyOptions))
	Delete(nodeName string)
}

TopologyOptionsManager manages the System Topology and resource assignments options.

func NewTopologyOptionsManager added in v1.4.0

func NewTopologyOptionsManager() TopologyOptionsManager

Jump to

Keyboard shortcuts

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