Documentation ¶
Index ¶
- Constants
- func CheckPodsWithAntiAffinityExist(candidatePod *v1.Pod, assignedPods map[string][]*v1.Pod, ...) bool
- func CreateNodeMap(nodes []*v1.Node) map[string]*v1.Node
- func GetNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffinityTerm) sets.Set[string]
- func GetNodeWeightGivenPodPreferredAffinity(pod *v1.Pod, node *v1.Node) (int32, error)
- func GetPodAntiAffinityTerms(podAntiAffinity *v1.PodAntiAffinity) (terms []v1.PodAffinityTerm)
- func GetPodQOS(pod *v1.Pod) v1.PodQOSClass
- func GetPodSource(pod *v1.Pod) (string, error)
- func GetPriorityFromPriorityClass(ctx context.Context, client clientset.Interface, name string) (int32, error)
- func GetPriorityValueFromPriorityThreshold(ctx context.Context, client clientset.Interface, ...) (priority int32, err error)
- func GetRecorderAndBroadcaster(ctx context.Context, clientset clientset.Interface) (events.EventBroadcasterAdapter, events.EventRecorder)
- func GetResourceRequest(pod *v1.Pod, resource v1.ResourceName) int64
- func GetResourceRequestQuantity(pod *v1.Pod, resourceName v1.ResourceName) resource.Quantity
- func IsCriticalPriorityPod(pod *v1.Pod) bool
- func IsDaemonsetPod(ownerRefList []metav1.OwnerReference) bool
- func IsMirrorPod(pod *v1.Pod) bool
- func IsPodCoveredByPDB(pod *v1.Pod, lister policyv1.PodDisruptionBudgetLister) (bool, error)
- func IsPodTerminating(pod *v1.Pod) bool
- func IsPodWithLocalStorage(pod *v1.Pod) bool
- func IsPodWithPVC(pod *v1.Pod) bool
- func IsStaticPod(pod *v1.Pod) bool
- func NodeSelectorsEqual(n1, n2 *v1.NodeSelector) bool
- func PodHasNodeAffinity(pod *v1.Pod, nodeAffinityType NodeAffinityType) bool
- func PodMatchNodeSelector(pod *v1.Pod, node *v1.Node) (bool, error)
- func PodMatchesTermsNamespaceAndSelector(pod *v1.Pod, namespaces sets.Set[string], selector labels.Selector) bool
- func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList)
- func PodToleratesTaints(pod *v1.Pod, taintsOfNodes map[string][]v1.Taint) bool
- func TolerationsEqual(t1, t2 []v1.Toleration) bool
- func TolerationsTolerateTaint(tolerations []v1.Toleration, taint *v1.Taint) bool
- func TolerationsTolerateTaintsWithFilter(tolerations []v1.Toleration, taints []v1.Taint, applyFilter taintsFilterFunc) bool
- type NodeAffinityType
- type QOSList
Constants ¶
const SystemCriticalPriority = 2 * int32(1000000000)
Variables ¶
This section is empty.
Functions ¶
func CheckPodsWithAntiAffinityExist ¶ added in v0.30.0
func CheckPodsWithAntiAffinityExist(candidatePod *v1.Pod, assignedPods map[string][]*v1.Pod, nodeMap map[string]*v1.Node) bool
CheckPodsWithAntiAffinityExist checks if there are other pods on the node that the current candidate pod cannot tolerate.
func GetNamespacesFromPodAffinityTerm ¶ added in v0.10.0
func GetNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffinityTerm) sets.Set[string]
GetNamespacesFromPodAffinityTerm returns a set of names according to the namespaces indicated in podAffinityTerm. If namespaces is empty it considers the given pod's namespace.
func GetNodeWeightGivenPodPreferredAffinity ¶ added in v0.28.0
Returns the weight that the pod gives to a node by analyzing the soft node affinity of that pod (nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution)
func GetPodAntiAffinityTerms ¶ added in v0.30.1
func GetPodAntiAffinityTerms(podAntiAffinity *v1.PodAntiAffinity) (terms []v1.PodAffinityTerm)
GetPodAntiAffinityTerms gets the antiaffinity terms for the given pod.
func GetPodQOS ¶ added in v0.10.0
func GetPodQOS(pod *v1.Pod) v1.PodQOSClass
GetPodQOS returns the QoS class of a pod. A pod is besteffort if none of its containers have specified any requests or limits. A pod is guaranteed only when requests and limits are specified for all the containers and they are equal. A pod is burstable if limits and requests do not match across all containers.
func GetPodSource ¶ added in v0.10.0
GetPodSource returns the source of the pod based on the annotation.
func GetPriorityFromPriorityClass ¶ added in v0.19.0
func GetPriorityFromPriorityClass(ctx context.Context, client clientset.Interface, name string) (int32, error)
GetPriorityFromPriorityClass gets priority from the given priority class. If no priority class is provided, it will return SystemCriticalPriority by default.
func GetPriorityValueFromPriorityThreshold ¶ added in v0.25.0
func GetPriorityValueFromPriorityThreshold(ctx context.Context, client clientset.Interface, priorityThreshold *api.PriorityThreshold) (priority int32, err error)
GetPriorityValueFromPriorityThreshold gets priority from the given PriorityThreshold. It will return SystemCriticalPriority by default.
func GetRecorderAndBroadcaster ¶ added in v0.25.0
func GetRecorderAndBroadcaster(ctx context.Context, clientset clientset.Interface) (events.EventBroadcasterAdapter, events.EventRecorder)
func GetResourceRequest ¶ added in v0.10.0
func GetResourceRequest(pod *v1.Pod, resource v1.ResourceName) int64
GetResourceRequest finds and returns the request value for a specific resource.
func GetResourceRequestQuantity ¶ added in v0.10.0
GetResourceRequestQuantity finds and returns the request quantity for a specific resource.
func IsCriticalPriorityPod ¶ added in v0.21.0
IsCriticalPriorityPod returns true if the pod has critical priority.
func IsDaemonsetPod ¶ added in v0.21.0
func IsDaemonsetPod(ownerRefList []metav1.OwnerReference) bool
IsDaemonsetPod returns true if the pod is a IsDaemonsetPod.
func IsMirrorPod ¶ added in v0.10.0
IsMirrorPod returns true if the pod is a Mirror Pod.
func IsPodCoveredByPDB ¶ added in v0.32.0
IsPodCoveredByPDB returns true if the pod is covered by at least one PodDisruptionBudget.
func IsPodTerminating ¶ added in v0.23.0
IsPodTerminating returns true if the pod DeletionTimestamp is set.
func IsPodWithLocalStorage ¶ added in v0.21.0
IsPodWithLocalStorage returns true if the pod has local storage.
func IsPodWithPVC ¶ added in v0.21.0
IsPodWithPVC returns true if the pod has claimed a persistent volume.
func IsStaticPod ¶ added in v0.10.0
IsStaticPod returns true if the pod is a static pod.
func NodeSelectorsEqual ¶ added in v0.21.0
func NodeSelectorsEqual(n1, n2 *v1.NodeSelector) bool
func PodHasNodeAffinity ¶ added in v0.28.0
func PodHasNodeAffinity(pod *v1.Pod, nodeAffinityType NodeAffinityType) bool
PodHasNodeAffinity returns true if the pod has a node affinity of type `nodeAffinityType` defined. The nodeAffinityType param can take this two values: "requiredDuringSchedulingIgnoredDuringExecution" or "requiredDuringSchedulingIgnoredDuringExecution"
func PodMatchNodeSelector ¶
PodMatchNodeSelector checks if a pod node selector matches the node label.
func PodMatchesTermsNamespaceAndSelector ¶ added in v0.10.0
func PodMatchesTermsNamespaceAndSelector(pod *v1.Pod, namespaces sets.Set[string], selector labels.Selector) bool
PodMatchesTermsNamespaceAndSelector returns true if the given <pod> matches the namespace and selector defined by <affinityPod>`s <term>.
func PodRequestsAndLimits ¶ added in v0.10.0
func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList)
PodRequestsAndLimits returns a dictionary of all defined resources summed up for all containers of the pod. If PodOverhead feature is enabled, pod overhead is added to the total container resource requests and to the total container limits which have a non-zero quantity.
func PodToleratesTaints ¶ added in v0.18.0
PodToleratesTaints returns true if a pod tolerates one node's taints
func TolerationsEqual ¶ added in v0.21.0
func TolerationsEqual(t1, t2 []v1.Toleration) bool
func TolerationsTolerateTaint ¶ added in v0.18.0
func TolerationsTolerateTaint(tolerations []v1.Toleration, taint *v1.Taint) bool
TolerationsTolerateTaint checks if taint is tolerated by any of the tolerations.
func TolerationsTolerateTaintsWithFilter ¶ added in v0.18.0
func TolerationsTolerateTaintsWithFilter(tolerations []v1.Toleration, taints []v1.Taint, applyFilter taintsFilterFunc) bool
TolerationsTolerateTaintsWithFilter checks if given tolerations tolerates all the taints that apply to the filter in given taint list.
Types ¶
type NodeAffinityType ¶ added in v0.28.0
type NodeAffinityType string
const ( RequiredDuringSchedulingIgnoredDuringExecution NodeAffinityType = "requiredDuringSchedulingIgnoredDuringExecution" PreferredDuringSchedulingIgnoredDuringExecution NodeAffinityType = "preferredDuringSchedulingIgnoredDuringExecution" )
type QOSList ¶ added in v0.10.0
type QOSList map[v1.ResourceName]v1.PodQOSClass
QOSList is a set of (resource name, QoS class) pairs.