Documentation ¶
Index ¶
- Constants
- Variables
- func AddResourceList(list, newList corev1.ResourceList)
- func AppendHostPorts(ports framework.HostPortInfo, r framework.HostPortInfo) framework.HostPortInfo
- func BoolToFloat64(b bool) float64
- func CloneHostPorts(ports framework.HostPortInfo) framework.HostPortInfo
- func DumpJSON(o interface{}) string
- func EvictPodByVersion(ctx context.Context, kubernetes kubernetes.Interface, namespace, name string, ...) error
- func FindContainerIdAndStatusByName(status *corev1.PodStatus, name string) (string, *corev1.ContainerStatus, error)
- func FindSupportedEvictVersion(client kubernetes.Interface) (version string, err error)
- func GenNodeZoneName(nodeID int) string
- func GenerateNodeKey(node *metav1.ObjectMeta) string
- func GeneratePodPatch(oldPod, newPod *corev1.Pod) ([]byte, error)
- func GenerateReservationPatch(oldReservation, newReservation *schedulingv1alpha1.Reservation) ([]byte, error)
- func GetBatchMemoryFromResourceList(r corev1.ResourceList) int64
- func GetBatchMilliCPUFromResourceList(r corev1.ResourceList) int64
- func GetCPUSetFromPod(podAnnotations map[string]string) (string, error)
- func GetContainerBatchMemoryByteLimit(c *corev1.Container) int64
- func GetContainerBatchMemoryByteRequest(c *corev1.Container) int64
- func GetContainerBatchMilliCPULimit(c *corev1.Container) int64
- func GetContainerBatchMilliCPURequest(c *corev1.Container) int64
- func GetContainerExtendedResources(container *corev1.Container) *apiext.ExtendedResourceContainerSpec
- func GetContainerMemoryByteLimit(c *corev1.Container) int64
- func GetContainerMilliCPULimit(c *corev1.Container) int64
- func GetContainerTargetExtendedResources(container *corev1.Container, resourceNames ...corev1.ResourceName) *apiext.ExtendedResourceContainerSpec
- func GetEmptyContainerExtendedResources() *apiext.ExtendedResourceContainerSpec
- func GetEmptyPodExtendedResources() *apiext.ExtendedResourceSpec
- func GetFastLabelSelector(ps *metav1.LabelSelector) (labels.Selector, error)
- func GetKubeQosClass(pod *corev1.Pod) corev1.PodQOSClass
- func GetNamespacedName(namespace, name string) string
- func GetNodeAddress(node *corev1.Node, addrType corev1.NodeAddressType) (string, error)
- func GetNodeAllocatableBatchMemory(node *corev1.Node) int64
- func GetNodeAllocatableBatchMilliCPU(node *corev1.Node) int64
- func GetNodeAnnoReservedJson(reserved apiext.NodeReservation) string
- func GetNodeReservationFromAnnotation(anno map[string]string) corev1.ResourceList
- func GetNodeReservationFromKubelet(node *corev1.Node) corev1.ResourceList
- func GetNodeReservationResources(reservation *apiext.NodeReservation) (corev1.ResourceList, error)
- func GetPodBEMemoryByteLimit(pod *corev1.Pod) int64
- func GetPodBEMemoryByteRequestIgnoreUnlimited(pod *corev1.Pod) int64
- func GetPodBEMilliCPULimit(pod *corev1.Pod) int64
- func GetPodBEMilliCPURequest(pod *corev1.Pod) int64
- func GetPodExtendedResources(pod *corev1.Pod) *apiext.ExtendedResourceSpec
- func GetPodKey(pod *corev1.Pod) string
- func GetPodMetricKey(podMetric *slov1alpha1.PodMetricInfo) string
- func GetPodMilliCPULimit(pod *corev1.Pod) int64
- func GetPodRequest(pod *corev1.Pod, resourceNames ...corev1.ResourceName) corev1.ResourceList
- func GetPodTargetExtendedResources(pod *corev1.Pod, resourceNames ...corev1.ResourceName) *apiext.ExtendedResourceSpec
- func IsIn(arr []string, val string) bool
- func IsNodeAddressTypeSupported(addrType corev1.NodeAddressType) bool
- func IsPodCPUBurstable(pod *corev1.Pod) bool
- func IsPodCfsQuotaNeedUnset(annotations map[string]string) (bool, error)
- func IsPodTerminated(pod *corev1.Pod) bool
- func IsQuantityDiff(old, new resource.Quantity, diffThreshold float64) bool
- func IsResourceDiff(old, new corev1.ResourceList, resourceName corev1.ResourceName, ...) bool
- func IsResourceListEqual(a corev1.ResourceList, b corev1.ResourceList) bool
- func IsResourceListEqualIgnoreZeroValues(a, b corev1.ResourceList) bool
- func IsZoneListResourceEqual(a, b v1alpha1.ZoneList, resourceNames ...string) bool
- func LessThanOrEqualCompletely(a corev1.ResourceList, b corev1.ResourceList) bool
- func MaxFloat64(i, j float64) float64
- func MaxInt64(i, j int64) int64
- func MergeCfg(old, new interface{}) (interface{}, error)
- func MergeZoneList(a, b v1alpha1.ZoneList) v1alpha1.ZoneList
- func MinFloat64(i, j float64) float64
- func MinInt64(i, j int64) int64
- func MinResourceList(a corev1.ResourceList, b corev1.ResourceList) corev1.ResourceList
- func MultiplyMilliQuant(quant resource.Quantity, factor float64) resource.Quantity
- func MultiplyQuant(quant resource.Quantity, factor float64) resource.Quantity
- func NewZeroResourceList() corev1.ResourceList
- func OnceValues(f func() ([]int, error)) func() ([]int, error)
- func ParseContainerId(data string) (cType, cID string, err error)
- func PatchPod(ctx context.Context, clientset clientset.Interface, oldPod, newPod *corev1.Pod) (*corev1.Pod, error)
- func PatchReservation(ctx context.Context, clientset koordinatorclientset.Interface, ...) (*schedulingv1alpha1.Reservation, error)
- func QuantityPtr(q resource.Quantity) *resource.Quantity
- func RemoveHostPorts(ports framework.HostPortInfo, r framework.HostPortInfo)
- func RequestedHostPorts(pod *corev1.Pod) framework.HostPortInfo
- func ResetHostPorts(pod *corev1.Pod, ports framework.HostPortInfo)
- func RetryOnConflictOrTooManyRequests(fn func() error) error
- func RunFeature(moduleFunc func(), featureDependency []featuregate.Feature, interval int, ...) bool
- func RunFeatureWithInit(moduleInit func() error, moduleFunc func(), ...) bool
- func SupportEviction(client kubernetes.Interface) (string, error)
- func TrimDifferentZone(a, b v1alpha1.ZoneList) v1alpha1.ZoneList
- func TrimNodeAllocatableByNodeReservation(node *corev1.Node) (trimmedAllocatable corev1.ResourceList, trimmed bool)
- func ZoneListToZoneResourceList(zoneList v1alpha1.ZoneList) map[string]corev1.ResourceList
- func ZoneResourceListToZoneList(zoneResourceList map[string]corev1.ResourceList) v1alpha1.ZoneList
Constants ¶
const ( EvictionKind = "Eviction" EvictionGroupName = "policy" EvictionSubResourceName = "pods/eviction" )
const (
NodeZoneType = "Node"
)
Variables ¶
var ExtendedResourceNames = []corev1.ResourceName{ extension.BatchCPU, extension.BatchMemory, }
Functions ¶
func AddResourceList ¶ added in v1.1.0
func AddResourceList(list, newList corev1.ResourceList)
AddResourceList adds the resources in newList to list.
func AppendHostPorts ¶ added in v1.3.0
func AppendHostPorts(ports framework.HostPortInfo, r framework.HostPortInfo) framework.HostPortInfo
func BoolToFloat64 ¶ added in v1.3.0
func CloneHostPorts ¶ added in v1.3.0
func CloneHostPorts(ports framework.HostPortInfo) framework.HostPortInfo
func EvictPodByVersion ¶ added in v1.2.0
func EvictPodByVersion(ctx context.Context, kubernetes kubernetes.Interface, namespace, name string, opts metav1.DeleteOptions, evictVersion string) error
EvictPodByVersion evicts Pods using the best available method in Kubernetes.
The available methods are, in order of preference: * v1 eviction API * v1beta1 eviction API
func FindContainerIdAndStatusByName ¶ added in v0.2.0
func FindSupportedEvictVersion ¶ added in v1.2.0
func FindSupportedEvictVersion(client kubernetes.Interface) (version string, err error)
func GenNodeZoneName ¶ added in v1.4.0
GenNodeZoneName generates the zone name according to the NUMA node ID.
func GenerateNodeKey ¶ added in v0.7.0
func GenerateNodeKey(node *metav1.ObjectMeta) string
GenerateNodeKey returns a generated key with given meta
func GeneratePodPatch ¶ added in v0.7.0
func GenerateReservationPatch ¶ added in v0.7.0
func GenerateReservationPatch(oldReservation, newReservation *schedulingv1alpha1.Reservation) ([]byte, error)
func GetBatchMemoryFromResourceList ¶ added in v1.1.1
func GetBatchMemoryFromResourceList(r corev1.ResourceList) int64
func GetBatchMilliCPUFromResourceList ¶ added in v1.1.1
func GetBatchMilliCPUFromResourceList(r corev1.ResourceList) int64
func GetCPUSetFromPod ¶ added in v1.0.0
func GetContainerBatchMemoryByteLimit ¶ added in v0.7.0
func GetContainerBatchMemoryByteRequest ¶ added in v0.7.0
func GetContainerBatchMilliCPULimit ¶ added in v0.7.0
func GetContainerBatchMilliCPURequest ¶ added in v0.7.0
func GetContainerExtendedResources ¶ added in v1.1.0
func GetContainerExtendedResources(container *corev1.Container) *apiext.ExtendedResourceContainerSpec
func GetContainerMemoryByteLimit ¶ added in v0.3.0
func GetContainerMilliCPULimit ¶ added in v0.3.0
func GetContainerTargetExtendedResources ¶ added in v1.1.0
func GetContainerTargetExtendedResources(container *corev1.Container, resourceNames ...corev1.ResourceName) *apiext.ExtendedResourceContainerSpec
GetContainerTargetExtendedResources gets the resource requirements of a container with given extended resources. It returns nil if container is nil or specifies no extended resource.
func GetEmptyContainerExtendedResources ¶ added in v1.1.0
func GetEmptyContainerExtendedResources() *apiext.ExtendedResourceContainerSpec
func GetEmptyPodExtendedResources ¶ added in v1.1.0
func GetEmptyPodExtendedResources() *apiext.ExtendedResourceSpec
func GetFastLabelSelector ¶
func GetFastLabelSelector(ps *metav1.LabelSelector) (labels.Selector, error)
func GetKubeQosClass ¶ added in v0.2.0
func GetKubeQosClass(pod *corev1.Pod) corev1.PodQOSClass
GetKubeQosClass gets the Kubernetes QOSClass for the pod. DEPRECATED: use extension.GetKubeQosClass instead.
func GetNamespacedName ¶ added in v1.3.0
func GetNodeAddress ¶ added in v0.4.1
GetNodeAddress get node specified type address.
func GetNodeAllocatableBatchMemory ¶ added in v1.4.0
func GetNodeAllocatableBatchMilliCPU ¶ added in v1.4.0
func GetNodeAnnoReservedJson ¶ added in v1.2.0
func GetNodeAnnoReservedJson(reserved apiext.NodeReservation) string
func GetNodeReservationFromAnnotation ¶ added in v1.2.0
func GetNodeReservationFromAnnotation(anno map[string]string) corev1.ResourceList
func GetNodeReservationFromKubelet ¶ added in v1.4.0
func GetNodeReservationFromKubelet(node *corev1.Node) corev1.ResourceList
func GetNodeReservationResources ¶ added in v1.3.0
func GetNodeReservationResources(reservation *apiext.NodeReservation) (corev1.ResourceList, error)
func GetPodBEMemoryByteLimit ¶ added in v0.2.0
func GetPodBEMemoryByteRequestIgnoreUnlimited ¶ added in v0.3.0
func GetPodBEMilliCPULimit ¶ added in v0.2.0
func GetPodBEMilliCPURequest ¶ added in v0.2.0
func GetPodExtendedResources ¶ added in v1.1.0
func GetPodExtendedResources(pod *corev1.Pod) *apiext.ExtendedResourceSpec
func GetPodMetricKey ¶
func GetPodMetricKey(podMetric *slov1alpha1.PodMetricInfo) string
func GetPodMilliCPULimit ¶ added in v0.7.0
func GetPodRequest ¶
func GetPodRequest(pod *corev1.Pod, resourceNames ...corev1.ResourceName) corev1.ResourceList
func GetPodTargetExtendedResources ¶ added in v1.1.0
func GetPodTargetExtendedResources(pod *corev1.Pod, resourceNames ...corev1.ResourceName) *apiext.ExtendedResourceSpec
GetPodTargetExtendedResources gets the resource requirements of a pod with given extended resources. It returns nil if pod specifies no extended resource.
func IsNodeAddressTypeSupported ¶ added in v0.4.1
func IsNodeAddressTypeSupported(addrType corev1.NodeAddressType) bool
IsNodeAddressTypeSupported determine whether addrType is a supported type.
func IsPodCPUBurstable ¶ added in v1.0.0
IsPodCPUBurstable checks if cpu burst is allowed for the pod.
func IsPodCfsQuotaNeedUnset ¶ added in v1.0.0
IsPodCfsQuotaNeedUnset checks if the pod-level and container-level cfs_quota should be unset to avoid unnecessary throttles. https://github.com/koordinator-sh/koordinator/issues/489
func IsPodTerminated ¶ added in v0.4.0
func IsQuantityDiff ¶ added in v1.4.0
func IsResourceDiff ¶
func IsResourceDiff(old, new corev1.ResourceList, resourceName corev1.ResourceName, diffThreshold float64) bool
IsResourceDiff returns whether the new resource has big enough difference with the old one or not
func IsResourceListEqual ¶ added in v1.4.0
func IsResourceListEqual(a corev1.ResourceList, b corev1.ResourceList) bool
IsResourceListEqual checks if the two resource lists are numerically equivalent.
func IsResourceListEqualIgnoreZeroValues ¶ added in v1.4.0
func IsResourceListEqualIgnoreZeroValues(a, b corev1.ResourceList) bool
IsResourceListEqualIgnoreZeroValues checks if the two resource lists are numerically equivalent. NOTE: Resource name with a zero value will be ignored in comparison. e.g. a = {"cpu": "10", "memory": "0"}, b = {"cpu": "10"} => true
func IsZoneListResourceEqual ¶ added in v1.4.0
func LessThanOrEqualCompletely ¶ added in v1.4.0
func LessThanOrEqualCompletely(a corev1.ResourceList, b corev1.ResourceList) bool
LessThanOrEqualCompletely is different quotav1.LessThanOrEqual. It will compare non-exist value in b
func MaxFloat64 ¶ added in v1.3.0
func MergeCfg ¶ added in v0.2.0
func MergeCfg(old, new interface{}) (interface{}, error)
MergeCfg returns a merged interface. Value in new will override old's when both fields exist. It will throw an error if:
- either of the inputs was nil;
- inputs were not a pointer of the same json struct.
func MergeZoneList ¶ added in v1.4.0
MergeZoneList merges ZoneList b override ZoneList a.
func MinFloat64 ¶ added in v1.3.0
func MinResourceList ¶ added in v1.3.0
func MinResourceList(a corev1.ResourceList, b corev1.ResourceList) corev1.ResourceList
MinResourceList returns the result of Min(a, b) for each named resource, corresponding to the quotav1.Max(). It should be semantically equivalent to the result of `quotav1.Subtract(quotav1.Add(a, b), quotav1.Max(a, b))`.
e.g.
a = {"cpu": "10", "memory": "20Gi"}, b = {"cpu": "6", "memory": "24Gi", "nvidia.com/gpu": "2"} => {"cpu": "6", "memory": "20Gi"}
func MultiplyMilliQuant ¶
MultiplyMilliQuant scales quantity by factor
func MultiplyQuant ¶
MultiplyQuant scales quantity by factor
func NewZeroResourceList ¶
func NewZeroResourceList() corev1.ResourceList
func OnceValues ¶ added in v1.4.1
TODO: Replace this function with the standard library after go1.21+ version
func ParseContainerId ¶ added in v0.2.0
func PatchReservation ¶ added in v0.7.0
func PatchReservation(ctx context.Context, clientset koordinatorclientset.Interface, oldReservation, newReservation *schedulingv1alpha1.Reservation) (*schedulingv1alpha1.Reservation, error)
func RemoveHostPorts ¶ added in v1.3.0
func RemoveHostPorts(ports framework.HostPortInfo, r framework.HostPortInfo)
func RequestedHostPorts ¶ added in v1.3.0
func RequestedHostPorts(pod *corev1.Pod) framework.HostPortInfo
func ResetHostPorts ¶ added in v1.3.0
func ResetHostPorts(pod *corev1.Pod, ports framework.HostPortInfo)
func RetryOnConflictOrTooManyRequests ¶ added in v0.7.0
func RunFeature ¶ added in v0.2.0
func RunFeature(moduleFunc func(), featureDependency []featuregate.Feature, interval int, stopCh <-chan struct{}) bool
RunFeature runs moduleFunc only if interval > 0 AND at least one feature dependency is enabled
func RunFeatureWithInit ¶ added in v0.2.0
func RunFeatureWithInit(moduleInit func() error, moduleFunc func(), featureDependency []featuregate.Feature, interval int, stopCh <-chan struct{}) bool
RunFeatureWithInit runs moduleFunc only if interval > 0 , at least one feature dependency is enabled and moduleInit function returns nil
func SupportEviction ¶ added in v1.3.0
func SupportEviction(client kubernetes.Interface) (string, error)
func TrimDifferentZone ¶ added in v1.4.0
func TrimNodeAllocatableByNodeReservation ¶ added in v1.3.0
func TrimNodeAllocatableByNodeReservation(node *corev1.Node) (trimmedAllocatable corev1.ResourceList, trimmed bool)
func ZoneListToZoneResourceList ¶ added in v1.4.0
func ZoneListToZoneResourceList(zoneList v1alpha1.ZoneList) map[string]corev1.ResourceList
ZoneListToZoneResourceList transforms the zone list into a map from zone name to its resource list. It supposes the capacity, allocatable, available of a ResourceInfo is the same.
func ZoneResourceListToZoneList ¶ added in v1.4.0
func ZoneResourceListToZoneList(zoneResourceList map[string]corev1.ResourceList) v1alpha1.ZoneList
ZoneResourceListToZoneList transforms the zone resource list into the zone list by the orders of the zone name and the resource name. It supposes the capacity, allocatable, available of a ResourceInfo is the same.
Types ¶
This section is empty.