utils

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// owner: @jinxu
	// beta: v1.10
	//
	// New local storage types to support local storage capacity isolation
	LocalStorageCapacityIsolation featuregate.Feature = "LocalStorageCapacityIsolation"

	// owner: @egernst
	// alpha: v1.16
	//
	// Enables PodOverhead, for accounting pod overheads which are specific to a given RuntimeClass
	PodOverhead featuregate.Feature = "PodOverhead"
)
View Source
const SystemCriticalPriority = 2 * int32(1000000000)

Variables

This section is empty.

Functions

func GetNamespacesFromPodAffinityTerm added in v0.10.0

func GetNamespacesFromPodAffinityTerm(pod *v1.Pod, podAffinityTerm *v1.PodAffinityTerm) sets.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 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

func GetPodSource(pod *v1.Pod) (string, error)

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 GetPriorityFromStrategyParams added in v0.19.0

func GetPriorityFromStrategyParams(ctx context.Context, client clientset.Interface, params *api.StrategyParameters) (priority int32, err error)

GetPriorityFromStrategyParams gets priority from the given StrategyParameters. It will return SystemCriticalPriority by default.

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

func GetResourceRequestQuantity(pod *v1.Pod, resourceName v1.ResourceName) resource.Quantity

GetResourceRequestQuantity finds and returns the request quantity for a specific resource.

func IsCriticalPod added in v0.10.0

func IsCriticalPod(pod *v1.Pod) bool

IsCriticalPod returns true if the pod is a static or mirror pod.

func IsMirrorPod added in v0.10.0

func IsMirrorPod(pod *v1.Pod) bool

IsMirrorPod returns true if the passed Pod is a Mirror Pod.

func IsStaticPod added in v0.10.0

func IsStaticPod(pod *v1.Pod) bool

IsStaticPod returns true if the pod is a static pod.

func NodeSelectorRequirementsAsSelector added in v0.10.0

func NodeSelectorRequirementsAsSelector(nsm []v1.NodeSelectorRequirement) (labels.Selector, error)

NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement api type into a struct that implements labels.Selector.

func PodMatchNodeSelector

func PodMatchNodeSelector(pod *v1.Pod, node *v1.Node) (bool, error)

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.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

func PodToleratesTaints(pod *v1.Pod, taintsOfNodes map[string][]v1.Taint) bool

PodToleratesTaints returns true if a pod tolerates one node's taints

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 QOSList added in v0.10.0

type QOSList map[v1.ResourceName]v1.PodQOSClass

QOSList is a set of (resource name, QoS class) pairs.

Jump to

Keyboard shortcuts

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