Skip to content

feat(api): allow per-TrainJob schedulerName overrides - #4265

Open
sfeng1996 wants to merge 1 commit into
kubeflow:masterfrom
sfeng1996:codex/trainjob-scheduler-name
Open

sfeng1996 wants to merge 1 commit into
kubeflow:masterfrom
sfeng1996:codex/trainjob-scheduler-name

Conversation

@sfeng1996

Copy link
Copy Markdown

What this PR does / why we need it:

Allow users to select a scheduler per TrainJob through the existing RuntimePatches API, without duplicating or modifying a shared TrainingRuntime.

For example, a platform can route the node ReplicatedJob to Volcano while leaving initializer and upload jobs on the scheduler defined by the runtime:

spec:
  runtimePatches:
    - manager: example.com/training-platform
      trainingRuntimeSpec:
        template:
          spec:
            replicatedJobs:
              - name: node
                template:
                  spec:
                    template:
                      spec:
                        schedulerName: volcano

Changes:

  • Add optional schedulerName to PodSpecPatch, with DNS subdomain validation (non-empty, at most 253 characters).
  • Reuse the existing keyed strategic merge. Omitting the field preserves the runtime configuration, and only the targeted ReplicatedJob is patched.
  • Preserve the existing RuntimePatches update restrictions; no additional controller merge logic is necessary.
  • Regenerate the CRDs, Go apply configuration, OpenAPI specification, and Python model. OptimizationJob CRD changes are generated because it embeds the shared TrainJob template schema.
  • Document scheduler selection separately from gang scheduling and queue configuration. This PR does not change PodGroup policy or configure a queue.

Tests cover both TrainingRuntime and ClusterTrainingRuntime, inherited/overridden scheduler names, unchanged non-targeted jobs, CRD validation (including explicit empty wire input), suspended/unsuspended updates, and propagation to the generated JobSet.

Which issue(s) this PR fixes:

No existing issue. Related API precedents: #3309 and #3324.

Validation:

  • GOTOOLCHAIN=go1.27.0 make generate (repeat generation produces no additional diff).
  • make test.
  • make test-integration VOLCANO_VERSION=v1.13.0 (152 specs).
  • make vet and controller-manager build.
  • make golangci-lint for affected packages, including the Kubernetes API linter.
  • Pre-commit checks for changed non-generated files.

The Volcano CRD version override is only for envtest setup: the Makefile's default download URL uses the dependency's pseudo-version, which returns HTTP 404. No Makefile or dependency changes are included.

Integration tests use local envtest; no production cluster or actual scheduler execution was modified or tested.

Checklist:

  • Docs included for the user-facing API.

Assisted-by: OpenAI Codex

Expose schedulerName through RuntimePatches without changing shared runtimes or adding scheduler-specific controller logic. Include validation, generated APIs, documentation, and regression coverage.

Assisted-by: OpenAI Codex
Signed-off-by: sunfeng <sunfeng@cetccloud.com>
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jeffwan for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sfeng1996 sfeng1996 closed this Oct 23, 2026
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in Kubeflow Trainer Oct 23, 2026
@sfeng1996 sfeng1996 reopened this Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant