cache

package
v1.13.8-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBindAllHostIP = "0.0.0.0"

DefaultBindAllHostIP defines the default ip address used to bind to all host.

Variables

This section is empty.

Functions

func CreateNodeNameToInfoMap

func CreateNodeNameToInfoMap(pods []*v1.Pod, nodes []*v1.Node) map[string]*NodeInfo

CreateNodeNameToInfoMap obtains a list of pods and pivots that list into a map where the keys are node names and the values are the aggregated information for that node.

func GetPodKey added in v1.13.0

func GetPodKey(pod *v1.Pod) (string, error)

GetPodKey returns the string key of a pod.

Types

type HostPortInfo added in v1.13.0

type HostPortInfo map[string]map[ProtocolPort]struct{}

HostPortInfo stores mapping from ip to a set of ProtocolPort

func (HostPortInfo) Add added in v1.13.0

func (h HostPortInfo) Add(ip, protocol string, port int32)

Add adds (ip, protocol, port) to HostPortInfo

func (HostPortInfo) CheckConflict added in v1.13.0

func (h HostPortInfo) CheckConflict(ip, protocol string, port int32) bool

CheckConflict checks if the input (ip, protocol, port) conflicts with the existing ones in HostPortInfo.

func (HostPortInfo) Len added in v1.13.0

func (h HostPortInfo) Len() int

Len returns the total number of (ip, protocol, port) tuple in HostPortInfo

func (HostPortInfo) Remove added in v1.13.0

func (h HostPortInfo) Remove(ip, protocol string, port int32)

Remove removes (ip, protocol, port) from HostPortInfo

type ImageStateSummary added in v1.12.0

type ImageStateSummary struct {
	// Size of the image
	Size int64
	// Used to track how many nodes have this image
	NumNodes int
}

ImageStateSummary provides summarized information about the state of an image.

type NodeInfo

type NodeInfo struct {

	// TransientInfo holds the information pertaining to a scheduling cycle. This will be destructed at the end of
	// scheduling cycle.
	// TODO: @ravig. Remove this once we have a clear approach for message passing across predicates and priorities.
	TransientInfo *TransientSchedulerInfo
	// contains filtered or unexported fields
}

NodeInfo is node level aggregated information.

func NewNodeInfo

func NewNodeInfo(pods ...*v1.Pod) *NodeInfo

NewNodeInfo returns a ready to use empty NodeInfo object. If any pods are given in arguments, their information will be aggregated in the returned object.

func (*NodeInfo) AddPod

func (n *NodeInfo) AddPod(pod *v1.Pod)

AddPod adds pod information to this NodeInfo.

func (*NodeInfo) AllocatableResource

func (n *NodeInfo) AllocatableResource() Resource

AllocatableResource returns allocatable resources on a given node.

func (*NodeInfo) AllowedPodNumber

func (n *NodeInfo) AllowedPodNumber() int

AllowedPodNumber returns the number of the allowed pods on this node.

func (*NodeInfo) Clone

func (n *NodeInfo) Clone() *NodeInfo

Clone returns a copy of this node.

func (*NodeInfo) DiskPressureCondition

func (n *NodeInfo) DiskPressureCondition() v1.ConditionStatus

DiskPressureCondition returns the disk pressure condition status on this node.

func (*NodeInfo) Filter

func (n *NodeInfo) Filter(pod *v1.Pod) bool

Filter implements PodFilter interface. It returns false only if the pod node name matches NodeInfo.node and the pod is not found in the pods list. Otherwise, returns true.

func (*NodeInfo) FilterOutPods

func (n *NodeInfo) FilterOutPods(pods []*v1.Pod) []*v1.Pod

FilterOutPods receives a list of pods and filters out those whose node names are equal to the node of this NodeInfo, but are not found in the pods of this NodeInfo.

Preemption logic simulates removal of pods on a node by removing them from the corresponding NodeInfo. In order for the simulation to work, we call this method on the pods returned from SchedulerCache, so that predicate functions see only the pods that are not removed from the NodeInfo.

func (*NodeInfo) GetGeneration added in v1.13.0

func (n *NodeInfo) GetGeneration() int64

GetGeneration returns the generation on this node.

func (*NodeInfo) ImageStates added in v1.12.0

func (n *NodeInfo) ImageStates() map[string]*ImageStateSummary

ImageStates returns the state information of all images.

func (*NodeInfo) MemoryPressureCondition

func (n *NodeInfo) MemoryPressureCondition() v1.ConditionStatus

MemoryPressureCondition returns the memory pressure condition status on this node.

func (*NodeInfo) Node

func (n *NodeInfo) Node() *v1.Node

Node returns overall information about this node.

func (*NodeInfo) NonZeroRequest

func (n *NodeInfo) NonZeroRequest() Resource

NonZeroRequest returns aggregated nonzero resource request of pods on this node.

func (*NodeInfo) PIDPressureCondition

func (n *NodeInfo) PIDPressureCondition() v1.ConditionStatus

PIDPressureCondition returns the pid pressure condition status on this node.

func (*NodeInfo) Pods

func (n *NodeInfo) Pods() []*v1.Pod

Pods return all pods scheduled (including assumed to be) on this node.

func (*NodeInfo) PodsWithAffinity

func (n *NodeInfo) PodsWithAffinity() []*v1.Pod

PodsWithAffinity return all pods with (anti)affinity constraints on this node.

func (*NodeInfo) RemoveNode

func (n *NodeInfo) RemoveNode(node *v1.Node) error

RemoveNode removes the overall information about the node.

func (*NodeInfo) RemovePod

func (n *NodeInfo) RemovePod(pod *v1.Pod) error

RemovePod subtracts pod information from this NodeInfo.

func (*NodeInfo) RequestedResource

func (n *NodeInfo) RequestedResource() Resource

RequestedResource returns aggregated resource request of pods on this node.

func (*NodeInfo) SetAllocatableResource

func (n *NodeInfo) SetAllocatableResource(allocatableResource *Resource)

SetAllocatableResource sets the allocatableResource information of given node.

func (*NodeInfo) SetGeneration added in v1.13.0

func (n *NodeInfo) SetGeneration(newGeneration int64)

SetGeneration sets the generation on this node. This is for testing only.

func (*NodeInfo) SetImageStates added in v1.13.0

func (n *NodeInfo) SetImageStates(newImageStates map[string]*ImageStateSummary)

SetImageStates sets the state information of all images.

func (*NodeInfo) SetNode

func (n *NodeInfo) SetNode(node *v1.Node) error

SetNode sets the overall node information.

func (*NodeInfo) SetNonZeroRequest added in v1.13.0

func (n *NodeInfo) SetNonZeroRequest(newResource *Resource)

SetNonZeroRequest sets the aggregated nonzero resource request of pods on this node.

func (*NodeInfo) SetPods added in v1.13.0

func (n *NodeInfo) SetPods(pods []*v1.Pod)

SetPods sets all pods scheduled (including assumed to be) on this node.

func (*NodeInfo) SetRequestedResource added in v1.13.0

func (n *NodeInfo) SetRequestedResource(newResource *Resource)

SetRequestedResource sets the aggregated resource request of pods on this node.

func (*NodeInfo) SetTaints added in v1.13.0

func (n *NodeInfo) SetTaints(newTaints []v1.Taint)

SetTaints sets the taints list on this node.

func (*NodeInfo) SetUsedPorts added in v1.13.0

func (n *NodeInfo) SetUsedPorts(newUsedPorts HostPortInfo)

SetUsedPorts sets the used ports on this node.

func (*NodeInfo) String

func (n *NodeInfo) String() string

String returns representation of human readable format of this NodeInfo.

func (*NodeInfo) Taints

func (n *NodeInfo) Taints() ([]v1.Taint, error)

Taints returns the taints list on this node.

func (*NodeInfo) UpdateUsedPorts added in v1.13.0

func (n *NodeInfo) UpdateUsedPorts(pod *v1.Pod, add bool)

UpdateUsedPorts updates the UsedPorts of NodeInfo.

func (*NodeInfo) UsedPorts

func (n *NodeInfo) UsedPorts() HostPortInfo

UsedPorts returns used ports on this node.

func (*NodeInfo) VolumeLimits

func (n *NodeInfo) VolumeLimits() map[v1.ResourceName]int64

VolumeLimits returns volume limits associated with the node

type ProtocolPort added in v1.13.0

type ProtocolPort struct {
	Protocol string
	Port     int32
}

ProtocolPort represents a protocol port pair, e.g. tcp:80.

func NewProtocolPort added in v1.13.0

func NewProtocolPort(protocol string, port int32) *ProtocolPort

NewProtocolPort creates a ProtocolPort instance.

type Resource

type Resource struct {
	MilliCPU         int64
	Memory           int64
	EphemeralStorage int64
	// We store allowedPodNumber (which is Node.Status.Allocatable.Pods().Value())
	// explicitly as int, to avoid conversions and improve performance.
	AllowedPodNumber int
	// ScalarResources
	ScalarResources map[v1.ResourceName]int64
}

Resource is a collection of compute resource.

func NewResource

func NewResource(rl v1.ResourceList) *Resource

NewResource creates a Resource from ResourceList

func (*Resource) Add

func (r *Resource) Add(rl v1.ResourceList)

Add adds ResourceList into Resource.

func (*Resource) AddScalar

func (r *Resource) AddScalar(name v1.ResourceName, quantity int64)

AddScalar adds a resource by a scalar value of this resource.

func (*Resource) Clone

func (r *Resource) Clone() *Resource

Clone returns a copy of this resource.

func (*Resource) ResourceList

func (r *Resource) ResourceList() v1.ResourceList

ResourceList returns a resource list of this resource.

func (*Resource) SetMaxResource

func (r *Resource) SetMaxResource(rl v1.ResourceList)

SetMaxResource compares with ResourceList and takes max value for each Resource.

func (*Resource) SetScalar

func (r *Resource) SetScalar(name v1.ResourceName, quantity int64)

SetScalar sets a resource by a scalar value of this resource.

type TransientSchedulerInfo added in v1.13.0

type TransientSchedulerInfo struct {
	TransientLock sync.Mutex
	// NodeTransInfo holds the information related to nodeTransientInformation. NodeName is the key here.
	TransNodeInfo nodeTransientInfo
}

TransientSchedulerInfo is a transient structure which is destructed at the end of each scheduling cycle. It consists of items that are valid for a scheduling cycle and is used for message passing across predicates and priorities. Some examples which could be used as fields are number of volumes being used on node, current utilization on node etc. IMPORTANT NOTE: Make sure that each field in this structure is documented along with usage. Expand this structure only when absolutely needed as this data structure will be created and destroyed during every scheduling cycle.

func NewTransientSchedulerInfo added in v1.13.0

func NewTransientSchedulerInfo() *TransientSchedulerInfo

NewTransientSchedulerInfo returns a new scheduler transient structure with initialized values.

func (*TransientSchedulerInfo) ResetTransientSchedulerInfo added in v1.13.0

func (transientSchedInfo *TransientSchedulerInfo) ResetTransientSchedulerInfo()

ResetTransientSchedulerInfo resets the TransientSchedulerInfo.

Jump to

Keyboard shortcuts

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