Read and Modify Workloads Offline
A scheduler integration needs to set schedulerName on every pod template. A JobSet stores those templates in its replicated jobs. A LeaderWorkerSet has separate templates for its leaders and workers. In this tutorial you use one Go program to read both workloads, set their scheduler, and check which templates changed. Everything runs against local YAML files.

Prerequisites
Install Git and Go. The quickstart’s go.mod declares the required Go version. With automatic toolchain selection enabled, Go 1.21 or later can download that version on the first run.
Quickstart Steps
Clone the repository and enter the tutorial’s Go module. It uses the SDK from the same checkout.
The first run downloads the Go dependencies. For each workload, the program prints its status, replicas, and resource requests. It then sets spec.schedulerName to kai-scheduler and adds the label app.kubernetes.io/managed-by=karta on each pod template. The verification lines show the values read back from the modified workload. The order of JobSet instances in those lines can vary.
Expected output for both workloads
To choose a different scheduler and print the updated YAML, run:
Look for schedulerName: volcano in both replicated jobs and in the leader and worker templates. Run go run . --help to list the flags.
How the program finds the templates
The program embeds jobset.yaml and lws.yaml. For each object it loads the corresponding definition from the catalog. The workload contains the values. The definition supplies the jq expressions that locate them.
The run function builds a component factory from the definition and the workload object, then builds a tree to read status, replicas, and resources:
The program reads the templates of each pod-bearing component with GetPodTemplateSpec. It updates the scheduler and label in those templates, keeps their instance IDs, and passes the changes to UpdatePodTemplateSpec. Finally, factory.GetResource() returns the updated workload. A controller can submit that object to the API server. You can follow the complete sequence in main.go.
Next steps
- Run the Kind controller tutorial to see updates reach a cluster.
- Write your first workload definition to describe another workload type.
- See Use the Go Library for the component API and the Workload Definition Spec for the supported mappings.