kubernetes: k8s.io/kubernetes/pkg/scheduler/testing Index | Files

package testing

import "k8s.io/kubernetes/pkg/scheduler/testing"

Index

Package Files

workload_prep.go wrappers.go

func MakeNodesAndPods Uses

func MakeNodesAndPods(existingPodsNum, allNodesNum int) (existingPods []*v1.Pod, allNodes []*v1.Node)

MakeNodesAndPods serves as a testing helper to generate regular Nodes and Pods that don't use any advanced scheduling features.

func MakeNodesAndPodsForEvenPodsSpread Uses

func MakeNodesAndPodsForEvenPodsSpread(labels map[string]string, existingPodsNum, allNodesNum, filteredNodesNum int) (existingPods []*v1.Pod, allNodes []*v1.Node, filteredNodes []*v1.Node)

MakeNodesAndPodsForEvenPodsSpread serves as a testing helper for EvenPodsSpread feature. It builds a fake cluster containing running Pods and Nodes. The size of Pods and Nodes are determined by input arguments. The specs of Pods and Nodes are generated with the following rules: - Each generated node is applied with a unique label: "node: node<i>". - Each generated node is applied with a rotating label: "zone: zone[0-9]". - Depending on the input labels, each generated pod will be applied with

label "key1", "key1,key2", ..., "key1,key2,...,keyN" in a rotating manner.

func MakeNodesAndPodsForPodAffinity Uses

func MakeNodesAndPodsForPodAffinity(existingPodsNum, allNodesNum int) (existingPods []*v1.Pod, allNodes []*v1.Node)

MakeNodesAndPodsForPodAffinity serves as a testing helper for Pod(Anti)Affinity feature. It builds a fake cluster containing running Pods and Nodes. For simplicity, the Nodes will be labelled with "region", "zone" and "node". Nodes[i] will be applied with: - "region": "region" + i%3 - "zone": "zone" + i%10 - "node": "node" + i The Pods will be applied with various combinations of PodAffinity and PodAntiAffinity terms.

type LabelSelectorWrapper Uses

type LabelSelectorWrapper struct{ metav1.LabelSelector }

LabelSelectorWrapper wraps a LabelSelector inside.

func MakeLabelSelector Uses

func MakeLabelSelector() *LabelSelectorWrapper

MakeLabelSelector creates a LabelSelector wrapper.

func (*LabelSelectorWrapper) Exists Uses

func (s *LabelSelectorWrapper) Exists(k string) *LabelSelectorWrapper

Exists injects a matchExpression (with an operator Exists) to the inner labelSelector.

func (*LabelSelectorWrapper) In Uses

func (s *LabelSelectorWrapper) In(key string, vals []string) *LabelSelectorWrapper

In injects a matchExpression (with an operator In) to the inner labelSelector.

func (*LabelSelectorWrapper) Label Uses

func (s *LabelSelectorWrapper) Label(k, v string) *LabelSelectorWrapper

Label applies a {k,v} pair to the inner LabelSelector.

func (*LabelSelectorWrapper) NotExist Uses

func (s *LabelSelectorWrapper) NotExist(k string) *LabelSelectorWrapper

NotExist injects a matchExpression (with an operator NotExist) to the inner labelSelector.

func (*LabelSelectorWrapper) NotIn Uses

func (s *LabelSelectorWrapper) NotIn(key string, vals []string) *LabelSelectorWrapper

NotIn injects a matchExpression (with an operator NotIn) to the inner labelSelector.

func (*LabelSelectorWrapper) Obj Uses

func (s *LabelSelectorWrapper) Obj() *metav1.LabelSelector

Obj returns the inner LabelSelector.

type NodeSelectorWrapper Uses

type NodeSelectorWrapper struct{ v1.NodeSelector }

NodeSelectorWrapper wraps a NodeSelector inside.

func MakeNodeSelector Uses

func MakeNodeSelector() *NodeSelectorWrapper

MakeNodeSelector creates a NodeSelector wrapper.

func (*NodeSelectorWrapper) In Uses

func (s *NodeSelectorWrapper) In(key string, vals []string) *NodeSelectorWrapper

In injects a matchExpression (with an operator IN) as a selectorTerm to the inner nodeSelector. NOTE: appended selecterTerms are ORed.

func (*NodeSelectorWrapper) NotIn Uses

func (s *NodeSelectorWrapper) NotIn(key string, vals []string) *NodeSelectorWrapper

NotIn injects a matchExpression (with an operator NotIn) as a selectorTerm to the inner nodeSelector.

func (*NodeSelectorWrapper) Obj Uses

func (s *NodeSelectorWrapper) Obj() *v1.NodeSelector

Obj returns the inner NodeSelector.

type NodeWrapper Uses

type NodeWrapper struct{ v1.Node }

NodeWrapper wraps a Node inside.

func MakeNode Uses

func MakeNode() *NodeWrapper

MakeNode creates a Node wrapper.

func (*NodeWrapper) Label Uses

func (n *NodeWrapper) Label(k, v string) *NodeWrapper

Label applies a {k,v} label pair to the inner node.

func (*NodeWrapper) Name Uses

func (n *NodeWrapper) Name(s string) *NodeWrapper

Name sets `s` as the name of the inner pod.

func (*NodeWrapper) Obj Uses

func (n *NodeWrapper) Obj() *v1.Node

Obj returns the inner Node.

type PodAffinityKind Uses

type PodAffinityKind int

PodAffinityKind represents different kinds of PodAffinity.

const (
    // NilPodAffinity is a no-op which doesn't apply any PodAffinity.
    NilPodAffinity PodAffinityKind = iota
    // PodAffinityWithRequiredReq applies a HARD requirement to pod.spec.affinity.PodAffinity.
    PodAffinityWithRequiredReq
    // PodAffinityWithPreferredReq applies a SOFT requirement to pod.spec.affinity.PodAffinity.
    PodAffinityWithPreferredReq
    // PodAffinityWithRequiredPreferredReq applies HARD and SOFT requirements to pod.spec.affinity.PodAffinity.
    PodAffinityWithRequiredPreferredReq
    // PodAntiAffinityWithRequiredReq applies a HARD requirement to pod.spec.affinity.PodAntiAffinity.
    PodAntiAffinityWithRequiredReq
    // PodAntiAffinityWithPreferredReq applies a SOFT requirement to pod.spec.affinity.PodAntiAffinity.
    PodAntiAffinityWithPreferredReq
    // PodAntiAffinityWithRequiredPreferredReq applies HARD and SOFT requirements to pod.spec.affinity.PodAntiAffinity.
    PodAntiAffinityWithRequiredPreferredReq
)

type PodWrapper Uses

type PodWrapper struct{ v1.Pod }

PodWrapper wraps a Pod inside.

func MakePod Uses

func MakePod() *PodWrapper

MakePod creates a Pod wrapper.

func (*PodWrapper) Container Uses

func (p *PodWrapper) Container(s string) *PodWrapper

Container appends a container into PodSpec of the inner pod.

func (*PodWrapper) Label Uses

func (p *PodWrapper) Label(k, v string) *PodWrapper

Label sets a {k,v} pair to the inner pod.

func (*PodWrapper) Name Uses

func (p *PodWrapper) Name(s string) *PodWrapper

Name sets `s` as the name of the inner pod.

func (*PodWrapper) Namespace Uses

func (p *PodWrapper) Namespace(s string) *PodWrapper

Namespace sets `s` as the namespace of the inner pod.

func (*PodWrapper) Node Uses

func (p *PodWrapper) Node(s string) *PodWrapper

Node sets `s` as the nodeName of the inner pod.

func (*PodWrapper) NodeAffinityIn Uses

func (p *PodWrapper) NodeAffinityIn(key string, vals []string) *PodWrapper

NodeAffinityIn creates a HARD node affinity (with the operator In) and injects into the inner pod.

func (*PodWrapper) NodeAffinityNotIn Uses

func (p *PodWrapper) NodeAffinityNotIn(key string, vals []string) *PodWrapper

NodeAffinityNotIn creates a HARD node affinity (with the operator NotIn) and injects into the inner pod.

func (*PodWrapper) NodeSelector Uses

func (p *PodWrapper) NodeSelector(m map[string]string) *PodWrapper

NodeSelector sets `m` as the nodeSelector of the inner pod.

func (*PodWrapper) Obj Uses

func (p *PodWrapper) Obj() *v1.Pod

Obj returns the inner Pod.

func (*PodWrapper) PodAffinityExists Uses

func (p *PodWrapper) PodAffinityExists(labelKey, topologyKey string, kind PodAffinityKind) *PodWrapper

PodAffinityExists creates an PodAffinity with the operator "Exists" and injects into the inner pod.

func (*PodWrapper) PodAntiAffinityExists Uses

func (p *PodWrapper) PodAntiAffinityExists(labelKey, topologyKey string, kind PodAffinityKind) *PodWrapper

PodAntiAffinityExists creates an PodAntiAffinity with the operator "Exists" and injects into the inner pod.

func (*PodWrapper) Priority Uses

func (p *PodWrapper) Priority(val int32) *PodWrapper

Priority sets a priority value into PodSpec of the inner pod.

func (*PodWrapper) SpreadConstraint Uses

func (p *PodWrapper) SpreadConstraint(maxSkew int, tpKey string, mode v1.UnsatisfiableConstraintAction, selector *metav1.LabelSelector) *PodWrapper

SpreadConstraint constructs a TopologySpreadConstraint object and injects into the inner pod.

func (*PodWrapper) ZeroTerminationGracePeriod Uses

func (p *PodWrapper) ZeroTerminationGracePeriod() *PodWrapper

ZeroTerminationGracePeriod sets the TerminationGracePeriodSeconds of the inner pod to zero.

Package testing imports 3 packages (graph). Updated 2019-11-06. Refresh now. Tools for package owners.