utils

package
v0.0.0-...-6111fc0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRetryAttemptsForMovement int           = 20
	DefaultBackoff              time.Duration = 100 * time.Millisecond
)
View Source
const (
	RetryAttemptsOfUpdatingReservation = 3
	RetryWaitTime                      = 1 * time.Second
)
View Source
const MaxRetryAttempts = 3 // TODO: 5 will cause a timeout in UT (30s)

Variables

This section is empty.

Functions

func CleanupPodAnnotations

func CleanupPodAnnotations(client clientset.Interface, pod *v1.Pod) error

func CreateScheduleUnit

CreateScheduleUnit create an unit object from the pod. binder only deal with units, a single pod will be wrapped as a unit. the tricky thing here is podGroup event may come later, it may not be able to fetch the pod group objects. In this case, we won't move pods from activeQ to readyQ, caller should handle the not found issue.

func GetUnitIdentifier

func GetUnitIdentifier(info *framework.QueuedPodInfo) string

GetUnitIdentifier return id of the unit.

func GetUnitType

func GetUnitType(pod *v1.Pod) framework.ScheduleUnitType

GetUnitType return unit type of the pod. This method assumes pod belongs to unit

func LockPodGroupStatus

func LockPodGroupStatus(
	pgClient pgclientset.Interface, pgLister pglister.PodGroupLister,
	unit api.ScheduleUnit, operator string,
) error

func PodBelongToUnit

func PodBelongToUnit(pod *v1.Pod) bool

PodBelongToUnit check whether the pod belongs to the unit.

func UpdateMovement

func UpdateMovement(movementClient godelclient.Interface, movementLister v1alpha1.MovementLister, assumedPod *v1.Pod) bool

TODO: move to postbind plugin return needReEnqueue bool

func UpdateReservationStatus

func UpdateReservationStatus(crdClient godelclient.Interface, lister v1alpha1.ReservationLister, assumedPod, placeholderPod *v1.Pod, succeed bool) error

Types

type BinderUnitInfo

type BinderUnitInfo struct {
	*framework.QueuedUnitInfo

	FailedPods []*FailedPod

	// pods belong to the unit which are not in failed status or preemptors.
	BindingPods []*BindingPod

	Preemptors []*Preemptor

	NodeToVictims map[string][]*v1.Pod
}

type BindingPod

type BindingPod struct {
	PodInfo *framework.QueuedPodInfo
	Ctx     *PodCtx
	// if it's true, BindingPod will be wrapped as a Preemptor
	IsPreemptor bool
	// placeholder pod for resource reservation.
	PlaceholderPod *v1.Pod
}

func NewBindingPod

func NewBindingPod(pInfo *framework.QueuedPodInfo) *BindingPod

type FailedPod

type FailedPod struct {
	PodInfo *framework.QueuedPodInfo
	// placeholder pod for resource reservation.
	PlaceholderPod *v1.Pod
	Err            error
}

type PodCtx

type PodCtx struct {
	Ctx               context.Context
	State             *framework.CycleState
	CheckConflictTime time.Time
	Framework         framework.BinderFramework
	AllBound          bool
	SpanContext       tracing.SpanContext
	SuggestedHost     string
}

type Preemptor

type Preemptor struct {
	*BindingPod
	VictimPods []*v1.Pod
}

Jump to

Keyboard shortcuts

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