simulator

package
v0.0.0-...-b990ac8 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildNodeInfoForNode

func BuildNodeInfoForNode(node *kube_api.Node, client *kube_client.Client) (*schedulercache.NodeInfo, error)

BuildNodeInfoForNode build a NodeInfo structure for the given node as if the node was just created.

func CalculateUtilization

func CalculateUtilization(node *kube_api.Node, nodeInfo *schedulercache.NodeInfo) (float64, error)

CalculateUtilization calculates utilization of a node, defined as total amount of requested resources divided by capacity.

func FastGetPodsToMove

func FastGetPodsToMove(nodeInfo *schedulercache.NodeInfo, force bool,
	skipNodesWithSystemPods bool, skipNodesWithLocalStorage bool, decoder runtime.Decoder) ([]*api.Pod, error)

FastGetPodsToMove returns a list of pods that should be moved elsewhere if the node is drained. Raises error if there is an unreplicated pod and force option was not specified. Based on kubectl drain code. It makes an assumption that RC, DS, Jobs and RS were deleted along with their pods (no abandoned pods with dangling created-by annotation). Usefull for fast checks.

func FindNodesToRemove

func FindNodesToRemove(candidates []*kube_api.Node, allNodes []*kube_api.Node, pods []*kube_api.Pod,
	client *kube_client.Client, predicateChecker *PredicateChecker, maxCount int,
	fastCheck bool) ([]*kube_api.Node, error)

FindNodesToRemove finds nodes that can be removed.

func GetRequiredPodsForNode

func GetRequiredPodsForNode(nodename string, client *kube_client.Client) ([]*kube_api.Pod, error)

GetRequiredPodsForNode returns a list od pods that would appear on the node if the node was just created (like deamonset and manifest-run pods). It reuses kubectl drain command to get the list.

Types

type PredicateChecker

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

PredicateChecker checks whether all required predicates are matched for given Pod and Node

func NewPredicateChecker

func NewPredicateChecker(kubeClient *kube_client.Client) (*PredicateChecker, error)

NewPredicateChecker builds PredicateChecker.

func NewTestPredicateChecker

func NewTestPredicateChecker() *PredicateChecker

NewTestPredicateChecker builds test version of PredicateChecker.

func (*PredicateChecker) CheckPredicates

func (p *PredicateChecker) CheckPredicates(pod *kube_api.Pod, nodeInfo *schedulercache.NodeInfo) error

CheckPredicates checks if the given pod can be placed on the given node.

func (*PredicateChecker) FitsAny

func (p *PredicateChecker) FitsAny(pod *kube_api.Pod, nodeInfos map[string]*schedulercache.NodeInfo) (string, error)

FitsAny checks if the given pod can be place on any of the given nodes.

Jump to

Keyboard shortcuts

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