-
Notifications
You must be signed in to change notification settings - Fork 536
[refactor][operator]: make RayStartParams
optional
#3202
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
[refactor][operator]: make RayStartParams
optional
#3202
Conversation
a8efa58
to
a1e53d9
Compare
omitempty
on RayStartParams
c9781e1
to
80eb350
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the important changes are in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update tests
// TODO: Look for better workaround/fixes for RayStartParams. Currently using `WithRayStartParams()` requires | ||
// a non-empty map with valid key value pairs and will not populate the field with empty/nil values. This | ||
// isn't ideal as it forces the generated RayCluster yamls to use those parameters. | ||
headRayStartParams := map[string]string{ | ||
"dashboard-host": "0.0.0.0", | ||
} | ||
workerRayStartParams := map[string]string{ | ||
"metrics-export-port": "8080", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove this now since the map can be empty
98625b2
to
973af72
Compare
aa3243a
to
8b0650b
Compare
omitempty
on RayStartParams
RayStartParams
optional
8b0650b
to
6359479
Compare
expectedWorkerRayStartParams := map[string]string{ | ||
"metrics-export-port": "8080", | ||
} | ||
maps.Copy(expectedWorkerRayStartParams, testRayClusterYamlObject.WorkerRayStartParams) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the hard-coded metrics-export-port
now.
rayStartParams: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shows that when rayStartParams
aren't set in the RayClusterApplyConfiguration
, the field is absent from the serialized YAML.
05f6a13
to
557b90a
Compare
hm this is still failing 🤔 |
The changes look good to me. I got the failed test from logs: --- RUN TestAutoscalingRayService
[2025-03-31T19:12:16Z] rayservice_ha_test.go:82: [2025-03-31T19:06:25Z] Created ConfigMap test-ns-rtl5s/locust-runner-script successfully
[2025-03-31T19:12:16Z] rayservice_ha_test.go:85: [2025-03-31T19:06:25Z] Successfully applied testdata/rayservice.autoscaling.yaml to namespace test-ns-rtl5s
[2025-03-31T19:12:16Z] rayservice_ha_test.go:88: [2025-03-31T19:06:25Z] Created RayService test-ns-rtl5s/test-rayservice successfully
[2025-03-31T19:12:16Z] rayservice_ha_test.go:90: [2025-03-31T19:06:25Z] Waiting for RayService test-ns-rtl5s/test-rayservice to running
[2025-03-31T19:12:16Z] rayservice_ha_test.go:92:
[2025-03-31T19:12:16Z] Timed out after 300.001s.
[2025-03-31T19:12:16Z] Expected
[2025-03-31T19:12:16Z] <bool>: false
[2025-03-31T19:12:16Z] to be true
[2025-03-31T19:12:16Z] test.go:112: [2025-03-31T19:11:25Z] Retrieving Pod Container test-ns-rtl5s/test-rayservice-8dspv-head/ray-head logs
[2025-03-31T19:12:16Z] test.go:100: [2025-03-31T19:11:25Z] Creating ephemeral output directory as KUBERAY_TEST_OUTPUT_DIR env variable is unset
[2025-03-31T19:12:16Z] test.go:103: [2025-03-31T19:11:25Z] Output directory has been created at: /tmp/TestAutoscalingRayService3172182483/001
[2025-03-31T19:12:16Z] test.go:112: [2025-03-31T19:11:25Z] Retrieving Pod Container test-ns-rtl5s/test-rayservice-8dspv-head/autoscaler logs
[2025-03-31T19:12:16Z] ### FAIL: TestAutoscalingRayService (300.24s) Hope that logs help. |
cbe7c1f
to
dd7033e
Compare
We are planning on making `rayStartParams` optional and not present in the RayCluster K8s custom resource output if it's empty. ray-project/kuberay#3202 We need to make its autoscaler code not error when it's absent. This change is also needed for the integration tests in that PR to pass. Signed-off-by: David Xia <david@davidxia.com>
Need a review on ray-project/ray#51954. It should fix some of the buildkite/ray-ecosystem-ci-kuberay-ci/test-e2e-rayservice-nightly-operator failures |
We are planning on making `rayStartParams` optional and not present in the RayCluster K8s custom resource output if it's empty. ray-project/kuberay#3202 We need to make its autoscaler code not error when it's absent. This change is also needed for the integration tests in that PR to pass. Signed-off-by: David Xia <david@davidxia.com>
PR is blocked until ray releases a new version with ray-project/ray#51954 and we upgrade to that version in this repo |
depends on #3547 |
@davidxia, how about adding a key-value pair so that the CI tests won’t fail and I can merge the PR? I’ll bump the Ray version for the v1.4.0 release, which is a pretty heavyweight process. We can remove the key-value pair 8000 after bumping the version but before the release. |
used in `kubectl ray create cluster`. Signed-off-by: David Xia <david@davidxia.com>
in `RayCluster` CRD by marking it with `// +optional`. Make it not serialized when empty with `omitempty`. This change is backwards compatible on K8s clusters with existing RayCluster CRD and RayCluster CRs. * RayClusters with non-empty RayStartParams will serialize the same as before this change. * RayClusters with empty RayStartParams will serialize the same as before this change: as an empty map, `{}` in YAML. * New behavior: we can `kubectl create|apply` RayClusters that lack RayStartParams in both head and worker groups. Previously the K8s API would return validation errors requiring this field to be present. When we get these RayClusters back with `kubectl get raycluster -o yaml`, there's no `rayStartParams` field present. See [Optional vs. Required][1] in K8s API Conventions doc. > Optional fields have the following properties: > * They have the `+optional` comment tag in Go. > * They are a pointer type in the Go definition (e.g. AwesomeFlag *SomeFlag) > or have a built-in nil value (e.g. maps and slices). > * The API server should allow POSTing and PUTing a resource with this field > unset. The required changes to the RayCluster CRD YAML can be achieved with only `omitempty`, but we also add `// +optional` as recommended by the doc above. [1]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#optional-vs-required Signed-off-by: David Xia <david@davidxia.com>
dd7033e
to
e940dbe
Compare
@kevin85421 makes sense, updated in e940dbe |
Does this mean that the Autoscaler will fail if users specify |
Good point. Yes. We should make this backwards compatible. I’ll think a bit more on this. |
* `RayClusters` with `rayStartParams: {}` will continue to be serialized with the empty map. * `RayClusters` without `rayStartParams` will be serialized without the field. This prevents a backwards-incompatible change with RayClusters that use the autoscaler with Ray versions earlier than 2.45.0 which lack this change ray-project/ray#51954. Signed-off-by: David Xia <david@davidxia.com>
e940dbe
to
b1c0d28
Compare
@kevin85421 I think b1c0d28 makes backwards compatible. |
Open a follow up issue: #3580 |
No longer needed after ray-project#3202 Signed-off-by: David Xia <david@davidxia.com>
No longer needed after ray-project#3202 Signed-off-by: David Xia <david@davidxia.com>
No longer needed after ray-project#3202 Signed-off-by: David Xia <david@davidxia.com>
in
RayCluster
CRD by marking it with// +optional
.Make it not serialized when empty with
omitempty
.This change is backwards compatible on K8s clusters with existing
RayCluster CRD and RayCluster CRs.
before this change.
before this change: as an empty map,
{}
in YAML.kubectl create|apply
RayClusters that lackRayStartParams in both head and worker groups. Previously the K8s API
would return validation errors requiring this field to be present.
When we get these RayClusters back with
kubectl get raycluster -o yaml
, there's norayStartParams
field present.See Optional vs. Required in K8s API Conventions doc.
The required changes to the RayCluster CRD YAML can be achieved with only
omitempty
, but we also add// +optional
as recommended by the doc above.Signed-off-by: David Xia david@davidxia.com