Documentation ¶
Index ¶
- func ConvertToPods(objs []interface{}, filter FilterFunc) []*v1.Pod
- func GroupByNamespace(pods []*v1.Pod) map[string][]*v1.Pod
- func GroupByNodeName(pods []*v1.Pod) map[string][]*v1.Pod
- func IsBestEffortPod(pod *v1.Pod) bool
- func IsBurstablePod(pod *v1.Pod) bool
- func IsGuaranteedPod(pod *v1.Pod) bool
- func ListAllPodsOnANode(nodeName string, getPodsAssignedToNode GetPodsAssignedToNodeFunc, ...) ([]*v1.Pod, error)
- func ListPodsOnANode(nodeName string, getPodsAssignedToNode GetPodsAssignedToNodeFunc, ...) ([]*v1.Pod, error)
- func ListPodsOnNodes(nodes []*v1.Node, getPodsAssignedToNode GetPodsAssignedToNodeFunc, ...) ([]*v1.Pod, error)
- func OwnerRef(pod *v1.Pod) []metav1.OwnerReference
- func OwnerRefUIDs(pod *v1.Pod) []string
- func SortPodsBasedOnAge(pods []*v1.Pod)
- func SortPodsBasedOnPriorityLowToHigh(pods []*v1.Pod)
- type FilterFunc
- type GetPodsAssignedToNodeFunc
- type Options
- func (o *Options) BuildFilterFunc() (FilterFunc, error)
- func (o *Options) WithFilter(filter FilterFunc) *Options
- func (o *Options) WithLabelSelector(labelSelector *metav1.LabelSelector) *Options
- func (o *Options) WithNamespaces(namespaces sets.Set[string]) *Options
- func (o *Options) WithoutNamespaces(namespaces sets.Set[string]) *Options
- type PodUtilizationFnc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToPods ¶ added in v0.30.0
func ConvertToPods(objs []interface{}, filter FilterFunc) []*v1.Pod
func IsBestEffortPod ¶
func IsBurstablePod ¶
func IsGuaranteedPod ¶
func ListAllPodsOnANode ¶ added in v0.23.0
func ListAllPodsOnANode( nodeName string, getPodsAssignedToNode GetPodsAssignedToNodeFunc, filter FilterFunc, ) ([]*v1.Pod, error)
ListAllPodsOnANode lists all the pods on a node no matter what the phase of the pod is.
func ListPodsOnANode ¶
func ListPodsOnANode( nodeName string, getPodsAssignedToNode GetPodsAssignedToNodeFunc, filter FilterFunc, ) ([]*v1.Pod, error)
ListPodsOnANode lists all pods on a node. It also accepts a "filter" function which can be used to further limit the pods that are returned. (Usually this is podEvictor.Evictable().IsEvictable, in order to only list the evictable pods on a node, but can be used by strategies to extend it if there are further restrictions, such as with NodeAffinity).
func ListPodsOnNodes ¶ added in v0.28.0
func ListPodsOnNodes(nodes []*v1.Node, getPodsAssignedToNode GetPodsAssignedToNodeFunc, filter FilterFunc) ([]*v1.Pod, error)
ListPodsOnNodes returns all pods on given nodes.
func OwnerRef ¶ added in v0.4.0
func OwnerRef(pod *v1.Pod) []metav1.OwnerReference
OwnerRef returns the ownerRefList for the pod.
func OwnerRefUIDs ¶ added in v0.30.0
func SortPodsBasedOnAge ¶ added in v0.25.0
SortPodsBasedOnAge sorts Pods from oldest to most recent in place
func SortPodsBasedOnPriorityLowToHigh ¶ added in v0.19.0
SortPodsBasedOnPriorityLowToHigh sorts pods based on their priorities from low to high. If pods have same priorities, they will be sorted by QoS in the following order: BestEffort, Burstable, Guaranteed
Types ¶
type FilterFunc ¶ added in v0.23.0
FilterFunc is a filter for a pod.
func WrapFilterFuncs ¶ added in v0.23.0
func WrapFilterFuncs(filters ...FilterFunc) FilterFunc
WrapFilterFuncs wraps a set of FilterFunc in one.
type GetPodsAssignedToNodeFunc ¶ added in v0.23.0
type GetPodsAssignedToNodeFunc func(string, FilterFunc) ([]*v1.Pod, error)
GetPodsAssignedToNodeFunc is a function which accept a node name and a pod filter function as input and returns the pods that assigned to the node.
func BuildGetPodsAssignedToNodeFunc ¶ added in v0.23.0
func BuildGetPodsAssignedToNodeFunc(podInformer cache.SharedIndexInformer) (GetPodsAssignedToNodeFunc, error)
BuildGetPodsAssignedToNodeFunc establishes an indexer to map the pods and their assigned nodes. It returns a function to help us get all the pods that assigned to a node based on the indexer.
type Options ¶ added in v0.19.0
type Options struct {
// contains filtered or unexported fields
}
func (*Options) BuildFilterFunc ¶ added in v0.23.0
func (o *Options) BuildFilterFunc() (FilterFunc, error)
BuildFilterFunc builds a final FilterFunc based on Options.
func (*Options) WithFilter ¶ added in v0.23.0
func (o *Options) WithFilter(filter FilterFunc) *Options
WithFilter sets a pod filter. The filter function should return true if the pod should be returned from ListPodsOnANode
func (*Options) WithLabelSelector ¶ added in v0.23.0
func (o *Options) WithLabelSelector(labelSelector *metav1.LabelSelector) *Options
WithLabelSelector sets a pod label selector
func (*Options) WithNamespaces ¶ added in v0.23.0
WithNamespaces sets included namespaces
type PodUtilizationFnc ¶ added in v0.32.0
type PodUtilizationFnc func(pod *v1.Pod) (v1.ResourceList, error)
PodUtilizationFnc is a function for getting pod's utilization. E.g. requested resources of utilization from metrics.