Skip to content

feat(rbgsa): support scalingAdapter for instanceSet, add resource age#140

Merged
cheyang merged 1 commit intosgl-project:mainfrom
Syspretor:feat/support-scaling-adapter-for-instanceset
Jan 13, 2026
Merged

feat(rbgsa): support scalingAdapter for instanceSet, add resource age#140
cheyang merged 1 commit intosgl-project:mainfrom
Syspretor:feat/support-scaling-adapter-for-instanceset

Conversation

@Syspretor
Copy link
Copy Markdown
Collaborator

@Syspretor Syspretor commented Jan 12, 2026

Ⅰ. Motivation

Ⅱ. Modifications

  1. Support scalingAdapter for instanceSet
  2. Add Age field for scalingAdapter CRD
  3. Add scalingAdapter related E2E test

Ⅲ. Does this pull request fix one issue?

fixes #XXXX

Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅴ. Describe how to verify it

VI. Special notes for reviews

Checklist

  • Format your code make fmt.
  • Add unit tests or integration tests.
  • Update the documentation related to the change.

@Syspretor Syspretor requested review from bcfre and cheyang January 12, 2026 12:00
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @Syspretor, 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 significantly enhances the RoleBasedGroupScalingAdapter by extending its capabilities to manage InstanceSet workloads, thereby broadening the types of applications that can leverage role-based scaling. It also improves the user experience by adding a crucial AGE field to the RoleBasedGroupScalingAdapter CRD, making resource monitoring more intuitive. The addition of comprehensive E2E tests for InstanceSet ensures the reliability and correctness of these new features.

Highlights

  • InstanceSet Scaling Adapter Support: The RoleBasedGroupScalingAdapter now supports InstanceSet workloads, including specific handling for leader-worker patterns within InstanceSet to correctly identify and scale leader replicas.
  • CRD Observability Enhancement: The RoleBasedGroupScalingAdapter Custom Resource Definition (CRD) has been updated to include an AGE column in its kubectl get output, providing quick visibility into the resource's creation time.
  • Expanded E2E Test Coverage: New end-to-end tests have been introduced to validate the scaling adapter functionality specifically for InstanceSet workloads, ensuring proper integration and behavior.

🧠 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
Copy Markdown

@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 support for scalingAdapter with InstanceSet workloads, adds an 'AGE' column to the scalingAdapter CRD for better observability, and expands the E2E tests to cover these new scenarios. The refactoring of extractLabelSelectorDefault is a significant improvement, simplifying the logic and removing unnecessary API calls. The changes are well-implemented and enhance the functionality and test coverage of the project. I have one suggestion in a test utility file to improve its robustness and consistency.

Comment thread test/e2e/framework/workloads/instanceset_expect.go Outdated
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Syspretor Syspretor force-pushed the feat/support-scaling-adapter-for-instanceset branch from c43017e to eca4cf0 Compare January 12, 2026 12:11
@RongGu RongGu requested a review from Copilot January 12, 2026 12:27
Copy link
Copy Markdown
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 pull request adds support for scaling adapter functionality to InstanceSet workloads in the RoleBasedGroup (RBG) system. The PR enhances the scalingAdapter controller to handle InstanceSet workloads in addition to StatefulSet and LeaderWorkerSet workloads, and adds an AGE column to the RoleBasedGroupScalingAdapter CRD for better observability.

Changes:

  • Extended scalingAdapter support to InstanceSet workload type with proper label selector logic
  • Added AGE field to scalingAdapter CRD for displaying resource creation time
  • Enhanced E2E tests to cover InstanceSet and InstanceSet with LeaderWorkerSet pattern scenarios

Reviewed changes

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

Show a summary per file
File Description
test/wrappers/role_wrapper.go Added WithLabels method to RoleWrapper for setting role labels in tests
test/e2e/testcase/scaling_adapter.go Expanded E2E tests to include InstanceSet and InstanceSet-LeaderWorkerSet pattern scaling scenarios
test/e2e/framework/workloads/workload_expect.go Added InstanceSet case to workload type switch for test expectations
test/e2e/framework/workloads/instanceset_expect.go New file implementing InstanceSetChecker for validating InstanceSet workload behavior
internal/controller/workloads/rolebasedgroupscalingadapter_controller.go Refactored label selector extraction to support InstanceSet workloads using common labels instead of unstructured queries
deploy/helm/rbgs/crds/workloads.x-k8s.io_rolebasedgroupscalingadapters.yaml Added AGE column with descriptions, changed REPLICAS type from string to integer
config/crd/bases/workloads.x-k8s.io_rolebasedgroupscalingadapters.yaml Added AGE column with descriptions, changed REPLICAS type from string to integer
api/workloads/v1alpha1/rolebasedgoupscalingadapter_types.go Updated kubebuilder annotations for AGE column and changed REPLICAS type to integer
api/workloads/v1alpha1/constant.go Added LeaderWorkerSet label constants including LwsWorkerIndexLabelKey

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

Comment thread deploy/helm/rbgs/crds/workloads.x-k8s.io_rolebasedgroupscalingadapters.yaml Outdated
Comment thread config/crd/bases/workloads.x-k8s.io_rolebasedgroupscalingadapters.yaml Outdated
Comment thread api/workloads/v1alpha1/rolebasedgoupscalingadapter_types.go Outdated
Comment thread internal/controller/workloads/rolebasedgroupscalingadapter_controller.go Outdated
@Syspretor Syspretor force-pushed the feat/support-scaling-adapter-for-instanceset branch from eca4cf0 to a99d716 Compare January 13, 2026 06:02
Copy link
Copy Markdown
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@cheyang cheyang merged commit 9e3b46a into sgl-project:main Jan 13, 2026
6 checks passed
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.

4 participants