Skip to content

Commit 67152e9

Browse files
committed
add kubebuilder:validation
Signed-off-by: win5923 <ken89@kimo.com>
1 parent be2068f commit 67152e9

File tree

10 files changed

+24
-3
lines changed

10 files changed

+24
-3
lines changed

docs/reference/api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ _Appears in:_
323323

324324
| Field | Description | Default | Validation |
325325
| --- | --- | --- | --- |
326-
| `type` _[RayClusterUpgradeType](#rayclusterupgradetype)_ | Type represents the strategy used when upgrading the RayCluster Pods. Currently supports `Recreate` and `None`. | | |
326+
| `type` _[RayClusterUpgradeType](#rayclusterupgradetype)_ | Type represents the strategy used when upgrading the RayCluster Pods. Currently supports `Recreate` and `None`. | | Enum: [Recreate None] <br /> |
327327

328328

329329
#### RayClusterUpgradeType
@@ -332,7 +332,8 @@ _Underlying type:_ _string_
332332

333333

334334

335-
335+
_Validation:_
336+
- Enum: [Recreate None]
336337

337338
_Appears in:_
338339
- [RayClusterUpgradeStrategy](#rayclusterupgradestrategy)

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

Lines changed: 3 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: 3 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: 3 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ type RayClusterSpec struct {
5252
WorkerGroupSpecs []WorkerGroupSpec `json:"workerGroupSpecs,omitempty"`
5353
}
5454

55+
// +kubebuilder:validation:Enum=Recreate;None
5556
type RayClusterUpgradeType string
5657

5758
const (

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

Lines changed: 3 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: 3 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: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/config/samples/ray-cluster.sample.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ kind: RayCluster
66
metadata:
77
name: raycluster-kuberay
88
spec:
9+
upgradeStrategy:
10+
type: RollingUpdate
911
rayVersion: '2.52.0' # should match the Ray version in the image of the containers
1012
# Ray head pod template
1113
headGroupSpec:

ray-operator/controllers/ray/utils/validation.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func ValidateRayClusterMetadata(metadata metav1.ObjectMeta) error {
3838
}
3939

4040
func ValidateRayClusterUpgradeOptions(instance *rayv1.RayCluster) error {
41-
// only Recreate and None are valid upgradeType
4241
if instance.Spec.UpgradeStrategy != nil && instance.Spec.UpgradeStrategy.Type != nil &&
4342
*instance.Spec.UpgradeStrategy.Type != rayv1.Recreate &&
4443
*instance.Spec.UpgradeStrategy.Type != rayv1.RayClusterUpgradeNone {

0 commit comments

Comments
 (0)