kubernetes: k8s.io/kubernetes/pkg/scheduler/framework/plugins/serviceaffinity Index | Files

package serviceaffinity

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

Index

Package Files

service_affinity.go

Constants

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

func New Uses

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

New initializes a new plugin and returns it.

type ServiceAffinity Uses

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

ServiceAffinity is a plugin that checks service affinity.

func (*ServiceAffinity) AddPod Uses

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 Uses

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 Uses

func (pl *ServiceAffinity) Name() string

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

func (*ServiceAffinity) NormalizeScore Uses

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 Uses

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 Uses

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

PreFilterExtensions returns prefilter extensions, pod add and remove.

func (*ServiceAffinity) RemovePod Uses

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 Uses

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 Uses

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

ScoreExtensions of the Score plugin.

Package serviceaffinity imports 9 packages (graph) and is imported by 3 packages. Updated 2020-07-13. Refresh now. Tools for package owners.