noderesourcetopology

package
v0.0.0-...-c2c0533 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrReasonNUMAResourceNotEnough = "node(s) had insufficient resource of NUMA node"
	ErrReasonFailedToGetNRT        = "node(s) failed to get NRT"
)
View Source
const (
	// Name is the name of the plugin used in the plugin registry and configurations.
	Name = "NodeResourceTopologyMatch"
)

Variables

Functions

func GetPodCPUPolicy

func GetPodCPUPolicy(attr map[string]string) string

GetPodCPUPolicy returns the cpu policy of pod, only supports none, exclusive, numa and immovable.

func GetPodNUMANodeResult

func GetPodNUMANodeResult(pod *corev1.Pod) topologyv1alpha1.ZoneList

GetPodNUMANodeResult returns the NUMA node scheduling result of a pod.

func GetPodTargetContainerIndices

func GetPodTargetContainerIndices(pod *corev1.Pod) []int

GetPodTargetContainerIndices returns all pod whose cpus could be allocated.

func GetPodTopologyResult

func GetPodTopologyResult(pod *corev1.Pod) topologyv1alpha1.ZoneList

GetPodTopologyResult returns the Topology scheduling result of a pod.

func GuaranteedCPUs

func GuaranteedCPUs(container *corev1.Container) int

GuaranteedCPUs returns CPUs for guaranteed container.

func IsPodAwareOfTopology

func IsPodAwareOfTopology(attr map[string]string) *bool

IsPodAwareOfTopology returns if the pod needs to be scheduled based on topology awareness.

func New

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

New initializes a new plugin and returns it.

func ResourceListIgnoreZeroResources

func ResourceListIgnoreZeroResources(r *framework.Resource) corev1.ResourceList

ResourceListIgnoreZeroResources returns non-zero ResourceList from a framework.Resource.

Types

type PodTopologyCache

type PodTopologyCache interface {
	AssumePod(pod *corev1.Pod, zone topologyv1alpha1.ZoneList) error
	ForgetPod(pod *corev1.Pod) error
	PodCount() int
	GetPodTopology(pod *corev1.Pod) (topologyv1alpha1.ZoneList, error)
}

PodTopologyCache is a cache which stores the pod topology scheduling result. It is used before the pod bound since the result has not been recorded into annotations yet.

func NewPodTopologyCache

func NewPodTopologyCache(ctx context.Context, ttl time.Duration) PodTopologyCache

NewPodTopologyCache returns a PodTopologyCache.

type TopologyMatch

type TopologyMatch struct {
	PodTopologyCache
	// contains filtered or unexported fields
}

TopologyMatch plugin which run simplified version of TopologyManager's admit handler

func (*TopologyMatch) Filter

func (tm *TopologyMatch) Filter(
	ctx context.Context,
	state *framework.CycleState,
	pod *corev1.Pod,
	nodeInfo *framework.NodeInfo,
) *framework.Status

Filter will check if there exists numa node which has sufficient resource for the pod.

func (*TopologyMatch) Name

func (tm *TopologyMatch) Name() string

Name returns name of the plugin. It is used in logs, etc.

func (*TopologyMatch) PreBind

func (tm *TopologyMatch) PreBind(
	ctx context.Context,
	state *framework.CycleState,
	pod *corev1.Pod,
	nodeName string,
) *framework.Status

PreBind writes pod topology result annotations using the k8s client.

func (*TopologyMatch) PreFilter

func (tm *TopologyMatch) PreFilter(
	ctx context.Context,
	state *framework.CycleState,
	pod *corev1.Pod,
) *framework.Status

PreFilter invoked at the prefilter extension point.

func (*TopologyMatch) PreFilterExtensions

func (tm *TopologyMatch) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions returns prefilter extensions, pod add and remove.

func (*TopologyMatch) Reserve

func (tm *TopologyMatch) Reserve(
	ctx context.Context,
	state *framework.CycleState,
	pod *corev1.Pod,
	nodeName string,
) *framework.Status

Reserve reserves topology of pod and saves status in cycle stateData.

func (*TopologyMatch) Score

func (tm *TopologyMatch) Score(
	ctx context.Context,
	state *framework.CycleState,
	pod *corev1.Pod,
	nodeName string,
) (int64, *framework.Status)

Score invoked at the Score extension point.

func (*TopologyMatch) ScoreExtensions

func (tm *TopologyMatch) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions of the Score plugin.

func (*TopologyMatch) Unreserve

func (tm *TopologyMatch) Unreserve(ctx context.Context, state *framework.CycleState, pod *corev1.Pod, nodeName string)

Unreserve clears assumed Pod topology cache. It's idempotent, and does nothing if no cache found for the given pod.

Jump to

Keyboard shortcuts

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