Skip to content

Conversation

@zhiweideren
Copy link
Contributor

What type of PR is this?
enhancement

What this PR does / why we need it:
This proposal introduces LeaderWorkerSet (LWS) role support for Kthena ModelServing. The goal is to enable ModelServing to orchestrate leader/worker style “super-pod” workloads via LWS where it provides better lifecycle semantics (group-level rollout, coordinated restart behaviors, stable identity and networking patterns), while preserving the existing ModelServing user experience and integrations (ModelServer/ModelRoute selection and autoscaling).

Which issue(s) this PR fixes:
Fixes #407

Special notes for your reviewer:
Determine which solution to use

Does this PR introduce a user-facing change?:


@gemini-code-assist
Copy link

Summary of Changes

Hello @zhiweideren, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request proposes an enhancement to Kthena ModelServing by integrating LeaderWorkerSet (LWS) support. The primary goal is to enable ModelServing to effectively orchestrate leader/worker style "super-pod" workloads, benefiting from LWS's superior lifecycle management, coordinated restarts, and stable identity. The proposal evaluates various approaches and recommends "Extended Role Configuration," which allows specific ModelServing roles to be optionally backed by LWS resources, ensuring existing ModelServing routing and autoscaling integrations remain functional.

Highlights

  • LeaderWorkerSet Support: Introduces support for LeaderWorkerSet (LWS) within Kthena ModelServing to orchestrate leader/worker "super-pod" workloads.
  • Enhanced Lifecycle Semantics: Leverages LWS for improved group-level rollout, coordinated restart behaviors, and stable identity/networking patterns for these workloads.
  • Preserved User Experience: Ensures existing ModelServing user experience and integrations (ModelServer/ModelRoute selection and autoscaling) are maintained.
  • Recommended Solution: Adopts "Solution 3: Extended Role Configuration," which extends ModelServing.spec.template.roles[] to optionally be backed by LWS resources, allowing mixed deployments.
  • Clear Migration Path: Provides a clear path for existing ModelServing roles to opt into LWS without altering higher-level ModelServing constructs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a design proposal for adding LeaderWorkerSet (LWS) support to Kthena ModelServing. The proposal is well-structured, comprehensive, and clearly evaluates multiple solutions before recommending one. The recommended approach (Solution 3: Extended Role Configuration) seems sound and balances user experience with implementation complexity.

My feedback focuses on adding more specific details to the proposed API changes and clarifying the behavior for certain lifecycle operations, such as migrating a role between being LWS-backed and natively managed. These clarifications will help solidify the design and prevent potential user confusion.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces LeaderWorkerSet (LWS) role support for Kthena ModelServing, enabling users to submit LeaderWorkerSet Custom Resources that are automatically converted to ModelServing internal resources. The implementation creates a new LWS controller that watches LeaderWorkerSet CRs and maps them to ModelServing resources without requiring the native LWS controller to be deployed.

Key Changes

  • Adds a new LWS controller that translates LeaderWorkerSet specifications to ModelServing resources
  • Integrates LWS controller startup into the main controller lifecycle
  • Includes comprehensive proposal documentation explaining the architecture and mapping rules

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
pkg/model-serving-controller/controller/lws_controller.go New controller implementing LWS to ModelServing conversion and reconciliation logic
pkg/controller/controller.go Integration point for starting the LWS controller when ModelServing controller is enabled
docs/proposal/modelserving-role-support-leaderworkerset.md Detailed proposal document describing architecture, field mappings, and implementation requirements
go.mod Adds sigs.k8s.io/lws v0.7.0 dependency and indirect dependencies
go.sum Checksum entries for new dependencies
licenses/sigs.k8s.io/lws/LICENSE Apache 2.0 license for LWS dependency
licenses/golang.org/x/sync/LICENSE BSD license for golang.org/x/sync dependency
licenses/github.com/google/btree/LICENSE Apache 2.0 license for btree dependency
licenses/github.com/fsnotify/fsnotify/LICENSE BSD license for fsnotify dependency
docs/kthena/docs/reference/helm-chart-values.md Minor formatting change (trailing whitespace)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

workerReplicas = 0
}

roleReplicas := int32(1)
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Potential semantic mismatch between proposal and implementation. The proposal document (section 4.1, line 88) states that spec.replicas should map to ModelServing replicas, defining "the number of replicas for ServingGroup". However, the implementation sets roleReplicas to a hardcoded value of 1 (line 212) instead of using lws.Spec.Replicas. This means the LWS replicas are being used for ModelServing.Spec.Replicas (number of groups), while each role within a group always has exactly 1 replica. Verify if this mapping is correct according to the LWS semantics, as it may not align with user expectations from the LWS API.

Copilot uses AI. Check for mistakes.
@zhiweideren zhiweideren force-pushed the modelsering_support_lws_issuer_407 branch from 40f82b2 to 509fb04 Compare January 12, 2026 12:31
…oller

Signed-off-by: liuhaiyu <liuhaiyu13@huawei.com>
…oller

Signed-off-by: liuhaiyu <liuhaiyu13@huawei.com>
@zhiweideren zhiweideren force-pushed the modelsering_support_lws_issuer_407 branch from 509fb04 to 1a59635 Compare January 13, 2026 12:33
…oller

Signed-off-by: liuhaiyu <liuhaiyu13@huawei.com>
@zhiweideren zhiweideren force-pushed the modelsering_support_lws_issuer_407 branch from 1a59635 to b6e3c59 Compare January 13, 2026 12:55
@zhiweideren zhiweideren changed the title [draft] ModelServing Role Support LeaderWorkerSet ModelServing Role Support LeaderWorkerSet Jan 14, 2026
@hzxuzhonghu hzxuzhonghu requested a review from Copilot January 14, 2026 02:03
sigs.k8s.io/structured-merge-diff/v6 v6.3.0
sigs.k8s.io/yaml v1.6.0
volcano.sh/apis v0.0.0-20251222111824-40fed4793a6f
volcano.sh/apis v1.13.2-0.20260105020123-deb066235db8
Copy link
Member

Choose a reason for hiding this comment

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

@LiZhenCheng9527 Please help confirm whether the subgroup supported in in this release, otherwise should revert this

Copy link
Contributor

Choose a reason for hiding this comment

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

Support subgroup in this release

}

lwsInformerFactory.Start(ctx.Done())
kthenaInformerFactory.Start(ctx.Done())
Copy link
Member

Choose a reason for hiding this comment

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

I think start here maybe unsafe, since we have also started it in other controller. We should make sure all the resource event handler registered before informer started, otherwise we may miss some resource events

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The NewSharedInformerFactory and start were split to ensure that all event handlers were registered before all informer started

@hzxuzhonghu
Copy link
Member

@zhiweideren We should also add some test cases covering the translation, especially note the corner case

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

…odelServing

Signed-off-by: liuhaiyu <liuhaiyu13@huawei.com>
Signed-off-by: liuhaiyu <liuhaiyu13@huawei.com>
…lServing

Signed-off-by: liuhaiyu <liuhaiyu13@huawei.com>
@zhiweideren
Copy link
Contributor Author

@zhiweideren We should also add some test cases covering the translation, especially note the corner case

done.add lws_controller_test.go

hzxuzhonghu
hzxuzhonghu previously approved these changes Jan 19, 2026
Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

nit: now we create separate informers each controller, which could be shared.

…ttings in LWS controller

Signed-off-by: liuhaiyu <liuhaiyu13@huawei.com>
@hzxuzhonghu
Copy link
Member

/lgtm

@zl-cheng @LiZhenCheng9527 @git-malu take another look?

…elsering_support_lws_issuer_407

# Conflicts:
#	charts/kthena/charts/workload/templates/kthena-controller-manager/rbac/cluster-role.yaml
@volcano-sh-bot
Copy link
Contributor

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@hzxuzhonghu
Copy link
Member

/lgtm

@hzxuzhonghu
Copy link
Member

/approve

1 similar comment
@hzxuzhonghu
Copy link
Member

/approve

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

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

The pull request process is described 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

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

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

The pull request process is described 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

@volcano-sh-bot volcano-sh-bot merged commit 0259a9e into volcano-sh:main Jan 22, 2026
14 of 16 checks passed
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.

ModelServing Role Support LeaderWorkerSet

4 participants