nodenumaresource

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: Apache-2.0 Imports: 26 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"
)
View Source
const (
	Name = "NodeNUMAResource"
)

Variables

View Source
var (
	GetResourceSpec   = extension.GetResourceSpec
	GetResourceStatus = extension.GetResourceStatus
	SetResourceStatus = extension.SetResourceStatus
	GetPodQoSClass    = extension.GetPodQoSClass
	GetPriorityClass  = extension.GetPriorityClass
	AllowUseCPUSet    = func(pod *corev1.Pod) bool {
		if pod == nil {
			return false
		}
		qosClass := GetPodQoSClass(pod)
		priorityClass := GetPriorityClass(pod)
		return (qosClass == extension.QoSLSE || qosClass == extension.QoSLSR) && priorityClass == extension.PriorityProd
	}
)

Functions

func GetDefaultNUMAAllocateStrategy added in v0.7.0

func GetDefaultNUMAAllocateStrategy(pluginArgs *schedulingconfig.NodeNUMAResourceArgs) 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 AvailableCPUsResponse added in v0.7.0

type AvailableCPUsResponse struct {
	AvailableCPUs cpuset.CPUSet `json:"availableCPUs,omitempty"`
	Allocated     CPUDetails    `json:"allocated,omitempty"`
}

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 CPUManager added in v0.7.0

type CPUManager interface {
	Allocate(
		node *corev1.Node,
		numCPUsNeeded int,
		cpuBindPolicy schedulingconfig.CPUBindPolicy,
		cpuExclusivePolicy schedulingconfig.CPUExclusivePolicy) (cpuset.CPUSet, error)

	UpdateAllocatedCPUSet(nodeName string, podUID types.UID, cpuset cpuset.CPUSet, cpuExclusivePolicy schedulingconfig.CPUExclusivePolicy)

	Free(nodeName string, podUID types.UID)

	Score(
		node *corev1.Node,
		numCPUsNeeded int,
		cpuBindPolicy schedulingconfig.CPUBindPolicy,
		cpuExclusivePolicy schedulingconfig.CPUExclusivePolicy) int64

	GetAvailableCPUs(nodeName string) (availableCPUs cpuset.CPUSet, allocated CPUDetails, err error)
}

func NewCPUManager added in v0.7.0

func NewCPUManager(
	handle framework.Handle,
	defaultNUMAAllocateStrategy schedulingconfig.NUMAAllocateStrategy,
	topologyManager CPUTopologyManager,
) CPUManager

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 CPUTopologyManager added in v0.7.0

type CPUTopologyManager interface {
	GetCPUTopologyOptions(nodeName string) CPUTopologyOptions
	UpdateCPUTopologyOptions(nodeName string, updateFn func(options *CPUTopologyOptions))
	Delete(nodeName string)
}

CPUTopologyManager manages the CPU Topology and CPU assignments options.

func NewCPUTopologyManager added in v0.7.0

func NewCPUTopologyManager() CPUTopologyManager

type CPUTopologyOptions added in v0.7.0

type CPUTopologyOptions struct {
	CPUTopology  *CPUTopology                       `json:"cpuTopology,omitempty"`
	ReservedCPUs cpuset.CPUSet                      `json:"reservedCPUs,omitempty"`
	MaxRefCount  int                                `json:"maxRefCount,omitempty"`
	Policy       *extension.KubeletCPUManagerPolicy `json:"policy,omitempty"`
}

type Option added in v0.7.0

type Option func(*pluginOptions)

func WithCPUManager added in v0.7.0

func WithCPUManager(cpuManager CPUManager) Option

func WithCPUTopologyManager added in v0.7.0

func WithCPUTopologyManager(topologyManager CPUTopologyManager) Option

func WithCustomSyncTopology added in v0.7.0

func WithCustomSyncTopology(customSyncTopology bool) Option

type Plugin

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

func (*Plugin) Filter

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

func (*Plugin) GetCPUManager added in v0.7.0

func (p *Plugin) GetCPUManager() CPUManager

func (*Plugin) GetCPUTopologyManager added in v0.7.0

func (p *Plugin) GetCPUTopologyManager() CPUTopologyManager

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) PreFilter

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

func (*Plugin) PreFilterExtensions

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

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) 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)

Jump to

Keyboard shortcuts

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