util

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 32 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultMaxNamespaceQueueDepth is the default number of NamespaceQueue
	// levels allowed below a cluster Queue.
	DefaultMaxNamespaceQueueDepth = 5

	// NamespaceQueueAuthorizedCondition identifies the parent authorization condition.
	NamespaceQueueAuthorizedCondition = "Authorized"
	// NamespaceQueueReadyCondition identifies the scheduling readiness condition.
	NamespaceQueueReadyCondition = "Ready"

	// NamespaceQueueReasonInvalidParentReference identifies an invalid parent reference.
	NamespaceQueueReasonInvalidParentReference = "InvalidParentReference"
	// NamespaceQueueReasonParentNotFound identifies a missing parent resource.
	NamespaceQueueReasonParentNotFound = "ParentNotFound"
	// NamespaceQueueReasonNamespaceNotAllowed identifies a denied namespace attachment.
	NamespaceQueueReasonNamespaceNotAllowed = "NamespaceNotAllowed"
	// NamespaceQueueReasonNamespaceAllowed identifies an authorized namespace attachment.
	NamespaceQueueReasonNamespaceAllowed = "NamespaceAllowed"
	// NamespaceQueueReasonParentNotReady identifies a parent that cannot schedule.
	NamespaceQueueReasonParentNotReady = "ParentNotReady"
	// NamespaceQueueReasonParentAuthorizationUnknown identifies an unobserved parent authorization.
	NamespaceQueueReasonParentAuthorizationUnknown = "ParentAuthorizationUnknown"
	// NamespaceQueueReasonParentNotAuthorized identifies a denied NamespaceQueue parent.
	NamespaceQueueReasonParentNotAuthorized = "ParentNotAuthorized"
	// NamespaceQueueReasonHierarchyCycle identifies a cyclic parent relationship.
	NamespaceQueueReasonHierarchyCycle = "HierarchyCycle"
	// NamespaceQueueReasonHierarchyDepthExceeded identifies a hierarchy beyond the configured limit.
	NamespaceQueueReasonHierarchyDepthExceeded = "HierarchyDepthExceeded"
	// NamespaceQueueReasonParentConstraintViolation identifies a resource constraint violation.
	NamespaceQueueReasonParentConstraintViolation = "ParentConstraintViolation"
	// NamespaceQueueReasonReady identifies a queue ready for scheduling.
	NamespaceQueueReasonReady = "Ready"
	// NamespaceQueueReasonQueueClosing identifies a queue draining before closure.
	NamespaceQueueReasonQueueClosing = "QueueClosing"
	// NamespaceQueueReasonQueueClosed identifies a closed queue.
	NamespaceQueueReasonQueueClosed = "QueueClosed"
	// NamespaceQueueReasonParentChangeRequiresDrain identifies a blocked parent change.
	NamespaceQueueReasonParentChangeRequiresDrain = "ParentChangeRequiresDrain"
	// NamespaceQueueReasonStatusChanged identifies a generic status transition.
	NamespaceQueueReasonStatusChanged = "StatusChanged"
)
View Source
const (
	DefaultSocketDir = "/tmp/klog-socks" // Default directory storing socket files
	SocketSuffix     = "-klog.sock"
	SocketDirEnvName = "DEBUG_SOCKET_DIR"
)
View Source
const (
	HardShardingMode = "hard"
	SoftShardingMode = "soft"
	NoneShardingMode = "none"
)
View Source
const NamespaceQueueReferencePrefix = "namespace/"

Variables

View Source
var ErrNamespaceQueueHierarchyCycle = errors.New("NamespaceQueue hierarchy contains a cycle")

ErrNamespaceQueueHierarchyCycle indicates that NamespaceQueue parent references form a cycle.

Functions

func GenerateComponentName

func GenerateComponentName(schedulerNames []string) string

GenerateComponentName generate component name volcano

func GenerateSchedulerName

func GenerateSchedulerName(schedulerNames []string) string

GenerateSchedulerName generate scheduler name for volcano job

func HasNamespaceQueuePrefix added in v1.16.0

func HasNamespaceQueuePrefix(reference string) bool

HasNamespaceQueuePrefix reports whether a workload reference is intended for the NamespaceQueue path. It deliberately does not validate the name.

func IsNamespaceAllowedByQueue added in v1.16.0

func IsNamespaceAllowedByQueue(
	queue *schedulingv1beta1.Queue,
	namespace string,
) bool

IsNamespaceAllowedByQueue reports whether a namespace may attach a NamespaceQueue to the cluster-scoped Queue.

func IsNamespaceQueueClosedAndDrained added in v1.16.0

func IsNamespaceQueueClosedAndDrained(namespaceQueue *schedulingv1beta1.NamespaceQueue) bool

IsNamespaceQueueClosedAndDrained reports whether a NamespaceQueue can be safely detached from its parent or deleted.

func IsNamespaceQueueDrained added in v1.16.0

func IsNamespaceQueueDrained(status schedulingv1beta1.NamespaceQueueStatus) bool

IsNamespaceQueueDrained reports whether no active workload or scheduler-owned runtime resource remains. Completed workloads do not prevent draining.

func IsNamespaceQueueRuntimeDrained added in v1.16.0

func IsNamespaceQueueRuntimeDrained(status schedulingv1beta1.NamespaceQueueStatus) bool

IsNamespaceQueueRuntimeDrained reports whether scheduler-owned runtime resources have been released.

func IsNamespaceQueueSchedulable added in v1.16.0

func IsNamespaceQueueSchedulable(
	generation int64,
	observedState string,
	conditions []metav1.Condition,
) bool

IsNamespaceQueueSchedulable reports whether the observed NamespaceQueue state is authoritative for generation and both controller conditions allow scheduling. State values are strings so the predicate can be shared by the versioned admission type and the scheduler's internal type.

func IsNamespaceQueueWorkloadDrained added in v1.16.0

func IsNamespaceQueueWorkloadDrained(status schedulingv1beta1.NamespaceQueueStatus) bool

IsNamespaceQueueWorkloadDrained reports whether no active PodGroup remains.

func LeaderElectionDefault added in v1.10.0

func LeaderElectionDefault(l *config.LeaderElectionConfiguration)

LeaderElectionDefault set the LeaderElectionConfiguration struct fields default value

func ListenAndServeKlogLogLevel added in v1.9.0

func ListenAndServeKlogLogLevel(componentName string, startupLogLevel string, socketDir string)

ListenAndServeKlogLogLevel registers a server on specific component to handle the HTTP request which set/get klog log level

func NamespaceQueueDepth added in v1.16.0

func NamespaceQueueDepth(
	namespaceQueue *schedulingv1beta1.NamespaceQueue,
	getParentNamespaceQueue NamespaceQueueParentGetter,
) (int, error)

NamespaceQueueDepth returns the number of NamespaceQueue levels below the resolved cluster Queue. Cluster Queue hierarchy levels are not included.

func PromHandler added in v1.11.0

func PromHandler() http.Handler

func SetupComponentGlobals added in v1.15.0

func SetupComponentGlobals(config *restclient.Config) error

SetupComponentGlobals discovers the API server version and sets Volcano's effective version + feature gate defaults to match the cluster. This makes defaults (like DRA) correct on older clusters.

func ValidateNamespaceQueueParentChange added in v1.16.0

func ValidateNamespaceQueueParentChange(
	oldQueue, newQueue *schedulingv1beta1.NamespaceQueue,
) error

ValidateNamespaceQueueParentChange rejects parent changes while a queue can still own workloads or scheduler runtime resources. Objects created before the current parent-reference grammar was enforced may be repaired by updating them to a valid parent reference.

func ValidateQueueResourceRelations added in v1.16.0

func ValidateQueueResourceRelations(capability, guarantee, deserved corev1.ResourceList) error

ValidateQueueResourceRelations validates object-local queue resource invariants without depending on API lookups.

func ValidateResourceListLimit added in v1.16.0

func ValidateResourceListLimit(value, limit corev1.ResourceList, fieldName string) error

ValidateResourceListLimit checks only resources explicitly configured by the limit. Missing limit entries are treated as unconstrained.

Types

type NamespaceQueueParentGetter added in v1.16.0

type NamespaceQueueParentGetter func(namespace, name string) (*schedulingv1beta1.NamespaceQueue, error)

NamespaceQueueParentGetter retrieves a NamespaceQueue parent by namespace and name.

type QueueReferenceScope added in v1.16.0

type QueueReferenceScope string
const (
	ClusterQueueReferenceScope   QueueReferenceScope = "cluster"
	NamespaceQueueReferenceScope QueueReferenceScope = "namespace"
)

type ResolvedQueueReference added in v1.16.0

type ResolvedQueueReference struct {
	Scope     QueueReferenceScope
	Namespace string
	Name      string
}

ResolvedQueueReference identifies a queue resource without coupling callers to scheduler IDs or controller-specific parent targets.

func ResolveNamespaceQueueParentReference added in v1.16.0

func ResolveNamespaceQueueParentReference(
	namespace, reference string,
) (ResolvedQueueReference, error)

ResolveNamespaceQueueParentReference resolves NamespaceQueue.spec.parent. An unqualified parent selects a NamespaceQueue in the same namespace.

func ResolveWorkloadQueueReference added in v1.16.0

func ResolveWorkloadQueueReference(
	workloadNamespace, reference, defaultQueue string,
) (ResolvedQueueReference, error)

ResolveWorkloadQueueReference resolves a Job, PodGroup, or queue annotation reference. An unqualified workload reference selects a cluster Queue.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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