Skip to content

Commit bf87764

Browse files
committed
[Feature] Support recreate pods for RayCluster using RayClusterSpec
Signed-off-by: win5923 <[email protected]>
1 parent 58c2aad commit bf87764

File tree

19 files changed

+304
-20
lines changed

19 files changed

+304
-20
lines changed

docs/reference/api.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ _Appears in:_
297297

298298
| Field | Description | Default | Validation |
299299
| --- | --- | --- | --- |
300+
| `upgradeStrategy` _[RayClusterUpgradeStrategy](#rayclusterupgradestrategy)_ | UpgradeStrategy defines the scaling policy used when upgrading the RayCluster | | |
300301
| `authOptions` _[AuthOptions](#authoptions)_ | AuthOptions specifies the authentication options for the RayCluster. | | |
301302
| `suspend` _boolean_ | Suspend indicates whether a RayCluster should be suspended.<br />A suspended RayCluster will have head pods and worker pods deleted. | | |
302303
| `managedBy` _string_ | ManagedBy is an optional configuration for the controller or entity that manages a RayCluster.<br />The value must be either 'ray.io/kuberay-operator' or 'kueue.x-k8s.io/multikueue'.<br />The kuberay-operator reconciles a RayCluster which doesn't have this field at all or<br />the field value is the reserved string 'ray.io/kuberay-operator',<br />but delegates reconciling the RayCluster with 'kueue.x-k8s.io/multikueue' to the Kueue.<br />The field is immutable. | | |
@@ -309,6 +310,35 @@ _Appears in:_
309310
| `workerGroupSpecs` _[WorkerGroupSpec](#workergroupspec) array_ | WorkerGroupSpecs are the specs for the worker pods | | |
310311

311312

313+
#### RayClusterUpgradeStrategy
314+
315+
316+
317+
318+
319+
320+
321+
_Appears in:_
322+
- [RayClusterSpec](#rayclusterspec)
323+
324+
| Field | Description | Default | Validation |
325+
| --- | --- | --- | --- |
326+
| `type` _[RayClusterUpgradeType](#rayclusterupgradetype)_ | Type represents the strategy used when upgrading the RayCluster Pods. Currently supports `Recreate` and `None`. | | |
327+
328+
329+
#### RayClusterUpgradeType
330+
331+
_Underlying type:_ _string_
332+
333+
334+
335+
336+
337+
_Appears in:_
338+
- [RayClusterUpgradeStrategy](#rayclusterupgradestrategy)
339+
340+
341+
312342
#### RayJob
313343

314344

helm-chart/kuberay-operator/crds/ray.io_rayclusters.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

helm-chart/kuberay-operator/crds/ray.io_rayservices.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/apis/ray/v1/raycluster_types.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import (
1111

1212
// RayClusterSpec defines the desired state of RayCluster
1313
type RayClusterSpec struct {
14+
// UpgradeStrategy defines the scaling policy used when upgrading the RayCluster
15+
// +optional
16+
UpgradeStrategy *RayClusterUpgradeStrategy `json:"upgradeStrategy,omitempty"`
1417
// AuthOptions specifies the authentication options for the RayCluster.
1518
// +optional
1619
AuthOptions *AuthOptions `json:"authOptions,omitempty"`
@@ -49,6 +52,21 @@ type RayClusterSpec struct {
4952
WorkerGroupSpecs []WorkerGroupSpec `json:"workerGroupSpecs,omitempty"`
5053
}
5154

55+
type RayClusterUpgradeType string
56+
57+
const (
58+
// During upgrade, Recreate strategy will delete all existing pods before creating new ones
59+
Recreate RayClusterUpgradeType = "Recreate"
60+
// No new pod will be created while the strategy is set to None
61+
RayClusterUpgradeNone RayClusterUpgradeType = "None"
62+
)
63+
64+
type RayClusterUpgradeStrategy struct {
65+
// Type represents the strategy used when upgrading the RayCluster Pods. Currently supports `Recreate` and `None`.
66+
// +optional
67+
Type *RayClusterUpgradeType `json:"type,omitempty"`
68+
}
69+
5270
// AuthMode describes the authentication mode for the Ray cluster.
5371
type AuthMode string
5472

ray-operator/apis/ray/v1/rayservice_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
// During upgrade, NewCluster strategy will create new upgraded cluster and switch to it when it becomes ready
2929
NewCluster RayServiceUpgradeType = "NewCluster"
3030
// No new cluster will be created while the strategy is set to None
31-
None RayServiceUpgradeType = "None"
31+
RayServiceUpgradeNone RayServiceUpgradeType = "None"
3232
)
3333

3434
// These statuses should match Ray Serve's application statuses

ray-operator/apis/ray/v1/zz_generated.deepcopy.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/config/crd/bases/ray.io_rayclusters.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/config/crd/bases/ray.io_rayjobs.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/config/crd/bases/ray.io_rayservices.yaml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)