workload

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright 2023 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

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

func GetQueueOrderTimestamp added in v0.4.0

func 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.

func GetRejectedChecks added in v0.5.0

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

Returns the list of Rejected admission checks

func HasAllChecks added in v0.5.0

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

Returns true if all the mustHaveChecks are present in the workload.

func HasAllChecksReady added in v0.5.0

func HasAllChecksReady(wl *kueue.Workload) bool

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

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

Returns true if the workload is admitted.

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 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, filelManager 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 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