Integrate a custom Job with Kueue
Kueue integrates with a couple of Jobs, including Kubernetes batch Job, MPIJob, RayJob or JobSet.
There are two options for integrating a Job-like CRD with Kueue:
- As part of the Kueue repository
- Writing an external controller
This guide is for platform developers and focuses on the first approach. If there is a widely used Job which you would like supported in Kueue, please consider contributing. This page shows how to integrate a custom Job with Kueue.
Pre-requisites
- The custom Job CRD should have a suspend-like field, with semantics similar to the
suspend
field in a Kubernetes Job.
What you need to specify
- Configuration
- Controller
- Webhook
- Adjust build system
Configuration
Add your framework name to .integrations.frameworks
in controller_manager_config.yaml
Controller
Add a new folder in ./pkg/controller/jobs/
to host the implementation of the integration.
- Register the new framework in
func Init()
- Add RBAC Authorization using kubebuilder marker comments
- Add RBAC Authorization for priorityclasses, events, workloads, resourceflavors and any resources you want.
- Implement the
GenericJob
interface, and other optional interfaces defined by the framework.
Webhook
Create a webhook file in the dedicated directory for the integration.
You can learn how to create webhook in this page.
The framework provides some validation functions for common labels and annotations.
Your webhook should have ability to suspend jobs.
Adjust build system
-
Add required dependencies to compile the controller and webhook code. For example, using
go get github.com/kubeflow/mpi-operator@0.4.0
. -
Update Makefile for testing.
- Add commands which copy the crd of your custom job to the Kueue project.
- Add your custom job operator crd dependencies into
test-integration
.
For testing files, you can check the sample test files in completed integrations to learn how to implement them.
Completed integrations
Here are completed integrations you can learn from:
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.