Documentation ¶
Index ¶
- Constants
- func GetNamespacedName(namespace, name string) string
- func GetPodKey(pod *corev1.Pod) (string, error)
- type ActionType
- type AffinityTerm
- type ClusterEvent
- type GVK
- type HostPortInfo
- type ImageStateSummary
- type NodeInfo
- func (n *NodeInfo) AddPod(pod *corev1.Pod)
- func (n *NodeInfo) AddPodInfo(podInfo *PodInfo)
- func (n *NodeInfo) Clone() *NodeInfo
- func (n *NodeInfo) Node() *corev1.Node
- func (n *NodeInfo) RemoveNode()
- func (n *NodeInfo) RemovePod(pod *corev1.Pod) error
- func (n *NodeInfo) SetNode(node *corev1.Node)
- func (n *NodeInfo) String() string
- type NodeInfoLister
- type PodInfo
- type ProtocolPort
- type QueuedPodInfo
- type SharedLister
- type StorageInfoLister
- type WeightedAffinityTerm
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 GetNamespacedName ¶
GetNamespacedName returns the string format of a namespaced resource name.
Types ¶
type ActionType ¶
type ActionType int64
ActionType is an integer to represent one type of resource change. Different ActionTypes can be bit-wised to compose new semantics.
const ( Add ActionType = 1 << iota // 1 Delete // 10 // UpdateNodeXYZ is only applicable for Node events. UpdateNodeAllocatable // 100 UpdateNodeLabel // 1000 UpdateNodeTaint // 10000 UpdateNodeCondition // 100000 All ActionType = 1<<iota - 1 // 111111 // Use the general Update type if you don't either know or care the specific sub-Update type to use. Update = UpdateNodeAllocatable | UpdateNodeLabel | UpdateNodeTaint | UpdateNodeCondition )
Constants for ActionTypes.
type AffinityTerm ¶
type AffinityTerm struct { //nolint:staticcheck // disable `deprecation` check for lifted code. Namespaces sets.String Selector labels.Selector TopologyKey string NamespaceSelector labels.Selector }
AffinityTerm is a processed version of v1.PodAffinityTerm.
type ClusterEvent ¶
type ClusterEvent struct { Resource GVK ActionType ActionType Label string }
ClusterEvent abstracts how a system resource's state gets changed. Resource represents the standard API resources such as Pod, Node, etc. ActionType denotes the specific change such as Add, Update or Delete.
func (ClusterEvent) IsWildCard ¶
func (ce ClusterEvent) IsWildCard() bool
IsWildCard returns true if ClusterEvent follows WildCard semantics
type GVK ¶
type GVK string
GVK is short for group/version/kind, which can uniquely represent a particular API resource.
const ( Pod GVK = "Pod" Node GVK = "Node" PersistentVolume GVK = "PersistentVolume" PersistentVolumeClaim GVK = "PersistentVolumeClaim" StorageClass GVK = "storage.k8s.io/StorageClass" CSINode GVK = "storage.k8s.io/CSINode" CSIDriver GVK = "storage.k8s.io/CSIDriver" CSIStorageCapacity GVK = "storage.k8s.io/CSIStorageCapacity" WildCard GVK = "*" )
Constants for GVKs.
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 { // Pods running on the node. Pods []*PodInfo // The subset of pods with affinity. PodsWithAffinity []*PodInfo // The subset of pods with required anti-affinity. PodsWithRequiredAntiAffinity []*PodInfo // Ports allocated on the node. UsedPorts HostPortInfo // Total requested resources of all pods on this node. This includes assumed // pods, which scheduler has sent for binding, but may not be scheduled yet. Requested *util.Resource // Total requested resources of all pods on this node with a minimum value // applied to each container's CPU and memory requests. This does not reflect // the actual resource requests for this node, but is used to avoid scheduling // many zero-request pods onto one node. NonZeroRequested *util.Resource // We store allocatedResources (which is Node.Status.Allocatable.*) explicitly // as int64, to avoid conversions and accessing map. Allocatable *util.Resource // ImageStates holds the entry of an image if and only if this image is on the node. The entry can be used for // checking an image's existence and advanced usage (e.g., image locality scheduling policy) based on the image // state information. ImageStates map[string]*ImageStateSummary // PVCRefCounts contains a mapping of PVC names to the number of pods on the node using it. // Keys are in the format "namespace/name". PVCRefCounts map[string]int // Whenever NodeInfo changes, generation is bumped. // This is used to avoid cloning it if the object didn't change. Generation int64 // 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) AddPodInfo ¶
AddPodInfo adds pod information to this NodeInfo. Consider using this instead of AddPod if a PodInfo is already computed.
func (*NodeInfo) RemoveNode ¶
func (n *NodeInfo) RemoveNode()
RemoveNode removes the node object, leaving all other tracking information.
type NodeInfoLister ¶
type NodeInfoLister interface { // List returns the list of NodeInfos. List() ([]*NodeInfo, error) // HavePodsWithAffinityList returns the list of NodeInfos of nodes with pods with affinity terms. HavePodsWithAffinityList() ([]*NodeInfo, error) // HavePodsWithRequiredAntiAffinityList returns the list of NodeInfos of nodes with pods with required anti-affinity terms. HavePodsWithRequiredAntiAffinityList() ([]*NodeInfo, error) // Get returns the NodeInfo of the given node name. Get(nodeName string) (*NodeInfo, error) }
NodeInfoLister interface represents anything that can list/get NodeInfo objects from node name.
type PodInfo ¶
type PodInfo struct { Pod *corev1.Pod RequiredAffinityTerms []AffinityTerm RequiredAntiAffinityTerms []AffinityTerm PreferredAffinityTerms []WeightedAffinityTerm PreferredAntiAffinityTerms []WeightedAffinityTerm ParseError error }
PodInfo is a wrapper to a Pod with additional pre-computed information to accelerate processing. This information is typically immutable (e.g., pre-processed inter-pod affinity selectors).
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 QueuedPodInfo ¶
type QueuedPodInfo struct { *PodInfo // The time pod added to the scheduling queue. Timestamp time.Time // Number of schedule attempts before successfully scheduled. // It's used to record the # attempts metric. Attempts int // The time when the pod is added to the queue for the first time. The pod may be added // back to the queue multiple times before it's successfully scheduled. // It shouldn't be updated once initialized. It's used to record the e2e scheduling // latency for a pod. InitialAttemptTimestamp time.Time // If a Pod failed in a scheduling cycle, record the plugin names it failed by. //nolint:staticcheck // disable `deprecation` check for lifted code. UnschedulablePlugins sets.String }
QueuedPodInfo is a Pod wrapper with additional information related to the pod's status in the scheduling queue, such as the timestamp when it's added to the queue.
func (*QueuedPodInfo) DeepCopy ¶
func (pqi *QueuedPodInfo) DeepCopy() *QueuedPodInfo
DeepCopy returns a deep copy of the QueuedPodInfo object.
type StorageInfoLister ¶
type StorageInfoLister interface { // IsPVCUsedByPods returns true/false on whether the PVC is used by one or more scheduled pods, // keyed in the format "namespace/name". IsPVCUsedByPods(key string) bool }
StorageInfoLister interface represents anything that handles storage-related operations and resources.
type WeightedAffinityTerm ¶
type WeightedAffinityTerm struct { AffinityTerm Weight int32 }
WeightedAffinityTerm is a "processed" representation of v1.WeightedAffinityTerm.