Skip to content

Commit 9e68367

Browse files
machichimarueian
andauthored
[FEAT] show event message when raycluster not found in clusterSelector in rayjob (#4125)
* feat: show event message when raycluster not found * Apply suggestions from code review Signed-off-by: Rueian <[email protected]> --------- Signed-off-by: Rueian <[email protected]> Co-authored-by: Rueian <[email protected]>
1 parent 6114969 commit 9e68367

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

ray-operator/controllers/ray/rayjob_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,8 @@ func (r *RayJobReconciler) getOrCreateRayClusterInstance(ctx context.Context, ra
875875
if errors.IsNotFound(err) {
876876
logger.Info("RayCluster not found", "RayCluster", rayClusterNamespacedName)
877877
if len(rayJobInstance.Spec.ClusterSelector) != 0 {
878-
err := fmt.Errorf("we have choosed the cluster selector mode, failed to find the cluster named %v, err: %w", rayClusterNamespacedName.Name, err)
878+
err := fmt.Errorf("clusterSelector mode is enabled, but RayCluster %s/%s is not found: %w", rayClusterNamespacedName.Namespace, rayClusterNamespacedName.Name, err)
879+
r.Recorder.Eventf(rayJobInstance, corev1.EventTypeWarning, string(utils.RayClusterNotFound), "RayCluster %s/%s set in the clusterSelector is not found. It must be created manually", rayClusterNamespacedName.Namespace, rayClusterNamespacedName.Name)
879880
return nil, err
880881
}
881882

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ const (
313313
FailedToCreateRayCluster K8sEventType = "FailedToCreateRayCluster"
314314
FailedToDeleteRayCluster K8sEventType = "FailedToDeleteRayCluster"
315315
FailedToUpdateRayCluster K8sEventType = "FailedToUpdateRayCluster"
316+
RayClusterNotFound K8sEventType = "RayClusterNotFound"
316317

317318
// RayService event list
318319
InvalidRayServiceSpec K8sEventType = "InvalidRayServiceSpec"

0 commit comments

Comments
 (0)