Skip to content

Conversation

win5923
Copy link
Collaborator

@win5923 win5923 commented Sep 29, 2025

Why are these changes needed?

Added defaultRayEnvs field to the Configuration API, allowing user to inject environment variables into all Ray containers across all RayCluster CRs.

Also update kuberay-operator helm chart, now generates a ConfigMap with the Configuration YAML and mounts it to the operator when defaultRayEnvs is set in values.yaml.

E2E

  1. Set defaultRayEnvs in values.yaml
defaultRayEnvs:
 - name: RAY_enable_open_telemetry
   value: "true"
 - name: RAY_metric_cardinality_level
   value: "recommended"
  1. Install the KubeRay Operator
helm install kuberay-operator --set image.repository=kuberay/operator --set image.tag=nightly ../helm-chart/kuberay-operator
  1. Deploy a RayCluster with ray:2.49.0
k apply -f config/samples/ray-cluster.sample.yaml

head pod:
image
worker pod:
image

The WorkerId tag has been removed for metrics such as ray_tasks.
image

Related issue number

Closes #4098

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@win5923 win5923 force-pushed the inject-specific-env-in-ray branch from bb9068f to 238677a Compare September 29, 2025 15:35
@win5923 win5923 force-pushed the inject-specific-env-in-ray branch from 238677a to 39c4813 Compare September 29, 2025 16:28
@win5923 win5923 changed the title [Feature] Inject specific env vars to all Ray containers in all RayCluster CRs [Feature] Support inject specific env vars to all Ray containers in all RayCluster CRs by by configuration Oct 1, 2025
@win5923 win5923 force-pushed the inject-specific-env-in-ray branch 3 times, most recently from 442f118 to 77048d8 Compare October 1, 2025 16:29
@win5923 win5923 marked this pull request as ready for review October 1, 2025 16:36
@win5923 win5923 marked this pull request as draft October 1, 2025 16:42
@win5923 win5923 marked this pull request as ready for review October 1, 2025 17:35
@win5923
Copy link
Collaborator Author

win5923 commented Oct 1, 2025

Hi @kevin85421, PTAL when you have time, thanks!

@win5923 win5923 force-pushed the inject-specific-env-in-ray branch from 77048d8 to bacdedd Compare October 1, 2025 17:52
Signed-off-by: win5923 <[email protected]>
@win5923 win5923 force-pushed the inject-specific-env-in-ray branch from bacdedd to 3bfb280 Compare October 1, 2025 17:55
@win5923 win5923 changed the title [Feature] Support inject specific env vars to all Ray containers in all RayCluster CRs by by configuration [Feature] Support inject specific env vars to all Ray containers in all RayCluster CRs by configuration Oct 1, 2025
@@ -0,0 +1,15 @@
{{- if .Values.defaultRayEnvs }}
Copy link
Collaborator

@rueian rueian Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check could be a problem if we want to add more fields to the configuration in the future. Is it possible that we always generate the configmap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice suggestion! I've updated to use configuration.enabled to control whether the ConfigMap should be created.
55852fd

@kevin85421
Copy link
Member

also cc @andrewsykim for review because you implemented the config API.

@win5923 win5923 force-pushed the inject-specific-env-in-ray branch from 070b4f7 to 55852fd Compare October 4, 2025 18:12
| batchScheduler.enabled | bool | `false` | |
| batchScheduler.name | string | `""` | |
| configuration.enabled | bool | `false` | Whether to enable the configuration feature. If enabled, a ConfigMap will be created and mounted to the operator. |
| configuration.defaultRayEnvs | list | `[]` | Default environment variables to inject into all Ray containers in all RayCluster CRs. This allows user to set feature flags across all Ray pods. Example: defaultRayEnvs: - name: RAY_enable_open_telemetry value: "true" - name: RAY_metric_cardinality_level value: "recommended" |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like RayEnvs is a bit confusing. The envs themselves can be unrelated to Ray. Maybe defaultContainerEnvs is better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to defaultContainerEnvs. Thanks! 8cf8ba3

@rueian rueian merged commit 6c9f859 into ray-project:master Oct 12, 2025
27 checks passed
@Future-Outlier Future-Outlier changed the title [Feature] Support inject specific env vars to all Ray containers in all RayCluster CRs by configuration [Feature] Support inject specific env vars to all Ray containers in all RayCluster CRs by ConfigMap Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Inject specific env vars to all Ray containers in all RayCluster CRs

3 participants