utils

package
v0.0.0-...-dcfb068 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

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.

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
}

type UnitStatus

type UnitStatus string
const (
	PendingStatus   UnitStatus = "Pending"
	ScheduledStatus UnitStatus = "Scheduled"
	TimeoutStatus   UnitStatus = "Timeout"
	UnKnownStatus   UnitStatus = ""
)

type UnitStatusMap

type UnitStatusMap struct {
	// contains filtered or unexported fields
}

func NewUnitStatusMap

func NewUnitStatusMap() *UnitStatusMap

func (UnitStatusMap) DeleteUnitStatus

func (u UnitStatusMap) DeleteUnitStatus(key string)

func (UnitStatusMap) GetUnitStatus

func (u UnitStatusMap) GetUnitStatus(key string) UnitStatus

func (UnitStatusMap) SetUnitStatus

func (u UnitStatusMap) SetUnitStatus(key string, status UnitStatus)

Jump to

Keyboard shortcuts

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