serviceaffinity

package
v1.20.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Name is the name of the plugin used in the plugin registry and configurations.
	Name = "ServiceAffinity"

	// ErrReason is used for CheckServiceAffinity predicate error.
	ErrReason = "node(s) didn't match service affinity"
)

Variables

This section is empty.

Functions

func New

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

New initializes a new plugin and returns it.

Types

type ServiceAffinity

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

ServiceAffinity is a plugin that checks service affinity.

func (*ServiceAffinity) AddPod added in v1.18.0

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

AddPod from pre-computed data in cycleState.

func (*ServiceAffinity) Filter

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

Filter matches nodes in such a way to force that ServiceAffinity.labels are homogeneous for pods that are scheduled to a node. (i.e. it returns true IFF this pod can be added to this node such that all other pods in the same service are running on nodes with the exact same ServiceAffinity.label values).

For example: If the first pod of a service was scheduled to a node with label "region=foo", all the other subsequent pods belong to the same service will be schedule on nodes with the same "region=foo" label.

Details:

If (the svc affinity labels are not a subset of pod's label selectors )

The pod has all information necessary to check affinity, the pod's label selector is sufficient to calculate
the match.

Otherwise:

Create an "implicit selector" which guarantees pods will land on nodes with similar values
for the affinity labels.

To do this, we "reverse engineer" a selector by introspecting existing pods running under the same service+namespace.
These backfilled labels in the selector "L" are defined like so:
	- L is a label that the ServiceAffinity object needs as a matching constraint.
	- L is not defined in the pod itself already.
	- and SOME pod, from a service, in the same namespace, ALREADY scheduled onto a node, has a matching value.

func (*ServiceAffinity) Name

func (pl *ServiceAffinity) Name() string

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

func (*ServiceAffinity) NormalizeScore

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

NormalizeScore invoked after scoring all nodes.

func (*ServiceAffinity) PreFilter added in v1.18.0

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

PreFilter invoked at the prefilter extension point.

func (*ServiceAffinity) PreFilterExtensions added in v1.18.0

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

PreFilterExtensions returns prefilter extensions, pod add and remove.

func (*ServiceAffinity) RemovePod added in v1.18.0

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

RemovePod from pre-computed data in cycleState.

func (*ServiceAffinity) Score

func (pl *ServiceAffinity) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status)

Score invoked at the Score extension point.

func (*ServiceAffinity) ScoreExtensions

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

ScoreExtensions of the Score plugin.

Jump to

Keyboard shortcuts

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