kubernetesk8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity Index | Files

package interpodaffinity

import "k8s.io/kubernetes/pkg/scheduler/framework/plugins/interpodaffinity"

Index

Constants

const (

	// ErrReasonExistingAntiAffinityRulesNotMatch is used for ExistingPodsAntiAffinityRulesNotMatch predicate error.
	ErrReasonExistingAntiAffinityRulesNotMatch = "node(s) didn't satisfy existing pods anti-affinity rules"
	// ErrReasonAffinityRulesNotMatch is used for PodAffinityRulesNotMatch predicate error.
	ErrReasonAffinityRulesNotMatch = "node(s) didn't match pod affinity rules"
	// ErrReasonAntiAffinityRulesNotMatch is used for PodAntiAffinityRulesNotMatch predicate error.
	ErrReasonAntiAffinityRulesNotMatch = "node(s) didn't match pod anti-affinity rules"
)
const Name = names.InterPodAffinity

Name is the name of the plugin used in the plugin registry and configurations.

Functions

func GetNamespaceLabelsSnapshot

func GetNamespaceLabelsSnapshot(logger klog.Logger, ns string, nsLister listersv1.NamespaceLister) (nsLabels labels.Set)

GetNamespaceLabelsSnapshot returns a snapshot of the labels associated with the namespace.

func New

New initializes a new plugin and returns it.

Types

type InterPodAffinity

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

InterPodAffinity is a plugin that checks inter pod affinity

func (*InterPodAffinity) AddPod

func (pl *InterPodAffinity) AddPod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *v1.Pod, podInfoToAdd *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status

AddPod from pre-computed data in cycleState.

func (*InterPodAffinity) EventsToRegister

func (pl *InterPodAffinity) EventsToRegister(_ context.Context) ([]framework.ClusterEventWithHint, error)

EventsToRegister returns the possible events that may make a failed Pod schedulable

func (*InterPodAffinity) Filter

func (pl *InterPodAffinity) Filter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status

Filter invoked at the filter extension point. It checks if a pod can be scheduled on the specified node with pod affinity/anti-affinity configuration.

func (*InterPodAffinity) Name

func (pl *InterPodAffinity) Name() string

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

func (*InterPodAffinity) NormalizeScore

func (pl *InterPodAffinity) NormalizeScore(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, scores framework.NodeScoreList) *framework.Status

NormalizeScore normalizes the score for each filteredNode.

func (*InterPodAffinity) PreFilter

func (pl *InterPodAffinity) PreFilter(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod) (*framework.PreFilterResult, *framework.Status)

PreFilter invoked at the prefilter extension point.

func (*InterPodAffinity) PreFilterExtensions

func (pl *InterPodAffinity) PreFilterExtensions() framework.PreFilterExtensions

PreFilterExtensions returns prefilter extensions, pod add and remove.

func (*InterPodAffinity) PreScore

func (pl *InterPodAffinity) PreScore(
	pCtx context.Context,
	cycleState *framework.CycleState,
	pod *v1.Pod,
	nodes []*framework.NodeInfo,
) *framework.Status

PreScore builds and writes cycle state used by Score and NormalizeScore.

func (*InterPodAffinity) RemovePod

func (pl *InterPodAffinity) RemovePod(ctx context.Context, cycleState *framework.CycleState, podToSchedule *v1.Pod, podInfoToRemove *framework.PodInfo, nodeInfo *framework.NodeInfo) *framework.Status

RemovePod from pre-computed data in cycleState.

func (*InterPodAffinity) Score

func (pl *InterPodAffinity) Score(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) (int64, *framework.Status)

Score invoked at the Score extension point. The "score" returned in this function is the sum of weights got from cycleState which have its topologyKey matching with the node's labels. it is normalized later. Note: the returned "score" is positive for pod-affinity, and negative for pod-antiaffinity.

func (*InterPodAffinity) ScoreExtensions

func (pl *InterPodAffinity) ScoreExtensions() framework.ScoreExtensions

ScoreExtensions of the Score plugin.

Source Files

filtering.go plugin.go scoring.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
16 packages
Last checked
3 hours ago

Tools for package owners.