Documentation ¶
Index ¶
- Constants
- func CreateNodeNameToInfoMap(pods []*v1.Pod, nodes []*v1.Node) map[string]*NodeInfo
- func GetPodKey(pod *v1.Pod) (string, error)
- type HostPortInfo
- type ImageStateSummary
- type NodeInfo
- func (n *NodeInfo) AddPod(pod *v1.Pod)
- func (n *NodeInfo) AllocatableResource() Resource
- func (n *NodeInfo) AllowedPodNumber() int
- func (n *NodeInfo) Clone() *NodeInfo
- func (n *NodeInfo) Filter(pod *v1.Pod) bool
- func (n *NodeInfo) FilterOutPods(pods []*v1.Pod) []*v1.Pod
- func (n *NodeInfo) GetGeneration() int64
- func (n *NodeInfo) ImageStates() map[string]*ImageStateSummary
- func (n *NodeInfo) Node() *v1.Node
- func (n *NodeInfo) NonZeroRequest() Resource
- func (n *NodeInfo) Pods() []*v1.Pod
- func (n *NodeInfo) PodsWithAffinity() []*v1.Pod
- func (n *NodeInfo) RemoveNode(node *v1.Node) error
- func (n *NodeInfo) RemovePod(pod *v1.Pod) error
- func (n *NodeInfo) RequestedResource() Resource
- func (n *NodeInfo) SetAllocatableResource(allocatableResource *Resource)
- func (n *NodeInfo) SetGeneration(newGeneration int64)
- func (n *NodeInfo) SetImageStates(newImageStates map[string]*ImageStateSummary)
- func (n *NodeInfo) SetNode(node *v1.Node) error
- func (n *NodeInfo) SetNonZeroRequest(newResource *Resource)
- func (n *NodeInfo) SetPods(pods []*v1.Pod)
- func (n *NodeInfo) SetRequestedResource(newResource *Resource)
- func (n *NodeInfo) SetTaints(newTaints []v1.Taint)
- func (n *NodeInfo) SetUsedPorts(newUsedPorts HostPortInfo)
- func (n *NodeInfo) String() string
- func (n *NodeInfo) Taints() ([]v1.Taint, error)
- func (n *NodeInfo) UpdateUsedPorts(pod *v1.Pod, add bool)
- func (n *NodeInfo) UsedPorts() HostPortInfo
- func (n *NodeInfo) VolumeLimits() map[v1.ResourceName]int64
- type ProtocolPort
- type Resource
- func (r *Resource) Add(rl v1.ResourceList)
- func (r *Resource) AddScalar(name v1.ResourceName, quantity int64)
- func (r *Resource) Clone() *Resource
- func (r *Resource) ResourceList() v1.ResourceList
- func (r *Resource) SetMaxResource(rl v1.ResourceList)
- func (r *Resource) SetScalar(name v1.ResourceName, quantity int64)
- type Snapshot
- type TransientSchedulerInfo
Constants ¶
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 ¶
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.
Types ¶
type HostPortInfo ¶
type HostPortInfo map[string]map[ProtocolPort]struct{}
HostPortInfo stores mapping from ip to a set of ProtocolPort
func (HostPortInfo) Add ¶
func (h HostPortInfo) Add(ip, protocol string, port int32)
Add adds (ip, protocol, port) to HostPortInfo
func (HostPortInfo) CheckConflict ¶
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 ¶
func (h HostPortInfo) Len() int
Len returns the total number of (ip, protocol, port) tuple in HostPortInfo
func (HostPortInfo) Remove ¶
func (h HostPortInfo) Remove(ip, protocol string, port int32)
Remove removes (ip, protocol, port) from HostPortInfo
type ImageStateSummary ¶
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 ¶
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) AllocatableResource ¶
AllocatableResource returns allocatable resources on a given node.
func (*NodeInfo) AllowedPodNumber ¶
AllowedPodNumber returns the number of the allowed pods on this node.
func (*NodeInfo) Filter ¶
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 ¶
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 ¶
GetGeneration returns the generation on this node.
func (*NodeInfo) ImageStates ¶
func (n *NodeInfo) ImageStates() map[string]*ImageStateSummary
ImageStates returns the state information of all images.
func (*NodeInfo) NonZeroRequest ¶
NonZeroRequest returns aggregated nonzero resource request of pods on this node.
func (*NodeInfo) PodsWithAffinity ¶
PodsWithAffinity return all pods with (anti)affinity constraints on this node.
func (*NodeInfo) RemoveNode ¶
RemoveNode removes the overall information about the node.
func (*NodeInfo) RequestedResource ¶
RequestedResource returns aggregated resource request of pods on this node.
func (*NodeInfo) SetAllocatableResource ¶
SetAllocatableResource sets the allocatableResource information of given node.
func (*NodeInfo) SetGeneration ¶
SetGeneration sets the generation on this node. This is for testing only.
func (*NodeInfo) SetImageStates ¶
func (n *NodeInfo) SetImageStates(newImageStates map[string]*ImageStateSummary)
SetImageStates sets the state information of all images.
func (*NodeInfo) SetNonZeroRequest ¶
SetNonZeroRequest sets the aggregated nonzero resource request of pods on this node.
func (*NodeInfo) SetRequestedResource ¶
SetRequestedResource sets the aggregated resource request of pods on this node.
func (*NodeInfo) SetUsedPorts ¶
func (n *NodeInfo) SetUsedPorts(newUsedPorts HostPortInfo)
SetUsedPorts sets the used ports on this node.
func (*NodeInfo) UpdateUsedPorts ¶
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 ¶
ProtocolPort represents a protocol port pair, e.g. tcp:80.
func NewProtocolPort ¶
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) 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.
type Snapshot ¶
type Snapshot struct { // NodeInfoMap a map of node name to a snapshot of its NodeInfo. NodeInfoMap map[string]*NodeInfo // NodeInfoList is the list of nodes as ordered in the cache's nodeTree. NodeInfoList []*NodeInfo Generation int64 }
Snapshot is a snapshot of cache NodeInfo and NodeTree order. The scheduler takes a snapshot at the beginning of each scheduling cycle and uses it for its operations in that cycle.
func NewSnapshot ¶
func NewSnapshot() *Snapshot
NewSnapshot initializes a Snapshot struct and returns it.
type TransientSchedulerInfo ¶
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 ¶
func NewTransientSchedulerInfo() *TransientSchedulerInfo
NewTransientSchedulerInfo returns a new scheduler transient structure with initialized values.
func (*TransientSchedulerInfo) ResetTransientSchedulerInfo ¶
func (transientSchedInfo *TransientSchedulerInfo) ResetTransientSchedulerInfo()
ResetTransientSchedulerInfo resets the TransientSchedulerInfo.