Documentation ¶
Index ¶
- func MakeNodesAndPods(existingPodsNum, allNodesNum int) (existingPods []*v1.Pod, allNodes []*v1.Node)
- func MakeNodesAndPodsForEvenPodsSpread(labels map[string]string, existingPodsNum, allNodesNum, filteredNodesNum int) (existingPods []*v1.Pod, allNodes []*v1.Node, filteredNodes []*v1.Node)
- func MakeNodesAndPodsForPodAffinity(existingPodsNum, allNodesNum int) (existingPods []*v1.Pod, allNodes []*v1.Node)
- func NewFramework(fns []RegisterPluginFunc, opts ...framework.Option) (framework.Framework, error)
- type LabelSelectorWrapper
- func (s *LabelSelectorWrapper) Exists(k string) *LabelSelectorWrapper
- func (s *LabelSelectorWrapper) In(key string, vals []string) *LabelSelectorWrapper
- func (s *LabelSelectorWrapper) Label(k, v string) *LabelSelectorWrapper
- func (s *LabelSelectorWrapper) NotExist(k string) *LabelSelectorWrapper
- func (s *LabelSelectorWrapper) NotIn(key string, vals []string) *LabelSelectorWrapper
- func (s *LabelSelectorWrapper) Obj() *metav1.LabelSelector
- type NodeSelectorWrapper
- type NodeWrapper
- type PodAffinityKind
- type PodWrapper
- func (p *PodWrapper) Container(s string) *PodWrapper
- func (p *PodWrapper) Label(k, v string) *PodWrapper
- func (p *PodWrapper) Name(s string) *PodWrapper
- func (p *PodWrapper) Namespace(s string) *PodWrapper
- func (p *PodWrapper) Node(s string) *PodWrapper
- func (p *PodWrapper) NodeAffinityIn(key string, vals []string) *PodWrapper
- func (p *PodWrapper) NodeAffinityNotIn(key string, vals []string) *PodWrapper
- func (p *PodWrapper) NodeSelector(m map[string]string) *PodWrapper
- func (p *PodWrapper) Obj() *v1.Pod
- func (p *PodWrapper) PodAffinityExists(labelKey, topologyKey string, kind PodAffinityKind) *PodWrapper
- func (p *PodWrapper) PodAntiAffinityExists(labelKey, topologyKey string, kind PodAffinityKind) *PodWrapper
- func (p *PodWrapper) Priority(val int32) *PodWrapper
- func (p *PodWrapper) SpreadConstraint(maxSkew int, tpKey string, mode v1.UnsatisfiableConstraintAction, ...) *PodWrapper
- func (p *PodWrapper) Terminating() *PodWrapper
- func (p *PodWrapper) ZeroTerminationGracePeriod() *PodWrapper
- type RegisterPluginFunc
- func RegisterBindPlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
- func RegisterFilterPlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
- func RegisterPluginAsExtensions(pluginName string, pluginNewFunc framework.PluginFactory, extensions ...string) RegisterPluginFunc
- func RegisterPluginAsExtensionsWithWeight(pluginName string, weight int32, pluginNewFunc framework.PluginFactory, ...) RegisterPluginFunc
- func RegisterPreScorePlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
- func RegisterQueueSortPlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
- func RegisterScorePlugin(pluginName string, pluginNewFunc framework.PluginFactory, weight int32) RegisterPluginFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeNodesAndPods ¶ added in v1.16.0
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 ¶ added in v1.17.0
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 ¶ added in v1.17.0
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.
func NewFramework ¶ added in v1.18.0
NewFramework creates a Framework from the register functions and options.
Types ¶
type LabelSelectorWrapper ¶ added in v1.16.0
type LabelSelectorWrapper struct{ metav1.LabelSelector }
LabelSelectorWrapper wraps a LabelSelector inside.
func MakeLabelSelector ¶ added in v1.16.0
func MakeLabelSelector() *LabelSelectorWrapper
MakeLabelSelector creates a LabelSelector wrapper.
func (*LabelSelectorWrapper) Exists ¶ added in v1.16.0
func (s *LabelSelectorWrapper) Exists(k string) *LabelSelectorWrapper
Exists injects a matchExpression (with an operator Exists) to the inner labelSelector.
func (*LabelSelectorWrapper) In ¶ added in v1.16.0
func (s *LabelSelectorWrapper) In(key string, vals []string) *LabelSelectorWrapper
In injects a matchExpression (with an operator In) to the inner labelSelector.
func (*LabelSelectorWrapper) Label ¶ added in v1.16.0
func (s *LabelSelectorWrapper) Label(k, v string) *LabelSelectorWrapper
Label applies a {k,v} pair to the inner LabelSelector.
func (*LabelSelectorWrapper) NotExist ¶ added in v1.16.0
func (s *LabelSelectorWrapper) NotExist(k string) *LabelSelectorWrapper
NotExist injects a matchExpression (with an operator NotExist) to the inner labelSelector.
func (*LabelSelectorWrapper) NotIn ¶ added in v1.16.0
func (s *LabelSelectorWrapper) NotIn(key string, vals []string) *LabelSelectorWrapper
NotIn injects a matchExpression (with an operator NotIn) to the inner labelSelector.
func (*LabelSelectorWrapper) Obj ¶ added in v1.16.0
func (s *LabelSelectorWrapper) Obj() *metav1.LabelSelector
Obj returns the inner LabelSelector.
type NodeSelectorWrapper ¶ added in v1.16.0
type NodeSelectorWrapper struct{ v1.NodeSelector }
NodeSelectorWrapper wraps a NodeSelector inside.
func MakeNodeSelector ¶ added in v1.16.0
func MakeNodeSelector() *NodeSelectorWrapper
MakeNodeSelector creates a NodeSelector wrapper.
func (*NodeSelectorWrapper) In ¶ added in v1.16.0
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 ¶ added in v1.16.0
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 ¶ added in v1.16.0
func (s *NodeSelectorWrapper) Obj() *v1.NodeSelector
Obj returns the inner NodeSelector.
type NodeWrapper ¶ added in v1.16.0
NodeWrapper wraps a Node inside.
func (*NodeWrapper) Label ¶ added in v1.16.0
func (n *NodeWrapper) Label(k, v string) *NodeWrapper
Label applies a {k,v} label pair to the inner node.
func (*NodeWrapper) Name ¶ added in v1.16.0
func (n *NodeWrapper) Name(s string) *NodeWrapper
Name sets `s` as the name of the inner pod.
func (*NodeWrapper) Obj ¶ added in v1.16.0
func (n *NodeWrapper) Obj() *v1.Node
Obj returns the inner Node.
type PodAffinityKind ¶ added in v1.17.0
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 ¶ added in v1.16.0
PodWrapper wraps a Pod inside.
func (*PodWrapper) Container ¶ added in v1.16.0
func (p *PodWrapper) Container(s string) *PodWrapper
Container appends a container into PodSpec of the inner pod.
func (*PodWrapper) Label ¶ added in v1.16.0
func (p *PodWrapper) Label(k, v string) *PodWrapper
Label sets a {k,v} pair to the inner pod.
func (*PodWrapper) Name ¶ added in v1.16.0
func (p *PodWrapper) Name(s string) *PodWrapper
Name sets `s` as the name of the inner pod.
func (*PodWrapper) Namespace ¶ added in v1.16.0
func (p *PodWrapper) Namespace(s string) *PodWrapper
Namespace sets `s` as the namespace of the inner pod.
func (*PodWrapper) Node ¶ added in v1.16.0
func (p *PodWrapper) Node(s string) *PodWrapper
Node sets `s` as the nodeName of the inner pod.
func (*PodWrapper) NodeAffinityIn ¶ added in v1.16.0
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 ¶ added in v1.16.0
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 ¶ added in v1.16.0
func (p *PodWrapper) NodeSelector(m map[string]string) *PodWrapper
NodeSelector sets `m` as the nodeSelector of the inner pod.
func (*PodWrapper) Obj ¶ added in v1.16.0
func (p *PodWrapper) Obj() *v1.Pod
Obj returns the inner Pod.
func (*PodWrapper) PodAffinityExists ¶ added in v1.17.0
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 ¶ added in v1.17.0
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 ¶ added in v1.16.0
func (p *PodWrapper) Priority(val int32) *PodWrapper
Priority sets a priority value into PodSpec of the inner pod.
func (*PodWrapper) SpreadConstraint ¶ added in v1.16.0
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) Terminating ¶ added in v1.18.0
func (p *PodWrapper) Terminating() *PodWrapper
Terminating sets the inner pod's deletionTimestamp to current timestamp.
func (*PodWrapper) ZeroTerminationGracePeriod ¶ added in v1.16.0
func (p *PodWrapper) ZeroTerminationGracePeriod() *PodWrapper
ZeroTerminationGracePeriod sets the TerminationGracePeriodSeconds of the inner pod to zero.
type RegisterPluginFunc ¶ added in v1.18.0
type RegisterPluginFunc func(reg *framework.Registry, plugins *schedulerapi.Plugins, pluginConfigs []schedulerapi.PluginConfig)
RegisterPluginFunc is a function signature used in method RegisterFilterPlugin() to register a Filter Plugin to a given registry.
func RegisterBindPlugin ¶ added in v1.18.0
func RegisterBindPlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
RegisterBindPlugin returns a function to register a Bind Plugin to a given registry.
func RegisterFilterPlugin ¶ added in v1.18.0
func RegisterFilterPlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
RegisterFilterPlugin returns a function to register a Filter Plugin to a given registry.
func RegisterPluginAsExtensions ¶ added in v1.18.0
func RegisterPluginAsExtensions(pluginName string, pluginNewFunc framework.PluginFactory, extensions ...string) RegisterPluginFunc
RegisterPluginAsExtensions returns a function to register a Plugin as given extensionPoints to a given registry.
func RegisterPluginAsExtensionsWithWeight ¶ added in v1.18.0
func RegisterPluginAsExtensionsWithWeight(pluginName string, weight int32, pluginNewFunc framework.PluginFactory, extensions ...string) RegisterPluginFunc
RegisterPluginAsExtensionsWithWeight returns a function to register a Plugin as given extensionPoints with weight to a given registry.
func RegisterPreScorePlugin ¶ added in v1.18.0
func RegisterPreScorePlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
RegisterPreScorePlugin returns a function to register a Score Plugin to a given registry.
func RegisterQueueSortPlugin ¶ added in v1.18.0
func RegisterQueueSortPlugin(pluginName string, pluginNewFunc framework.PluginFactory) RegisterPluginFunc
RegisterQueueSortPlugin returns a function to register a QueueSort Plugin to a given registry.
func RegisterScorePlugin ¶ added in v1.18.0
func RegisterScorePlugin(pluginName string, pluginNewFunc framework.PluginFactory, weight int32) RegisterPluginFunc
RegisterScorePlugin returns a function to register a Score Plugin to a given registry.