workload

package
v0.6.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdjustResources added in v0.4.2

func AdjustResources(ctx context.Context, cl client.Client, wl *kueue.Workload)

AdjustResources adjusts the resource requests of a workload based on: - PodOverhead - LimitRanges - Limits

func ApplyAdmissionStatus added in v0.4.0

func ApplyAdmissionStatus(ctx context.Context, c client.Client, w *kueue.Workload, strict bool) error

ApplyAdmissionStatus updated all the admission related status fields of a workload with SSA. if strict is true, resourceVersion will be part of the patch, make this call fail if Workload was changed.

func BaseSSAWorkload added in v0.3.0

func BaseSSAWorkload(w *kueue.Workload) *kueue.Workload

BaseSSAWorkload creates a new object based on the input workload that only contains the fields necessary to identify the original object. The object can be used in as a base for Server-Side-Apply.

func CanBePartiallyAdmitted added in v0.4.0

func CanBePartiallyAdmitted(wl *kueue.Workload) bool

func FindAdmissionCheck added in v0.5.0

func FindAdmissionCheck(checks []kueue.AdmissionCheckState, checkName string) *kueue.AdmissionCheckState

FindAdmissionCheck - returns a pointer to the check identified by checkName if found in checks.

func GetRejectedChecks added in v0.5.0

func GetRejectedChecks(wl *kueue.Workload) []string

GetRejectedChecks returns the list of Rejected admission checks

func HasAllChecks added in v0.5.0

func HasAllChecks(wl *kueue.Workload, mustHaveChecks sets.Set[string]) bool

HasAllChecks returns true if all the mustHaveChecks are present in the workload.

func HasAllChecksReady added in v0.5.0

func HasAllChecksReady(wl *kueue.Workload) bool

HasAllChecksReady returns true if all the checks of the workload are ready.

func HasQuotaReservation added in v0.5.0

func HasQuotaReservation(w *kueue.Workload) bool

HasQuotaReservation checks if workload is admitted based on conditions

func HasRetryOrRejectedChecks added in v0.5.0

func HasRetryOrRejectedChecks(wl *kueue.Workload) bool

HasRetryOrRejectedChecks returns true if any of the workloads checks are Retry or Rejected

func IsAdmitted added in v0.4.0

func IsAdmitted(w *kueue.Workload) bool

IsAdmitted returns true if the workload is admitted.

func IsFinished added in v0.5.3

func IsFinished(w *kueue.Workload) bool

IsFinished returns true if the workload is finished.

func Key

func Key(w *kueue.Workload) string

func QueueKey added in v0.2.0

func QueueKey(w *kueue.Workload) string

func ReclaimablePodsAreEqual added in v0.4.0

func ReclaimablePodsAreEqual(a, b []kueue.ReclaimablePod) bool

ReclaimablePodsAreEqual checks if two Reclaimable pods are semantically equal having the same length and all keys have the same value.

func RemoveFinalizer added in v0.5.2

func RemoveFinalizer(ctx context.Context, c client.Client, wl *kueue.Workload) error

func ResourceQuantity

func ResourceQuantity(name corev1.ResourceName, v int64) resource.Quantity

func ResourceValue

func ResourceValue(name corev1.ResourceName, q resource.Quantity) int64

ResourceValue returns the integer value for the resource name. It's milli-units for CPU and absolute units for everything else.

func SetAdmissionCheckState added in v0.5.0

func SetAdmissionCheckState(checks *[]kueue.AdmissionCheckState, newCheck kueue.AdmissionCheckState)

SetAdmissionCheckState - adds or updates newCheck in the provided checks list.

func SetEvictedCondition added in v0.4.0

func SetEvictedCondition(w *kueue.Workload, reason string, message string)

func SetQuotaReservation added in v0.5.0

func SetQuotaReservation(w *kueue.Workload, admission *kueue.Admission)

SetQuotaReservation applies the provided admission to the workload. The WorkloadAdmitted and WorkloadEvicted are added or updated if necessary.

func SyncAdmittedCondition added in v0.5.0

func SyncAdmittedCondition(w *kueue.Workload) bool

SyncAdmittedCondition sync the state of the Admitted condition with the state of QuotaReserved and AdmissionChecks. Return true if any change was done.

func UnsetQuotaReservationWithCondition added in v0.5.0

func UnsetQuotaReservationWithCondition(wl *kueue.Workload, reason, message string)

func UpdateReclaimablePods added in v0.4.0

func UpdateReclaimablePods(ctx context.Context, c client.Client, w *kueue.Workload, reclaimablePods []kueue.ReclaimablePod) error

UpdateReclaimablePods updates the ReclaimablePods list for the workload wit SSA.

func UpdateStatus

func UpdateStatus(ctx context.Context,
	c client.Client,
	wl *kueue.Workload,
	conditionType string,
	conditionStatus metav1.ConditionStatus,
	reason, message string,
	managerPrefix string) error

UpdateStatus updates the condition of a workload with ssa, fieldManager being set to managerPrefix + "-" + conditionType

Types

type AssigmentClusterQueueState added in v0.5.0

type AssigmentClusterQueueState struct {
	LastTriedFlavorIdx     []map[corev1.ResourceName]int
	CohortGeneration       int64
	ClusterQueueGeneration int64
}

func (*AssigmentClusterQueueState) Clone added in v0.5.0

func (*AssigmentClusterQueueState) PendingFlavors added in v0.5.1

func (s *AssigmentClusterQueueState) PendingFlavors() bool

PendingFlavors returns whether there are pending flavors to try after the last attempt.

type Info

type Info struct {
	Obj *kueue.Workload
	// list of total resources requested by the podsets.
	TotalRequests []PodSetResources
	// Populated from the queue during admission or from the admission field if
	// already admitted.
	ClusterQueue   string
	LastAssignment *AssigmentClusterQueueState
}

Info holds a Workload object and some pre-processing.

func NewInfo

func NewInfo(w *kueue.Workload) *Info

func (*Info) CanBePartiallyAdmitted added in v0.4.0

func (i *Info) CanBePartiallyAdmitted() bool

func (*Info) Update added in v0.2.0

func (i *Info) Update(wl *kueue.Workload)

type Ordering added in v0.6.0

type Ordering struct {
	PodsReadyRequeuingTimestamp config.RequeuingTimestamp
}

func (Ordering) GetQueueOrderTimestamp added in v0.6.0

func (o Ordering) GetQueueOrderTimestamp(w *kueue.Workload) *metav1.Time

GetQueueOrderTimestamp return the timestamp to be used by the scheduler. It could be the workload creation time or the last time a PodsReady timeout has occurred.

type PodSetResources

type PodSetResources struct {
	Name     string
	Requests Requests
	Count    int32
	Flavors  map[corev1.ResourceName]kueue.ResourceFlavorReference
}

func (*PodSetResources) ScaledTo added in v0.4.0

func (psr *PodSetResources) ScaledTo(newCount int32) *PodSetResources

type Requests

type Requests map[corev1.ResourceName]int64

Requests maps ResourceName to flavor to value; for CPU it is tracked in MilliCPU.

func (Requests) ToResourceList added in v0.3.0

func (r Requests) ToResourceList() corev1.ResourceList

Jump to

Keyboard shortcuts

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