Skip to content
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

[feat][plugin] support creating RayCluster with config file #3225

Merged
merged 2 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 186 additions & 77 deletions kubectl-plugin/pkg/cmd/create/create_cluster.go

Large diffs are not rendered by default.

380 changes: 326 additions & 54 deletions kubectl-plugin/pkg/cmd/create/create_cluster_test.go

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions kubectl-plugin/pkg/cmd/create/create_workergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,8 @@ func (options *CreateWorkerGroupOptions) Complete(cmd *cobra.Command, args []str
}

func (options *CreateWorkerGroupOptions) Validate() error {
// we must assign gke-tpu-accelerator and gke-tpu-topology in nodeSelector
// if worker-tpu is not 0
if options.workerTPU != "0" {
if err := util.ValidateTPUNodeSelector(options.numOfHosts, options.workerNodeSelectors); err != nil {
return fmt.Errorf("%w", err)
}
if err := util.ValidateTPU(&options.workerTPU, &options.numOfHosts, options.workerNodeSelectors); err != nil {
return fmt.Errorf("%w", err)
}
return nil
}
Expand Down
20 changes: 11 additions & 9 deletions kubectl-plugin/pkg/cmd/job/job_submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,20 @@ func (options *SubmitJobOptions) Run(ctx context.Context, factory cmdutil.Factor
// here, even though it will be ignored.
// See https://github.com/ray-project/kuberay/issues/3126.
Entrypoint: options.entryPoint,
RayClusterSpecObject: generation.RayClusterSpecObject{
RayClusterConfig: generation.RayClusterConfig{
RayVersion: &options.rayVersion,
Image: &options.image,
HeadCPU: &options.headCPU,
HeadMemory: &options.headMemory,
HeadGPU: &options.headGPU,
WorkerGroups: []generation.WorkerGroupConfig{
Head: &generation.Head{
CPU: &options.headCPU,
Memory: &options.headMemory,
GPU: &options.headGPU,
},
WorkerGroups: []generation.WorkerGroup{
{
WorkerCPU: &options.workerCPU,
WorkerMemory: &options.workerMemory,
WorkerGPU: &options.workerGPU,
WorkerReplicas: &options.workerReplicas,
CPU: &options.workerCPU,
Memory: &options.workerMemory,
GPU: &options.workerGPU,
Replicas: options.workerReplicas,
},
},
},
Expand Down
12 changes: 12 additions & 0 deletions kubectl-plugin/pkg/util/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ const (
// NodeSelector
NodeSelectorGKETPUAccelerator = "cloud.google.com/gke-tpu-accelerator"
NodeSelectorGKETPUTopology = "cloud.google.com/gke-tpu-topology"

DefaultHeadCPU = "2"
DefaultHeadMemory = "4Gi"
DefaultHeadGPU = "0"
DefaultHeadEphemeralStorage = ""
DefaultWorkerReplicas = int32(1)
DefaultWorkerCPU = "2"
DefaultWorkerMemory = "4Gi"
DefaultWorkerGPU = "0"
DefaultWorkerTPU = "0"
DefaultWorkerEphemeralStorage = ""
DefaultNumOfHosts = 1
)
Loading
Loading