Skip to content

fix: bump wrapper library to get support for volumes in Job class#590

Merged
dbasunag merged 1 commit intoopendatahub-io:mainfrom
lugi0:fix/upstream-job-volumes
Sep 8, 2025
Merged

fix: bump wrapper library to get support for volumes in Job class#590
dbasunag merged 1 commit intoopendatahub-io:mainfrom
lugi0:fix/upstream-job-volumes

Conversation

@lugi0
Copy link
Copy Markdown
Contributor

@lugi0 lugi0 commented Sep 8, 2025

Bump the wrapper library to min. version 11.0.92 to onboard RedHatQE/openshift-python-wrapper#2509 and get support for volumes in the Job class

Description

How Has This Been Tested?

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Summary by CodeRabbit

  • Chores

    • Updated OpenShift Python wrapper dependency to require >=11.0.92, aligning with upstream improvements and bug fixes. No functional changes expected for end-users.
  • Tests

    • Refactored async job test fixtures to rely on native volume handling, removing custom helpers. Improves maintainability and reduces test-only complexity; no impact on product behavior.

@lugi0 lugi0 self-assigned this Sep 8, 2025
@lugi0 lugi0 requested review from a team, dbasunag and fege as code owners September 8, 2025 09:54
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 8, 2025

📝 Walkthrough

Walkthrough

Updated dependency constraint for openshift-python-wrapper in pyproject.toml. In tests, removed a custom Job wrapper class, switched fixtures to use the base Job with volumes passed directly, and deleted override logic that injected volumes post-serialization.

Changes

Cohort / File(s) Summary
Dependency update
pyproject.toml
Bumped openshift-python-wrapper constraint from >=11.0.57 to >=11.0.92; no other dependency changes.
Test fixture refactor
tests/model_registry/async_job/conftest.py
Removed JobWithVolumes subclass and its to_dict override; updated model_sync_async_job fixture to instantiate base Job with volumes parameter directly; removed related comments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 8, 2025

The following are automatically added/executed:

  • PR size label.
  • Run pre-commit
  • Run tox
  • Add PR author as the PR assignee
  • Build image based on the PR

Available user actions:

  • To mark a PR as WIP, add /wip in a comment. To remove it from the PR comment /wip cancel to the PR.
  • To block merging of a PR, add /hold in a comment. To un-block merging of PR comment /hold cancel.
  • To mark a PR as approved, add /lgtm in a comment. To remove, add /lgtm cancel.
    lgtm label removed on each new commit push.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To Cherry-pick a merged PR /cherry-pick <target_branch_name> to the PR. If <target_branch_name> is valid,
    and the current PR is merged, a cherry-picked PR would be created and linked to the current PR.
  • To build and push image to quay, add /build-push-pr-image in a comment. This would create an image with tag
    pr-<pr_number> to quay repository. This image tag, however would be deleted on PR merge or close action.
Supported labels

{'/verified', '/wip', '/build-push-pr-image', '/cherry-pick', '/hold', '/lgtm'}

Copy link
Copy Markdown
Contributor

@fege fege left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/model_registry/async_job/conftest.py (1)

203-225: Optional: set service account on the pod template to align with how creds are used.

Since the job relies on a specific ServiceAccount (you already pass sa_token), explicitly set the pod’s serviceAccountName to avoid surprises with default SA.

If supported by the wrapper in Job(...), pass the appropriate kwarg (e.g., service_account or service_account_name) with service_account.name.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 491db86 and bdb7fd8.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • pyproject.toml (1 hunks)
  • tests/model_registry/async_job/conftest.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: lugi0
PR: opendatahub-io/opendatahub-tests#487
File: tests/model_registry/async_job/utils.py:14-32
Timestamp: 2025-08-08T16:00:51.421Z
Learning: In opendatahub-io/opendatahub-tests, for tests under tests/model_registry/async_job, keep get_latest_job_pod (tests/model_registry/async_job/utils.py) simple: sorting by creationTimestamp string and selecting pods via label_selector="job-name=<job.name>" is acceptable; do not add datetime parsing or controller-uid filtering unless a concrete failure arises (per guidance from user lugi0).
📚 Learning: 2025-08-08T15:58:03.524Z
Learnt from: lugi0
PR: opendatahub-io/opendatahub-tests#487
File: tests/model_registry/async_job/constants.py:23-31
Timestamp: 2025-08-08T15:58:03.524Z
Learning: In opendatahub-io/opendatahub-tests, for tests under tests/model_registry/async_job (e.g., constants.py and related fixtures), runs start from a clean, known Model Registry state. Therefore, using static MODEL_ID, MODEL_VERSION_ID, and MODEL_ARTIFACT_ID values in MODEL_SYNC_CONFIG is intentional and acceptable; dynamic ID injection is not required for these async job tests (per guidance from user lugi0).

Applied to files:

  • tests/model_registry/async_job/conftest.py
🔇 Additional comments (5)
pyproject.toml (1)

65-65: Verify PyPI release, Python 3.13 support & Job.volumes
Manually confirm that openshift-python-wrapper 11.0.92 is published with artifacts on PyPI, its requires_python>=3.10 covers Python 3.13, and that ocp_resources.job.Job.__init__ exposes a volumes parameter (PR #2509).

tests/model_registry/async_job/conftest.py (4)

203-225: LGTM: Using native Job(volumes=...) removes brittle post-serialization patching.

This is the right direction and aligns the fixture with upstream capabilities.


177-201: Ensure env var values are strings.

Kubernetes env.value must be a string. Verify MODEL_SYNC_DESTINATION_OCI_ENABLE_TLS_VERIFY in MODEL_SYNC_CONFIG is a string (e.g., "true"/"false"), not a boolean.

You can assert at runtime before creating the Job:

-    environment_variables = [
+    environment_variables = [
+        # defensive check
+        # assert isinstance(MODEL_SYNC_CONFIG["DESTINATION_OCI_ENABLE_TLS_VERIFY"], str)

203-225: Sanity-check volumes land in the created Job spec.

To catch regressions in wrapper behavior, verify the volumes appear in spec.template.spec.volumes before waiting on completion.

Example one-liner after entering the context:

     ) as job:
+        # Verify volumes wired correctly (helps validate wrapper change)
+        assert any(v.get("name") == "source-credentials" for v in job.instance.spec.template.spec.volumes)
+        assert any(v.get("name") == "destination-credentials" for v in job.instance.spec.template.spec.volumes)
         job.wait_for_condition(condition="Complete", status="True")

1-380: No leftover references to JobWithVolumes found.

@lugi0
Copy link
Copy Markdown
Contributor Author

lugi0 commented Sep 8, 2025

Tested locally with previous vars and it works correctly, however with the current secret setup we need to wait for kubeflow/model-registry#1499 to be synced into downstream otherwise this test would fail

@dbasunag dbasunag merged commit 0e4bcb8 into opendatahub-io:main Sep 8, 2025
10 checks passed
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 8, 2025

Status of building tag latest: success.
Status of pushing tag latest to image registry: success.

mwaykole pushed a commit to mwaykole/opendatahub-tests that referenced this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants