Skip to content

[Feature] Forward Kubernetes Node infrastructure events to Ray custom resources - #4978

Open
richabanker wants to merge 4 commits into
ray-project:masterfrom
richabanker:poc-k8s-events-forwarder
Open

[Feature] Forward Kubernetes Node infrastructure events to Ray custom resources#4978
richabanker wants to merge 4 commits into
ray-project:masterfrom
richabanker:poc-k8s-events-forwarder

Conversation

@richabanker

@richabanker richabanker commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Why are these changes needed?

This PR implements a Selective Event Forwarder controller to KubeRay operator. It surfaces critical hardware and infrastructure failures (such as GPU XID errors or NCCL communication crashes) directly within the Ray Dashboard. By re-emitting Kubernetes Node events onto RayCluster and RayJob custom resources, Ray users can distinguish between application-level issues and underlying infrastructure faults without leaving their primary monitoring interface.

Design proposal: https://docs.google.com/document/d/1Isn6vbV3bugcmYn0uc_uH5To0zohiYmfnDDszaJ5KEw/edit?tab=t.0#heading=h.xcoop4webpbh

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • E2e test
    • Manual tests
      • Tested on a GKE cluster
image
  • This PR is not tested :(

@Future-Outlier Future-Outlier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is it possible to have e2e test for this controller? tks!

@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch 4 times, most recently from dc2fd2b to 14e5384 Compare August 4, 2026 01:42
@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch 6 times, most recently from 0dd59fa to 8ec334d Compare August 6, 2026 06:18
@richabanker
richabanker marked this pull request as ready for review August 6, 2026 06:18
@richabanker

Copy link
Copy Markdown
Contributor Author

is it possible to have e2e test for this controller? tks!

@Future-Outlier yes, added!

@richabanker richabanker changed the title poc: k8s node events forwarder [Feature] Forward Kubernetes Node infrastructure events to Ray custom resources Aug 6, 2026
@richabanker

richabanker commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Failing build associated with unrelated changes addressed by #5084

@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch from 8ec334d to 2ddbb71 Compare August 6, 2026 06:22
@richabanker

Copy link
Copy Markdown
Contributor Author

cc @andrewsykim

Comment thread ray-operator/controllers/ray/eventforwarder_controller.go
@rueian

rueian commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Hi @richabanker, could you rebase on or merge the master? The build error should be fixed then.

@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch from 2ddbb71 to 1c6bb3f Compare August 6, 2026 21:16
@win5923 win5923 self-assigned this Sep 3, 2026
Comment thread helm-chart/kuberay-operator/README.md Outdated
| eventForwarder.enabled | bool | `false` | Whether KubeRay operator should forward Kubernetes Node events to Ray custom resources. |
| eventForwarder.sources | list | `[]` | Only forward Node events emitted by these components, matched against both source.component and reportingController. Empty means all sources. |
| eventForwarder.reasons | list | `[]` | Only forward Node events with these reasons, e.g. ["XIDError"]. Empty means all reasons. |
| eventForwarder.types | list | `[]` | Only forward Node events with these types. Valid values are "Warning" and "Normal". The operator refuses to start on any other value. Empty defaults to "Warning" only. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shouldn't empty default to all types?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Intentionally kept "Normal" outside of the default value, since that could lead to high event-volume (including the ones that may not even be critical enough for troubleshooting)

@@ -10,3 +10,4 @@ spec:
- name: kuberay-operator
args:
- --feature-gates=RayClusterStatusConditions=true,RayJobDeletionPolicy=true,RayMultiHostIndexing=true,RayCronJob=true,RayServiceIncrementalUpgrade=true,SidecarSubmitterRestart=true,GCSFaultToleranceEmbeddedStorage=true,RayClusterMTLS=true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we still want a feature gate to indicate the maturity of the feature, WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, added a gate while keeping the config as well, to support the future case of when the feature graduates to GA/stable, but we still want the node-event-forwarding to be optional. Does it make sense to have this dual gating for the feature ?

Comment thread ray-operator/controllers/ray/eventforwarder_controller.go
where the operator is otherwise granted namespaced Roles only. Without it the
Event informer never syncs and the operator fails to start.
*/ -}}
{{- if and .Values.rbacEnable .Values.eventForwarder.enabled }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

{{- if and .Values.rbacEnable .Values.eventForwarder.enabled .Values.singleNamespaceInstall }}

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

t = e.EventTime.Time
}
if t.IsZero() {
t = e.CreationTimestamp.Time

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what about e.FirstTimestamp?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, added a guard for it as well, finally resorting to e.CreationTimestamp if t.IsZero() continues to be zero.

{{- if .Values.eventForwarder.sources -}}
{{- $argList = append $argList (printf "--event-forwarder-sources=%s" (join "," .Values.eventForwarder.sources)) -}}
{{- end -}}
{{- if .Values.eventForwarder.reasons -}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

consider guarding the suboptions with if .Values.eventForwarder.enabled

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@win5923

win5923 commented Sep 4, 2026

Copy link
Copy Markdown
Member

cc @fscnick @AndySung320 @justinyeh1995 to take a look

Comment thread ray-operator/controllers/ray/eventforwarder_controller.go Outdated
@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch 2 times, most recently from 6604951 to e6309c3 Compare September 4, 2026 20:49
@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch 2 times, most recently from eceb372 to 8cb9470 Compare September 4, 2026 21:18
@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch 3 times, most recently from 4c9e33f to 3c6eaba Compare September 4, 2026 21:43

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 3c6eaba. Configure here.

Comment thread ray-operator/controllers/ray/eventforwarder_controller.go
Comment thread helm-chart/kuberay-operator/templates/_helpers.tpl
@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch from 3c6eaba to 0611913 Compare September 5, 2026 04:12
@richabanker
richabanker force-pushed the poc-k8s-events-forwarder branch from 0611913 to c24f928 Compare September 5, 2026 04:36

// NodeEventForwarderTypes restricts event forwarding to Node events of these types
// ("Warning", "Normal"). Empty defaults to "Warning" only.
NodeEventForwarderTypes []string `json:"nodeEventForwarderTypes,omitempty"`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

While defaulting to Warning makes sense, it feels a bit counterintuitive since no value is explicitly passed in the argument, yet it still acts as a specific value. Additionally, this is inconsistent with the previous two arguments, where an empty value applies to all.

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.

8 participants