Documentation ¶
Index ¶
- Variables
- func Key(q *kueue.LocalQueue) string
- func QueueKey(namespace, name string) string
- type ClusterQueue
- func (c *ClusterQueue) Active() bool
- func (c *ClusterQueue) AddFromLocalQueue(q *LocalQueue) bool
- func (c *ClusterQueue) Cohort() string
- func (c *ClusterQueue) Delete(w *kueue.Workload)
- func (c *ClusterQueue) DeleteFromLocalQueue(q *LocalQueue)
- func (c *ClusterQueue) Dump() ([]string, bool)
- func (c *ClusterQueue) DumpInadmissible() ([]string, bool)
- func (c *ClusterQueue) Info(key string) *workload.Info
- func (c *ClusterQueue) Pending() int
- func (c *ClusterQueue) PendingActive() int
- func (c *ClusterQueue) PendingInadmissible() int
- func (c *ClusterQueue) Pop() *workload.Info
- func (c *ClusterQueue) PushOrUpdate(wInfo *workload.Info)
- func (c *ClusterQueue) QueueInadmissibleWorkloads(ctx context.Context, client client.Client) bool
- func (c *ClusterQueue) RequeueIfNotPresent(wInfo *workload.Info, reason RequeueReason) bool
- func (c *ClusterQueue) Snapshot() []*workload.Info
- func (c *ClusterQueue) Update(apiCQ *kueue.ClusterQueue) error
- type LocalQueue
- type Manager
- func (m *Manager) AddClusterQueue(ctx context.Context, cq *kueue.ClusterQueue) error
- func (m *Manager) AddLocalQueue(ctx context.Context, q *kueue.LocalQueue) error
- func (m *Manager) AddOrUpdateWorkload(w *kueue.Workload) bool
- func (m *Manager) AddOrUpdateWorkloadWithoutLock(w *kueue.Workload) bool
- func (m *Manager) Broadcast()
- func (m *Manager) CleanUpOnContext(ctx context.Context)
- func (m *Manager) ClusterQueueForWorkload(wl *kueue.Workload) (string, bool)
- func (m *Manager) ClusterQueueFromLocalQueue(localQueueKey string) (string, error)
- func (m *Manager) DeleteClusterQueue(cq *kueue.ClusterQueue)
- func (m *Manager) DeleteLocalQueue(q *kueue.LocalQueue)
- func (m *Manager) DeleteSnapshot(cq *kueue.ClusterQueue)
- func (m *Manager) DeleteWorkload(w *kueue.Workload)
- func (m *Manager) Dump() map[string][]string
- func (m *Manager) DumpInadmissible() map[string][]string
- func (m *Manager) GetClusterQueueNames() []string
- func (m *Manager) GetSnapshot(cqName string) []kueue.ClusterQueuePendingWorkload
- func (m *Manager) Heads(ctx context.Context) []workload.Info
- func (m *Manager) LogDump(log logr.Logger)
- func (m *Manager) Pending(cq *kueue.ClusterQueue) int
- func (m *Manager) PendingWorkloads(q *kueue.LocalQueue) (int32, error)
- func (m *Manager) PendingWorkloadsInfo(cqName string) []*workload.Info
- func (m *Manager) QueueAssociatedInadmissibleWorkloadsAfter(ctx context.Context, w *kueue.Workload, action func())
- func (m *Manager) QueueForWorkloadExists(wl *kueue.Workload) bool
- func (m *Manager) QueueInadmissibleWorkloads(ctx context.Context, cqNames sets.Set[string])
- func (m *Manager) RequeueWorkload(ctx context.Context, info *workload.Info, reason RequeueReason) bool
- func (m *Manager) UpdateClusterQueue(ctx context.Context, cq *kueue.ClusterQueue, specUpdated bool) error
- func (m *Manager) UpdateLocalQueue(q *kueue.LocalQueue) error
- func (m *Manager) UpdateSnapshot(cqName string, maxCount int32) bool
- func (m *Manager) UpdateWorkload(oldW, w *kueue.Workload) bool
- type Option
- type RequeueReason
- type StatusChecker
Constants ¶
This section is empty.
Variables ¶
var (
ErrQueueDoesNotExist = errors.New("queue doesn't exist")
)
Functions ¶
Types ¶
type ClusterQueue ¶
type ClusterQueue struct {
// contains filtered or unexported fields
}
func (*ClusterQueue) Active ¶ added in v0.6.0
func (c *ClusterQueue) Active() bool
Active returns true if the queue is active
func (*ClusterQueue) AddFromLocalQueue ¶ added in v0.2.0
func (c *ClusterQueue) AddFromLocalQueue(q *LocalQueue) bool
AddFromLocalQueue pushes all workloads belonging to this queue to the ClusterQueue. If at least one workload is added, returns true, otherwise returns false.
func (*ClusterQueue) Cohort ¶
func (c *ClusterQueue) Cohort() string
Cohort returns the Cohort of this ClusterQueue.
func (*ClusterQueue) Delete ¶
func (c *ClusterQueue) Delete(w *kueue.Workload)
Delete removes the workload from ClusterQueue.
func (*ClusterQueue) DeleteFromLocalQueue ¶ added in v0.2.0
func (c *ClusterQueue) DeleteFromLocalQueue(q *LocalQueue)
DeleteFromLocalQueue removes all workloads belonging to this queue from the ClusterQueue.
func (*ClusterQueue) Dump ¶
func (c *ClusterQueue) Dump() ([]string, bool)
Dump produces a dump of the current workloads in the heap of this ClusterQueue. It returns false if the queue is empty, otherwise returns true.
func (*ClusterQueue) DumpInadmissible ¶ added in v0.2.0
func (c *ClusterQueue) DumpInadmissible() ([]string, bool)
func (*ClusterQueue) Info ¶
func (c *ClusterQueue) Info(key string) *workload.Info
Info returns workload.Info for the workload key. Users of this method should not modify the returned object.
func (*ClusterQueue) Pending ¶
func (c *ClusterQueue) Pending() int
Pending returns the total number of pending workloads.
func (*ClusterQueue) PendingActive ¶ added in v0.2.0
func (c *ClusterQueue) PendingActive() int
PendingActive returns the number of active pending workloads, workloads that are in the admission queue.
func (*ClusterQueue) PendingInadmissible ¶ added in v0.2.0
func (c *ClusterQueue) PendingInadmissible() int
PendingInadmissible returns the number of inadmissible pending workloads, workloads that were already tried and are waiting for cluster conditions to change to potentially become admissible.
func (*ClusterQueue) Pop ¶
func (c *ClusterQueue) Pop() *workload.Info
Pop removes the head of the queue and returns it. It returns nil if the queue is empty.
func (*ClusterQueue) PushOrUpdate ¶
func (c *ClusterQueue) PushOrUpdate(wInfo *workload.Info)
PushOrUpdate pushes the workload to ClusterQueue. If the workload is already present, updates with the new one.
func (*ClusterQueue) QueueInadmissibleWorkloads ¶
QueueInadmissibleWorkloads moves all workloads from inadmissibleWorkloads to heap. If at least one workload is moved, returns true, otherwise returns false.
func (*ClusterQueue) RequeueIfNotPresent ¶
func (c *ClusterQueue) RequeueIfNotPresent(wInfo *workload.Info, reason RequeueReason) bool
RequeueIfNotPresent inserts a workload that was not admitted back into the ClusterQueue. If the boolean is true, the workloads should be put back in the queue immediately, because we couldn't determine if the workload was admissible in the last cycle. If the boolean is false, the implementation might choose to keep it in temporary placeholder stage where it doesn't compete with other workloads, until cluster events free up quota. The workload should not be reinserted if it's already in the ClusterQueue. Returns true if the workload was inserted.
func (*ClusterQueue) Snapshot ¶ added in v0.5.0
func (c *ClusterQueue) Snapshot() []*workload.Info
Snapshot returns a copy of the current workloads in the heap of this ClusterQueue.
func (*ClusterQueue) Update ¶
func (c *ClusterQueue) Update(apiCQ *kueue.ClusterQueue) error
Update updates the properties of this ClusterQueue.
type LocalQueue ¶ added in v0.2.0
LocalQueue is the internal implementation of kueue.LocalQueue.
func (*LocalQueue) AddOrUpdate ¶ added in v0.2.0
func (q *LocalQueue) AddOrUpdate(info *workload.Info)
type Manager ¶
func NewManager ¶
func NewManager(client client.Client, checker StatusChecker, opts ...Option) *Manager
func (*Manager) AddClusterQueue ¶
func (*Manager) AddLocalQueue ¶ added in v0.2.0
func (*Manager) AddOrUpdateWorkload ¶
AddOrUpdateWorkload adds or updates workload to the corresponding queue. Returns whether the queue existed.
func (*Manager) AddOrUpdateWorkloadWithoutLock ¶ added in v0.6.3
func (*Manager) CleanUpOnContext ¶
CleanUpOnContext tracks the context. When closed, it wakes routines waiting on elements to be available. It should be called before doing any calls to Heads.
func (*Manager) ClusterQueueForWorkload ¶
ClusterQueueForWorkload returns the name of the ClusterQueue where the workload should be queued and whether it exists. Returns empty string if the queue doesn't exist.
func (*Manager) ClusterQueueFromLocalQueue ¶ added in v0.6.0
ClusterQueueFromLocalQueue returns ClusterQueue name, with a QueueKey(namespace/localQueueName) as the parameter
func (*Manager) DeleteClusterQueue ¶
func (m *Manager) DeleteClusterQueue(cq *kueue.ClusterQueue)
func (*Manager) DeleteLocalQueue ¶ added in v0.2.0
func (m *Manager) DeleteLocalQueue(q *kueue.LocalQueue)
func (*Manager) DeleteSnapshot ¶ added in v0.5.0
func (m *Manager) DeleteSnapshot(cq *kueue.ClusterQueue)
func (*Manager) DeleteWorkload ¶
func (*Manager) Dump ¶
Dump is a dump of the queues and it's elements (unordered). Only use for testing purposes.
func (*Manager) DumpInadmissible ¶ added in v0.2.0
DumpInadmissible is a dump of the inadmissible workloads list. Only use for testing purposes.
func (*Manager) GetClusterQueueNames ¶ added in v0.5.0
func (*Manager) GetSnapshot ¶ added in v0.5.0
func (m *Manager) GetSnapshot(cqName string) []kueue.ClusterQueuePendingWorkload
func (*Manager) Heads ¶
Heads returns the heads of the queues, along with their associated ClusterQueue. It blocks if the queues empty until they have elements or the context terminates.
func (*Manager) LogDump ¶ added in v0.6.0
LogDump dumps the pending and inadmissible workloads for each ClusterQueue into the log, one line per ClusterQueue.
func (*Manager) PendingWorkloads ¶
func (m *Manager) PendingWorkloads(q *kueue.LocalQueue) (int32, error)
func (*Manager) PendingWorkloadsInfo ¶ added in v0.6.0
func (*Manager) QueueAssociatedInadmissibleWorkloadsAfter ¶ added in v0.3.0
func (m *Manager) QueueAssociatedInadmissibleWorkloadsAfter(ctx context.Context, w *kueue.Workload, action func())
QueueAssociatedInadmissibleWorkloadsAfter requeues into the heaps all previously inadmissible workloads in the same ClusterQueue and cohort (if they exist) as the provided admitted workload to the heaps. An optional action can be executed at the beginning of the function, while holding the lock, to provide atomicity with the operations in the queues.
func (*Manager) QueueForWorkloadExists ¶
func (*Manager) QueueInadmissibleWorkloads ¶ added in v0.2.0
QueueInadmissibleWorkloads moves all inadmissibleWorkloads in corresponding ClusterQueues to heap. If at least one workload queued, we will broadcast the event.
func (*Manager) RequeueWorkload ¶
func (m *Manager) RequeueWorkload(ctx context.Context, info *workload.Info, reason RequeueReason) bool
RequeueWorkload requeues the workload ensuring that the queue and the workload still exist in the client cache and not admitted. It won't requeue if the workload is already in the queue (possible if the workload was updated).
func (*Manager) UpdateClusterQueue ¶
func (*Manager) UpdateLocalQueue ¶ added in v0.2.0
func (m *Manager) UpdateLocalQueue(q *kueue.LocalQueue) error
func (*Manager) UpdateSnapshot ¶ added in v0.5.0
UpdateSnapshot computes the new snapshot and replaces if it differs from the previous version. It returns true if the snapshot was actually updated.
type Option ¶ added in v0.6.0
type Option func(*options)
Option configures the manager.
func WithExcludedResourcePrefixes ¶ added in v0.7.0
WithExcludedResourcePrefixes sets the list of excluded resource prefixes
func WithPodsReadyRequeuingTimestamp ¶ added in v0.6.0
func WithPodsReadyRequeuingTimestamp(ts config.RequeuingTimestamp) Option
WithPodsReadyRequeuingTimestamp sets the timestamp that is used for ordering workloads that have been requeued due to the PodsReady condition.
type RequeueReason ¶ added in v0.2.0
type RequeueReason string
const ( RequeueReasonFailedAfterNomination RequeueReason = "FailedAfterNomination" RequeueReasonNamespaceMismatch RequeueReason = "NamespaceMismatch" RequeueReasonGeneric RequeueReason = "" RequeueReasonPendingPreemption RequeueReason = "PendingPreemption" )
type StatusChecker ¶ added in v0.2.0
type StatusChecker interface { // ClusterQueueActive returns whether the clusterQueue is active. ClusterQueueActive(name string) bool }
StatusChecker checks status of clusterQueue.