pod

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 4

Documentation

Index

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 GroupByNamespace added in v0.28.0

func GroupByNamespace(pods []*v1.Pod) map[string][]*v1.Pod

func GroupByNodeName added in v0.30.0

func GroupByNodeName(pods []*v1.Pod) map[string][]*v1.Pod

func IsBestEffortPod

func IsBestEffortPod(pod *v1.Pod) bool

func IsBurstablePod

func IsBurstablePod(pod *v1.Pod) bool

func IsGuaranteedPod

func IsGuaranteedPod(pod *v1.Pod) bool

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 OwnerRefUIDs(pod *v1.Pod) []string

func SortPodsBasedOnAge added in v0.25.0

func SortPodsBasedOnAge(pods []*v1.Pod)

SortPodsBasedOnAge sorts Pods from oldest to most recent in place

func SortPodsBasedOnPriorityLowToHigh added in v0.19.0

func SortPodsBasedOnPriorityLowToHigh(pods []*v1.Pod)

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

type FilterFunc func(*v1.Pod) bool

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 NewOptions added in v0.23.0

func NewOptions() *Options

NewOptions returns an empty Options.

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

func (o *Options) WithNamespaces(namespaces sets.Set[string]) *Options

WithNamespaces sets included namespaces

func (*Options) WithoutNamespaces added in v0.23.0

func (o *Options) WithoutNamespaces(namespaces sets.Set[string]) *Options

WithoutNamespaces sets excluded namespaces

Jump to

Keyboard shortcuts

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