workload

package
v0.7.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 27 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 AdmissionChecksForWorkload added in v0.7.0

func AdmissionChecksForWorkload(log logr.Logger, wl *kueue.Workload, admissionChecks map[string]sets.Set[kueue.ResourceFlavorReference]) sets.Set[string]

AdmissionChecksForWorkload returns AdmissionChecks that should be assigned to a specific Workload based on ClusterQueue configuration and ResourceFlavors

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 HasRequeueState added in v0.6.0

func HasRequeueState(w *kueue.Workload) bool

HasRequeueState returns true if the workload has re-queue state.

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 IsEvictedByDeactivation added in v0.6.0

func IsEvictedByDeactivation(w *kueue.Workload) bool

IsEvictedByDeactivation returns true if the workload is evicted by deactivation.

func IsEvictedByPodsReadyTimeout added in v0.6.0

func IsEvictedByPodsReadyTimeout(w *kueue.Workload) (*metav1.Condition, bool)

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 QueuedWaitTime added in v0.7.0

func QueuedWaitTime(wl *kueue.Workload) time.Duration

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 SetPreemptedCondition added in v0.7.0

func SetPreemptedCondition(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 SetRequeuedCondition added in v0.7.0

func SetRequeuedCondition(wl *kueue.Workload, reason, message string, status bool)

SetRequeuedCondition sets the WorkloadRequeued condition to true

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) bool

UnsetQuotaReservationWithCondition sets the QuotaReserved condition to false, clears the admission and set the WorkloadRequeued status. Returns whether any change was done.

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 with 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 AssignmentClusterQueueState added in v0.7.0

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

func (*AssignmentClusterQueueState) Clone added in v0.7.0

func (*AssignmentClusterQueueState) NextFlavorToTryForPodSetResource added in v0.7.0

func (s *AssignmentClusterQueueState) NextFlavorToTryForPodSetResource(ps int, res corev1.ResourceName) int

func (*AssignmentClusterQueueState) PendingFlavors added in v0.7.0

func (s *AssignmentClusterQueueState) 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 *AssignmentClusterQueueState
}

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) FlavorResourceUsage added in v0.7.0

func (i *Info) FlavorResourceUsage() map[kueue.ResourceFlavorReference]Requests

ResourceUsage returns the total resource usage for the workload, per flavor (if assigned, otherwise flavor shows as empty string), per resource.

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 incorporates the requests from all pods in the podset.
	Requests Requests
	// Count indicates how many pods are in the podset.
	Count int32

	// Flavors are populated when the Workload is assigned.
	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