Skip to content

feat: add single Codeflare entrypoint with handler pattern and remove legacy auth#1091

Open
szaher wants to merge 11 commits into
mainfrom
single-entry
Open

feat: add single Codeflare entrypoint with handler pattern and remove legacy auth#1091
szaher wants to merge 11 commits into
mainfrom
single-entry

Conversation

@szaher
Copy link
Copy Markdown
Contributor

@szaher szaher commented May 18, 2026

Summary

  • Introduces Codeflare class as the single SDK entrypoint — authentication,
    namespace, retries, timeout, and logging configured once via SDKConfig
  • Adds cf.clusters.* and cf.jobs.* handler pattern (thin orchestrators
    that delegate to existing Cluster/RayJob classes)
  • Removes legacy auth classes (TokenAuthentication, KubeConfigFileAuthentication,
    Authentication, KubeConfiguration) — kube-authkit is now the only auth method
  • Updates all demo notebooks and E2E tests to use the new entrypoint

Usage

from codeflare_sdk import Codeflare, SDKConfig

cf = Codeflare(config=SDKConfig(
    auth=AuthConfig(method="auto"),
    namespace="my-project",
))

cluster = cf.clusters.create(name="train", num_workers=4)
cluster.apply()
job = cf.jobs.submit(name="train-job", entrypoint="python train.py")

Test plan

- 394 unit tests pass (32 new), 2 skipped
- 100% coverage on codeflare.py, 93% on auth.py
- Pre-commit (black, trailing whitespace, YAML) passes
- E2E tests updatedverify on OpenShift cluster
- Demo notebook 6_single_entrypoint.ipynb runs end-to-end on a real cluster

# What changes have been made
<!-- describe a summary of the change, add any additional motivation and context as needed -->

# Verification steps
<!-- Add thorough verification steps with sufficient level of detail for those without context to verify the change-->
<!-- AND Add thorough upgrade verification steps OR include a reason as to why it is not required -->
<!-- OR state "Not applicable" or "N/A" if your type of change doesn't require verification -->

## Checks
- [ ] I've made sure the tests are passing. 
- Testing Strategy
 - [ ] Unit tests
 - [ ] Manual tests
 - [ ] Testing is not required for this change

<!-- You can find out information on the review process at this link https://github.com/project-codeflare/codeflare/blob/develop/CONTRIBUTING.md#getting-feedback-on-your-contribution -->

szaher and others added 11 commits May 15, 2026 21:15
Introduces the design for a unified SDK entrypoint with SDKConfig,
ClusterHandler, and JobHandler using kube-authkit for authentication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ean set_api_client, update E2E/notebooks

- Remove print and verification call from set_api_client (now internal-only)
- Make namespace fallback consistent: all handler methods fall back to "default"
- Fix E2E tests: replace TokenAuthentication with Codeflare/SDKConfig
- Fix demo notebooks: use Codeflare(config=SDKConfig(auth=...)) instead of set_api_client
- Fix unused import (patch) and non-deterministic set ordering in error msg
- Add tests for namespace fallback in create() and submit()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Saad Zaher <szaher@redhat.com>
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2026

[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 laurafitzgerald for approval. For more information see the 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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.68%. Comparing base (ce6b6f6) to head (7fc63d9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1091      +/-   ##
==========================================
+ Coverage   96.61%   96.68%   +0.07%     
==========================================
  Files          23       24       +1     
  Lines        2306     2296      -10     
==========================================
- Hits         2228     2220       -8     
+ Misses         78       76       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant