Documentation ¶
Index ¶
- Variables
- func ApplyDefaultForSuspend(job GenericJob, manageJobsWithoutQueueName bool)
- func ForEachIntegration(f func(name string, cb IntegrationCallbacks) error) error
- func GetEmptyOwnerObject(owner *metav1.OwnerReference) client.Object
- func GetIntegrationsList() []string
- func GetWorkloadNameForOwnerRef(owner *metav1.OwnerReference) (string, error)
- func GetWorkloadNameForOwnerWithGVK(ownerName string, ownerGVK schema.GroupVersionKind) string
- func IsOwnerManagedByKueue(owner *metav1.OwnerReference) bool
- func ParentWorkloadName(job GenericJob) string
- func QueueName(job GenericJob) string
- func QueueNameForObject(object client.Object) string
- func RegisterIntegration(name string, cb IntegrationCallbacks) error
- func SetupWorkloadOwnerIndex(ctx context.Context, indexer client.FieldIndexer, gvk schema.GroupVersionKind) error
- func ValidateAnnotationAsCRDName(job GenericJob, crdNameAnnotation string) field.ErrorList
- func ValidateCreateForParentWorkload(job GenericJob) field.ErrorList
- func ValidateCreateForQueueName(job GenericJob) field.ErrorList
- func ValidateUpdateForParentWorkload(oldJob, newJob GenericJob) field.ErrorList
- func ValidateUpdateForQueueName(oldJob, newJob GenericJob) field.ErrorList
- type GenericJob
- type IntegrationCallbacks
- type JobReconciler
- type JobReconcilerInterface
- type JobWithCustomStop
- type JobWithPriorityClass
- type JobWithReclaimablePods
- type Option
- type Options
- type PodSetInfo
- type ReconcilerFactory
Constants ¶
This section is empty.
Variables ¶
var ( ErrChildJobOwnerNotFound = fmt.Errorf("owner isn't set even though %s annotation is set", controllerconsts.ParentWorkloadAnnotation) ErrUnknownWorkloadOwner = errors.New("workload owner is unknown") ErrWorkloadOwnerNotFound = errors.New("workload owner not found") ErrNoMatchingWorkloads = errors.New("no matching workloads") ErrExtraWorkloads = errors.New("extra workloads") )
var DefaultOptions = Options{}
Functions ¶
func ApplyDefaultForSuspend ¶
func ApplyDefaultForSuspend(job GenericJob, manageJobsWithoutQueueName bool)
func ForEachIntegration ¶ added in v0.4.0
func ForEachIntegration(f func(name string, cb IntegrationCallbacks) error) error
ForEachIntegration loops through the registered list of frameworks calling f, if at any point f returns an error the loop is stopped and that error is returned.
func GetEmptyOwnerObject ¶ added in v0.4.0
func GetEmptyOwnerObject(owner *metav1.OwnerReference) client.Object
GetEmptyOwnerObject returns an empty object of the owner's type, returns nil if the owner is not manageable by kueue.
func GetIntegrationsList ¶ added in v0.4.0
func GetIntegrationsList() []string
GetIntegrationsList returns the list of currently registered frameworks.
func GetWorkloadNameForOwnerRef ¶
func GetWorkloadNameForOwnerRef(owner *metav1.OwnerReference) (string, error)
func GetWorkloadNameForOwnerWithGVK ¶
func GetWorkloadNameForOwnerWithGVK(ownerName string, ownerGVK schema.GroupVersionKind) string
func IsOwnerManagedByKueue ¶ added in v0.4.0
func IsOwnerManagedByKueue(owner *metav1.OwnerReference) bool
IsOwnerManagedByKueue returns true if the provided owner can be managed by kueue.
func ParentWorkloadName ¶
func ParentWorkloadName(job GenericJob) string
func QueueName ¶
func QueueName(job GenericJob) string
func QueueNameForObject ¶ added in v0.3.2
func RegisterIntegration ¶ added in v0.4.0
func RegisterIntegration(name string, cb IntegrationCallbacks) error
RegisterIntegration registers a new framework, returns an error when attempting to register multiple frameworks with the same name of if a mandatory callback is missing.
func SetupWorkloadOwnerIndex ¶
func SetupWorkloadOwnerIndex(ctx context.Context, indexer client.FieldIndexer, gvk schema.GroupVersionKind) error
func ValidateAnnotationAsCRDName ¶
func ValidateAnnotationAsCRDName(job GenericJob, crdNameAnnotation string) field.ErrorList
func ValidateCreateForParentWorkload ¶ added in v0.4.0
func ValidateCreateForParentWorkload(job GenericJob) field.ErrorList
func ValidateCreateForQueueName ¶
func ValidateCreateForQueueName(job GenericJob) field.ErrorList
func ValidateUpdateForParentWorkload ¶
func ValidateUpdateForParentWorkload(oldJob, newJob GenericJob) field.ErrorList
func ValidateUpdateForQueueName ¶
func ValidateUpdateForQueueName(oldJob, newJob GenericJob) field.ErrorList
Types ¶
type GenericJob ¶
type GenericJob interface { // Object returns the job instance. Object() client.Object // IsSuspended returns whether the job is suspended or not. IsSuspended() bool // Suspend will suspend the job. Suspend() // RunWithPodSetsInfo will inject the node affinity and podSet counts extracting from workload to job and unsuspend it. RunWithPodSetsInfo(nodeSelectors []PodSetInfo) // RestorePodSetsInfo will restore the original node affinity and podSet counts of the job. RestorePodSetsInfo(nodeSelectors []PodSetInfo) // Finished means whether the job is completed/failed or not, // condition represents the workload finished condition. Finished() (condition metav1.Condition, finished bool) // PodSets will build workload podSets corresponding to the job. PodSets() []kueue.PodSet // IsActive returns true if there are any running pods. IsActive() bool // PodsReady instructs whether job derived pods are all ready now. PodsReady() bool // GetGVK returns GVK (Group Version Kind) for the job. GetGVK() schema.GroupVersionKind }
GenericJob if the interface which needs to be implemented by all jobs managed by the kueue's jobframework.
type IntegrationCallbacks ¶ added in v0.4.0
type IntegrationCallbacks struct { // NewReconciler creates a new reconciler NewReconciler ReconcilerFactory // SetupWebhook sets up the framework's webhook with the controllers manager SetupWebhook func(mgr ctrl.Manager, opts ...Option) error // JobType holds an object of the type managed by the integration's webhook JobType runtime.Object // SetupIndexes registers any additional indexes with the controllers manager // (this callback is optional) SetupIndexes func(ctx context.Context, indexer client.FieldIndexer) error // AddToScheme adds any additional types to the controllers manager's scheme // (this callback is optional) AddToScheme func(s *runtime.Scheme) error // Returns true if the provided owner reference identifies an object // managed by this integration // (this callback is optional) IsManagingObjectsOwner func(ref *metav1.OwnerReference) bool }
IntegrationCallbacks groups a set of callbacks used to integrate a new framework.
func GetIntegration ¶ added in v0.4.0
func GetIntegration(name string) (IntegrationCallbacks, bool)
GetIntegration looks-up the framework identified by name in the currently registered list of frameworks returning it's callbacks and true if found.
type JobReconciler ¶
type JobReconciler struct {
// contains filtered or unexported fields
}
JobReconciler reconciles a GenericJob object
func NewReconciler ¶
func NewReconciler( client client.Client, record record.EventRecorder, opts ...Option) *JobReconciler
func (*JobReconciler) IsParentJobManaged ¶ added in v0.4.0
func (r *JobReconciler) IsParentJobManaged(ctx context.Context, jobObj client.Object, namespace string) (bool, error)
IsParentJobManaged checks whether the parent job is managed by kueue.
func (*JobReconciler) ReconcileGenericJob ¶
func (r *JobReconciler) ReconcileGenericJob(ctx context.Context, req ctrl.Request, job GenericJob) (ctrl.Result, error)
type JobReconcilerInterface ¶ added in v0.4.0
type JobReconcilerInterface interface { reconcile.Reconciler SetupWithManager(mgr ctrl.Manager) error }
type JobWithCustomStop ¶ added in v0.4.0
type JobWithPriorityClass ¶ added in v0.4.0
type JobWithPriorityClass interface { // PriorityClass returns the job's priority class name. PriorityClass() string }
type JobWithReclaimablePods ¶ added in v0.4.0
type JobWithReclaimablePods interface { // ReclaimablePods returns the list of reclaimable pods. ReclaimablePods() []kueue.ReclaimablePod }
type Option ¶
type Option func(*Options)
Option configures the reconciler.
func WithManageJobsWithoutQueueName ¶
WithManageJobsWithoutQueueName indicates if the controller should reconcile jobs that don't set the queue name annotation.
func WithWaitForPodsReady ¶
WithWaitForPodsReady indicates if the controller should add the PodsReady condition to the workload when the corresponding job has all pods ready or succeeded.
type PodSetInfo ¶ added in v0.4.0
type ReconcilerFactory ¶ added in v0.4.0
type ReconcilerFactory func(client client.Client, record record.EventRecorder, opts ...Option) JobReconcilerInterface
func NewGenericReconciler ¶ added in v0.4.0
func NewGenericReconciler(newJob func() GenericJob, newWorkloadHandler func(client.Client) handler.EventHandler) ReconcilerFactory
NewGenericReconciler creates a new reconciler factory for a concrete GenericJob type. newJob should return a new empty job. newWorkloadHandler it's optional, if added it should return a new workload event handler.