Skip to content

[Refactor][kubectl-plugin] Share common struct for cluster-related CLI options to reduce duplication #3719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CheyuWu
Copy link
Contributor

@CheyuWu CheyuWu commented May 30, 2025

Why are these changes needed?

Currently, both SubmitJobOptions and CreateWorkerGroupOptions structs contain many overlapping fields related to Ray cluster configuration, such as resource specs (CPU, GPU, memory), image, version, and selectors.

Maintaining these separately leads to duplicated code and increases the risk of inconsistency when updating argument definitions.

  • Create a struct KubectlPluginCommonOptions in kubectl-plugin/pkg/util/types.go
  • Extract the common part of SubmitJobOptions and CreateWorkerGroupOptions.

The following element has been moved to kubectl-plugin/pkg/util/types.go

- CmdFactory          cmdutil.Factory
- IoStreams           *genericiooptions.IOStreams
- Namespace           string
- WorkerNodeSelectors map[string]string
- RayVersion          string
- WorkerCPU           string
- WorkerGPU           string
- WorkerMemory        string
- WorkerReplicas      int32

Related issue number

Closes #3582

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

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.

[Refactor][kubectl-plugin] Share common struct for cluster-related CLI options to reduce duplication
1 participant