Skip to content

add cli: kubectl rbg llm generate#128

Merged
cheyang merged 1 commit intosgl-project:mainfrom
bcfre:dev-1217
Dec 20, 2025
Merged

add cli: kubectl rbg llm generate#128
cheyang merged 1 commit intosgl-project:mainfrom
bcfre:dev-1217

Conversation

@bcfre
Copy link
Copy Markdown
Collaborator

@bcfre bcfre commented Dec 17, 2025

Ⅰ. Motivation

Ⅱ. Modifications

Ⅲ. 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.

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@whybeyoung
Copy link
Copy Markdown
Collaborator

LGTM

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 PR introduces a new CLI command kubectl rbg llm generate that integrates with AI Configurator (aiconfigurator) to automatically generate optimized RoleBasedGroup deployment configurations for LLM serving. The command generates Kubernetes YAML files for both disaggregated (separate prefill/decode workers with router) and aggregated (single worker) deployment modes.

Key Changes:

  • New llm generate subcommand that validates inputs, executes aiconfigurator, parses its output, and generates RBG deployment YAMLs
  • Integration with external aiconfigurator tool with version checking (requires >= 0.5.0)
  • Support for sglang backend with configurable GPU allocation, parallelism parameters, and SLO targets

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 30 comments.

Show a summary per file
File Description
go.mod Promotes gopkg.in/yaml.v3 from indirect to direct dependency for YAML parsing
doc/features/kubectl-rbg-llm-generate.md Comprehensive documentation including usage, examples, troubleshooting, and architecture
cmd/cli/cmd/root.go Registers the new llm command in the CLI root
cmd/cli/cmd/llm/llm.go Parent command for LLM-related operations
cmd/cli/cmd/llm/generate/types.go Data structures for configuration, worker parameters, and deployment plans
cmd/cli/cmd/llm/generate/renderer.go Renders RBG and Service YAML from configs using K8s apply configurations
cmd/cli/cmd/llm/generate/parser.go Locates and parses aiconfigurator output directories and YAML configs
cmd/cli/cmd/llm/generate/generate.go Main command implementation with validation and workflow orchestration
cmd/cli/cmd/llm/generate/executor.go Builds and executes aiconfigurator commands with proper arguments
cmd/cli/cmd/llm/generate/dependency.go Checks aiconfigurator availability and version compatibility
cmd/cli/cmd/llm/generate/dependency_test.go Unit tests for version checking logic
.gitignore Adds .qoder editor directory to ignore list

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

Comment thread cmd/cli/cmd/llm/generate/renderer.go Outdated
Comment thread cmd/cli/cmd/llm/generate/executor.go
Comment thread cmd/cli/cmd/llm/generate/dependency.go Outdated
Comment thread cmd/cli/cmd/llm/generate/parser.go Outdated
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread cmd/cli/cmd/llm/generate/generate.go
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread doc/features/kubectl-rbg-llm-generate.md Outdated
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread go.mod Outdated
@bcfre bcfre force-pushed the dev-1217 branch 4 times, most recently from 8c529e5 to 3f66563 Compare December 17, 2025 13:32
Comment thread cmd/cli/cmd/llm/generate/generate.go Outdated
@cheyang
Copy link
Copy Markdown
Collaborator

cheyang commented Dec 18, 2025

/gemini review

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 a new CLI command kubectl rbg llm generate to automate the generation of RoleBasedGroup configurations for LLM deployments by integrating with aiconfigurator. The changes are well-structured, adding new packages for dependency checking, command execution, parsing, and YAML rendering. The new command is well-documented.

My review focuses on improving robustness, security, and performance. Key findings include:

  • Potential bugs in how output directories are located, which could fail if latency parameters are floats.
  • Use of klog.Fatalf in several places, which can cause the program to terminate abruptly, leading to poor user experience. Errors should be handled gracefully.
  • A minor security concern regarding unvalidated keys for extra arguments, which could lead to argument injection.
  • Performance improvements by using strings.Builder for string construction.
  • Suggestions to improve reproducibility by avoiding :latest image tags.
  • Minor inconsistencies in the new documentation.

Overall, this is a great addition. Addressing these points will make the new command more robust and secure.

Comment thread cmd/cli/cmd/llm/generate/parser.go
Comment thread cmd/cli/cmd/llm/generate/parser.go Outdated
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread cmd/cli/cmd/llm/generate/dependency.go
Comment thread cmd/cli/cmd/llm/generate/executor.go
Comment thread cmd/cli/cmd/llm/generate/generate.go
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread doc/features/kubectl-rbg-llm-generate.md
Comment thread doc/features/kubectl-rbg-llm-generate.md Outdated
Comment thread cmd/cli/cmd/llm/generate/dependency.go
@RongGu
Copy link
Copy Markdown
Collaborator

RongGu commented Dec 19, 2025

/gemini review

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

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

Copilot reviewed 10 out of 11 changed files in this pull request and generated 14 comments.


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

Comment thread cmd/cli/cmd/llm/generate/executor.go
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread cmd/cli/cmd/llm/generate/generate.go
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread cmd/cli/cmd/llm/generate/parser.go
Comment thread cmd/cli/cmd/llm/generate/parser.go
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread cmd/cli/cmd/llm/generate/renderer.go
Comment thread cmd/cli/cmd/llm/generate/parser.go
@cheyang
Copy link
Copy Markdown
Collaborator

cheyang commented Dec 19, 2025

/gemini review

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 a significant new feature, kubectl rbg llm generate, which integrates with aiconfigurator to generate deployment configurations. The implementation is well-structured, breaking down the logic into clear steps: dependency checking, execution, parsing, and rendering. The use of cobra for the CLI and applyconfigurations for YAML generation is good. The addition of comprehensive documentation and tests is also appreciated.

I have a few suggestions to improve robustness, performance, and documentation accuracy. My main concerns are around error handling that could cause the program to crash and a discrepancy in the documentation.

Comment thread cmd/cli/cmd/llm/generate/parser.go
Comment thread cmd/cli/cmd/llm/generate/dependency.go
Comment thread cmd/cli/cmd/llm/generate/dependency.go
Comment thread doc/features/kubectl-rbg-llm-generate.md
@cheyang cheyang self-requested a review December 20, 2025 09: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 de37a3d into sgl-project:main Dec 20, 2025
10 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.

7 participants