Skip to content

fix(trainer): warn in check_compatibility when the Trainer release is unsupported - #670

Open
abhishekKokadwar wants to merge 1 commit into
kubeflow:mainfrom
abhishekKokadwar:fix/check-trainer-release-669
Open

abhishekKokadwar wants to merge 1 commit into
kubeflow:mainfrom
abhishekKokadwar:fix/check-trainer-release-669

Conversation

@abhishekKokadwar

Copy link
Copy Markdown
Member

Description

check_compatibility checked that the TrainJob CRD serves v1alpha1, which every Trainer 2.x release does, so a Trainer release outside the supported range (KUBEFLOW_TRAINER_VERSION_SPEC, today >=2.3.0,<2.4.0) passed and the agent was told to proceed (#669).

This adds a trainer_version check:

  • The release comes from the kubeflow-trainer-public ConfigMap (kubeflow_trainer_version), the same ConfigMap and KUBEFLOW_SYSTEM_NAMESPACE variable (default kubeflow-system) the SDK reads in KubernetesBackend.verify_backend().
  • In range: status: "pass". Outside: status: "warn" plus a recommendation naming the installed and supported versions.
  • Not readable (ConfigMap missing, 403, no kubeflow_trainer_version key, a custom-build value such as latest, or no packaging library): status: "unknown" with a short reason, never a failure.
  • Only runs when the CRD is installed, so a cluster without Trainer still gets the one existing blocker.

Choices to review

  1. Warning, not blocker. compatible and blockers do not change. A release outside the tested range often works, and someone running a newer Trainer on purpose should not be stopped by the planning tool. Easy to make it a blocker below the minimum only, if preferred.
  2. ConfigMap, not the controller image tag. The ConfigMap is what Trainer publishes for this and what the SDK reads; image tags differ for custom builds and mirrors.
  3. Release candidates count by their base version (prereleases=True), so v2.3.1-rc.1 is in range and v2.4.0-rc.1 is outside <2.4.0.
  4. No RBAC change. Reading the ConfigMap needs get configmaps in kubeflow-system; without it the check is unknown and the tool works as before.
  5. The unknown detail uses the API error's reason (Not Found, Forbidden) rather than str(e), which carries the full HTTP headers and body.

Related Issue

Fixes #669

Related: #514 widens the range to 2.4 (the check reads the constant, so it follows), #428 (readiness diagnostics, CRD only), #551 (check_compatibility docstring; this touches the "Checks performed" list, a small conflict at most).

Checklist

  • I have read the CONTRIBUTING guide
  • Tests pass locally (make test-python)
  • Linting passes (make verify)
  • Documentation updated (if applicable): the tool docstring lists the new check
  • My commits are signed off (git commit -s)

Testing

  • Unit tests

  • Integration tests

  • E2E tests

  • Manually tested (describe below)

  • Live, k3s v1.33.1 with the Trainer v2.2.0 controller, check_compatibility through an MCP client:

    ConfigMap trainer_version compatible
    v2.2.0 (as installed) warn, recommendation names v2.2.0 and the range true
    patched to v2.3.0 pass true
    deleted unknown, "... in namespace 'kubeflow-system': Not Found" true

    On main the same cluster reports compatible with no mention of the release (output in bug(trainer): check_compatibility passes on Trainer releases outside the supported range #669).

  • Unit: 15 new tests in planning_test.py (in range, below, above, a release candidate in and out of range, missing / forbidden / no key / no data / custom build, no packaging, the namespace variable, short error detail, and through check_compatibility: warns but stays compatible, not read without the CRD).

  • Mutation checks: skipping the call, reporting out of range as pass, and ignoring KUBEFLOW_SYSTEM_NAMESPACE each fail the new tests.

  • Full suite: 3227 passed; the only errors are the 2 Windows-only log_stream_test errors from test(trainer): test_byte_cap_does_not_advance_over_partial_lines errors on Windows because its test ID is 100,000 characters long #543, which also fail on main. ruff check, ruff format --check and uv lock --check clean.

  • Not tested: a live 403 (covered by a unit test), and Trainer installed outside kubeflow-system.

Assisted-by: AI coding agent

… unsupported

check_compatibility checked that the TrainJob CRD serves v1alpha1, which
every Trainer 2.x release does, so a release outside the supported range
(KUBEFLOW_TRAINER_VERSION_SPEC) passed and the agent was told to proceed.
On a cluster with Trainer v2.2.0 it reported compatible with no warning.

Read the release from the kubeflow-trainer-public ConfigMap (the same
ConfigMap and KUBEFLOW_SYSTEM_NAMESPACE variable the SDK uses) and add a
trainer_version check. Outside the range is a warning with a
recommendation, not a blocker: a newer release often works, and users may
run one on purpose. A release that cannot be read (missing ConfigMap, 403,
custom build tag, no packaging library) is reported as unknown and never
fails the tool.

Fixes kubeflow#669

Assisted-by: AI coding agent
Signed-off-by: Abhishek <abhikokadwar2@gmail.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 19:46
@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 abhijeet-dhumal 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

@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ce1dbcf and 8b4e201.

Files selected for processing: 2

  • kubeflow_mcp/trainer/api/planning.py
  • kubeflow_mcp/trainer/api/planning_test.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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

None yet

Development

Successfully merging this pull request may close these issues.

bug(trainer): check_compatibility passes on Trainer releases outside the supported range

2 participants