pod

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IncludeGuaranteedPodsFn filterPodsFunc = func(b bool) FilterPodsFunc {
	f := func(pod *v1.Pod, resType v1.ResourceName) bool {
		return !b && resType == v1.ResourceCPU && IsGuaranteedAndNonPreemptablePods(pod)
	}
	return f
}
View Source
var IncludeOversoldPodFn filterPodsFunc = func(b bool) FilterPodsFunc {
	f := func(pod *v1.Pod, resType v1.ResourceName) bool {
		return !b && IsPreemptablePod(pod)
	}
	return f
}

Functions

func FilterOutPreemptablePods

func FilterOutPreemptablePods(pods []*v1.Pod) ([]*v1.Pod, []*v1.Pod)

FilterOutPreemptablePods return pods those are not preemptable

func GetTotalRequest

func GetTotalRequest(pods []*v1.Pod, fns []FilterPodsFunc, resTypes []v1.ResourceName) v1.ResourceList

GetTotalRequest return the total resource of pods

func GuaranteedPodsCPURequest

func GuaranteedPodsCPURequest(pods []*v1.Pod) int64

func IncludeGuaranteedPods

func IncludeGuaranteedPods() bool

func IsGuaranteedAndNonPreemptablePods

func IsGuaranteedAndNonPreemptablePods(pod *v1.Pod) bool

IsGuaranteedAndNonPreemptablePods return whether pod is guaranteed, but preemptable guaranteed pods are excluded.

func IsPodTerminated

func IsPodTerminated(pod *v1.Pod) bool

IsPodTerminated return true if pod is terminated.

func IsPreemptablePod

func IsPreemptablePod(pod *v1.Pod) bool

IsPreemptablePod check if a pod an offline pod.

Types

type ActivePods

type ActivePods func() ([]*v1.Pod, error)

ActivePods returns pods bound to the kubelet that are active (i.e. non-terminal state)

type FilterPodsFunc

type FilterPodsFunc func(*v1.Pod, v1.ResourceName) bool

type KillPod

type KillPod func(ctx context.Context, client clientset.Interface, gracePeriodSeconds *int64, pod *v1.Pod, evictionVersion string) error

type Resources

type Resources struct {
	CgroupSubSystem cgroup.CgroupSubsystem
	ContainerID     string
	SubPath         string
	Value           int64
}

Resources represents container level resources.

func CalculateExtendResources

func CalculateExtendResources(pod *v1.Pod) []Resources

CalculateExtendResources calculates pod and container that use extend resource level cgroup resource, include cpu and memory

type SortedPodsByRequestCPU

type SortedPodsByRequestCPU []*v1.Pod

SortedPodsByRequestCPU sort pods by cpu request value.

func (SortedPodsByRequestCPU) Len

func (s SortedPodsByRequestCPU) Len() int

func (SortedPodsByRequestCPU) Less

func (s SortedPodsByRequestCPU) Less(i, j int) bool

func (SortedPodsByRequestCPU) Swap

func (s SortedPodsByRequestCPU) Swap(i, j int)

type SortedPodsByRequestMemory

type SortedPodsByRequestMemory []*v1.Pod

SortedPodsByRequestMemory sort pods by memory request value.

func (SortedPodsByRequestMemory) Len

func (s SortedPodsByRequestMemory) Len() int

func (SortedPodsByRequestMemory) Less

func (s SortedPodsByRequestMemory) Less(i, j int) bool

func (SortedPodsByRequestMemory) Swap

func (s SortedPodsByRequestMemory) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳