diff --git a/docs/reference/api.md b/docs/reference/api.md index 24c86fd9cb..ee4d290cc2 100644 --- a/docs/reference/api.md +++ b/docs/reference/api.md @@ -216,6 +216,7 @@ _Appears in:_ | `replicas` _integer_ | Replicas is the number of desired Pods for this worker group. See https://github.com/ray-project/kuberay/pull/1443 for more details about the reason for making this field optional. | | `minReplicas` _integer_ | MinReplicas denotes the minimum number of desired Pods for this worker group. | | `maxReplicas` _integer_ | MaxReplicas denotes the maximum number of desired Pods for this worker group, and the default value is maxInt32. | +| `numOfHosts` _integer_ | NumOfHosts denotes the number of hosts to create per replica. The default value is 1. | | `rayStartParams` _object (keys:string, values:string)_ | RayStartParams are the params of the start command: address, object-store-memory, ... | | `template` _[PodTemplateSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#podtemplatespec-v1-core)_ | Template is a pod template for the worker | | `scaleStrategy` _[ScaleStrategy](#scalestrategy)_ | ScaleStrategy defines which pods to remove | diff --git a/helm-chart/kuberay-operator/crds/ray.io_rayclusters.yaml b/helm-chart/kuberay-operator/crds/ray.io_rayclusters.yaml index 2269950127..9f037abe88 100644 --- a/helm-chart/kuberay-operator/crds/ray.io_rayclusters.yaml +++ b/helm-chart/kuberay-operator/crds/ray.io_rayclusters.yaml @@ -3766,6 +3766,10 @@ spec: default: 0 format: int32 type: integer + numOfHosts: + default: 1 + format: int32 + type: integer rayStartParams: additionalProperties: type: string diff --git a/helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml b/helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml index 29c8e5c87c..b1f5e2fccb 100644 --- a/helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml +++ b/helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml @@ -3752,6 +3752,10 @@ spec: default: 0 format: int32 type: integer + numOfHosts: + default: 1 + format: int32 + type: integer rayStartParams: additionalProperties: type: string diff --git a/helm-chart/kuberay-operator/crds/ray.io_rayservices.yaml b/helm-chart/kuberay-operator/crds/ray.io_rayservices.yaml index d20503a908..41cc1cac4d 100644 --- a/helm-chart/kuberay-operator/crds/ray.io_rayservices.yaml +++ b/helm-chart/kuberay-operator/crds/ray.io_rayservices.yaml @@ -3737,6 +3737,10 @@ spec: default: 0 format: int32 type: integer + numOfHosts: + default: 1 + format: int32 + type: integer rayStartParams: additionalProperties: type: string diff --git a/ray-operator/apis/ray/v1/raycluster_types.go b/ray-operator/apis/ray/v1/raycluster_types.go index 5869c683ac..9ea45e081c 100644 --- a/ray-operator/apis/ray/v1/raycluster_types.go +++ b/ray-operator/apis/ray/v1/raycluster_types.go @@ -56,6 +56,9 @@ type WorkerGroupSpec struct { // MaxReplicas denotes the maximum number of desired Pods for this worker group, and the default value is maxInt32. // +kubebuilder:default:=2147483647 MaxReplicas *int32 `json:"maxReplicas"` + // NumOfHosts denotes the number of hosts to create per replica. The default value is 1. + // +kubebuilder:default:=1 + NumOfHosts int32 `json:"numOfHosts,omitempty"` // RayStartParams are the params of the start command: address, object-store-memory, ... RayStartParams map[string]string `json:"rayStartParams"` // Template is a pod template for the worker diff --git a/ray-operator/apis/ray/v1/raycluster_types_test.go b/ray-operator/apis/ray/v1/raycluster_types_test.go index fe1faf26c7..0feeeaa9fc 100644 --- a/ray-operator/apis/ray/v1/raycluster_types_test.go +++ b/ray-operator/apis/ray/v1/raycluster_types_test.go @@ -58,6 +58,7 @@ var myRayCluster = &RayCluster{ Replicas: pointer.Int32(3), MinReplicas: pointer.Int32(0), MaxReplicas: pointer.Int32(10000), + NumOfHosts: 1, GroupName: "small-group", RayStartParams: map[string]string{ "port": "6379", diff --git a/ray-operator/apis/ray/v1/rayjob_types_test.go b/ray-operator/apis/ray/v1/rayjob_types_test.go index 66d42bef53..6c498a72a5 100644 --- a/ray-operator/apis/ray/v1/rayjob_types_test.go +++ b/ray-operator/apis/ray/v1/rayjob_types_test.go @@ -90,6 +90,7 @@ var expectedRayJob = RayJob{ Replicas: pointer.Int32(3), MinReplicas: pointer.Int32(0), MaxReplicas: pointer.Int32(10000), + NumOfHosts: 1, GroupName: "small-group", RayStartParams: map[string]string{ "port": "6379", @@ -213,7 +214,8 @@ var testRayJobJSON = `{ "replicas": 3, "minReplicas": 0, "maxReplicas": 10000, - "rayStartParams": { + "numOfHosts": 1, + "rayStartParams": { "num-cpus": "1", "port": "6379" }, diff --git a/ray-operator/apis/ray/v1/rayservice_types_test.go b/ray-operator/apis/ray/v1/rayservice_types_test.go index 11ca197404..9e263a4542 100644 --- a/ray-operator/apis/ray/v1/rayservice_types_test.go +++ b/ray-operator/apis/ray/v1/rayservice_types_test.go @@ -90,6 +90,7 @@ var myRayService = &RayService{ Replicas: pointer.Int32(3), MinReplicas: pointer.Int32(0), MaxReplicas: pointer.Int32(10000), + NumOfHosts: 1, GroupName: "small-group", RayStartParams: map[string]string{ "port": "6379", @@ -211,7 +212,8 @@ var expected = `{ "replicas":3, "minReplicas":0, "maxReplicas":10000, - "rayStartParams":{ + "numOfHosts":1, + "rayStartParams":{ "dashboard-agent-listen-port":"52365", "num-cpus":"1", "port":"6379" diff --git a/ray-operator/config/crd/bases/ray.io_rayclusters.yaml b/ray-operator/config/crd/bases/ray.io_rayclusters.yaml index 2269950127..9f037abe88 100644 --- a/ray-operator/config/crd/bases/ray.io_rayclusters.yaml +++ b/ray-operator/config/crd/bases/ray.io_rayclusters.yaml @@ -3766,6 +3766,10 @@ spec: default: 0 format: int32 type: integer + numOfHosts: + default: 1 + format: int32 + type: integer rayStartParams: additionalProperties: type: string diff --git a/ray-operator/config/crd/bases/ray.io_rayjobs.yaml b/ray-operator/config/crd/bases/ray.io_rayjobs.yaml index 29c8e5c87c..b1f5e2fccb 100644 --- a/ray-operator/config/crd/bases/ray.io_rayjobs.yaml +++ b/ray-operator/config/crd/bases/ray.io_rayjobs.yaml @@ -3752,6 +3752,10 @@ spec: default: 0 format: int32 type: integer + numOfHosts: + default: 1 + format: int32 + type: integer rayStartParams: additionalProperties: type: string diff --git a/ray-operator/config/crd/bases/ray.io_rayservices.yaml b/ray-operator/config/crd/bases/ray.io_rayservices.yaml index d20503a908..41cc1cac4d 100644 --- a/ray-operator/config/crd/bases/ray.io_rayservices.yaml +++ b/ray-operator/config/crd/bases/ray.io_rayservices.yaml @@ -3737,6 +3737,10 @@ spec: default: 0 format: int32 type: integer + numOfHosts: + default: 1 + format: int32 + type: integer rayStartParams: additionalProperties: type: string