Skip to content

Commit ad2ecac

Browse files
committed
feat: update RayCluster .status.reason field with pod creation error
fixes #603
1 parent 389ba00 commit ad2ecac

8 files changed

Lines changed: 38 additions & 0 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11138,6 +11138,9 @@ spec:
1113811138
each node group.
1113911139
format: int32
1114011140
type: integer
11141+
reason:
11142+
description: Reason provides more information about current State
11143+
type: string
1114111144
state:
1114211145
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
1114311146
of cluster Important: Run "make" to regenerat'

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11696,6 +11696,9 @@ spec:
1169611696
of each node group.
1169711697
format: int32
1169811698
type: integer
11699+
reason:
11700+
description: Reason provides more information about current State
11701+
type: string
1169911702
state:
1170011703
description: 'INSERT ADDITIONAL STATUS FIELD - define observed
1170111704
state of cluster Important: Run "make" to regenerat'

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11752,6 +11752,10 @@ spec:
1175211752
of each node group.
1175311753
format: int32
1175411754
type: integer
11755+
reason:
11756+
description: Reason provides more information about current
11757+
State
11758+
type: string
1175511759
state:
1175611760
description: 'INSERT ADDITIONAL STATUS FIELD - define observed
1175711761
state of cluster Important: Run "make" to regenerat'
@@ -11851,6 +11855,10 @@ spec:
1185111855
of each node group.
1185211856
format: int32
1185311857
type: integer
11858+
reason:
11859+
description: Reason provides more information about current
11860+
State
11861+
type: string
1185411862
state:
1185511863
description: 'INSERT ADDITIONAL STATUS FIELD - define observed
1185611864
state of cluster Important: Run "make" to regenerat'

ray-operator/apis/ray/v1alpha1/raycluster_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ type RayClusterStatus struct {
117117
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
118118
// Service Endpoints
119119
Endpoints map[string]string `json:"endpoints,omitempty"`
120+
// Reason provides more information about current State
121+
Reason string `json:"reason,omitempty"`
120122
}
121123

122124
// RayNodeType the type of a ray node: head/worker

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11138,6 +11138,9 @@ spec:
1113811138
each node group.
1113911139
format: int32
1114011140
type: integer
11141+
reason:
11142+
description: Reason provides more information about current State
11143+
type: string
1114111144
state:
1114211145
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
1114311146
of cluster Important: Run "make" to regenerat'

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11696,6 +11696,9 @@ spec:
1169611696
of each node group.
1169711697
format: int32
1169811698
type: integer
11699+
reason:
11700+
description: Reason provides more information about current State
11701+
type: string
1169911702
state:
1170011703
description: 'INSERT ADDITIONAL STATUS FIELD - define observed
1170111704
state of cluster Important: Run "make" to regenerat'

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11752,6 +11752,10 @@ spec:
1175211752
of each node group.
1175311753
format: int32
1175411754
type: integer
11755+
reason:
11756+
description: Reason provides more information about current
11757+
State
11758+
type: string
1175511759
state:
1175611760
description: 'INSERT ADDITIONAL STATUS FIELD - define observed
1175711761
state of cluster Important: Run "make" to regenerat'
@@ -11851,6 +11855,10 @@ spec:
1185111855
of each node group.
1185211856
format: int32
1185311857
type: integer
11858+
reason:
11859+
description: Reason provides more information about current
11860+
State
11861+
type: string
1185411862
state:
1185511863
description: 'INSERT ADDITIONAL STATUS FIELD - define observed
1185611864
state of cluster Important: Run "make" to regenerat'

ray-operator/controllers/ray/raycluster_controller.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ func (r *RayClusterReconciler) rayClusterReconcile(request ctrl.Request, instanc
214214
if updateErr := r.updateClusterState(instance, rayiov1alpha1.Failed); updateErr != nil {
215215
r.Log.Error(updateErr, "RayCluster update state error", "cluster name", request.Name)
216216
}
217+
if updateErr := r.updateClusterReason(instance, err.Error()); updateErr != nil {
218+
r.Log.Error(updateErr, "RayCluster update reason error", "cluster name", request.Name)
219+
}
217220
return ctrl.Result{RequeueAfter: DefaultRequeueDuration}, err
218221
}
219222
// update the status if needed
@@ -979,3 +982,8 @@ func (r *RayClusterReconciler) updateClusterState(instance *rayiov1alpha1.RayClu
979982
instance.Status.State = clusterState
980983
return r.Status().Update(context.Background(), instance)
981984
}
985+
986+
func (r *RayClusterReconciler) updateClusterReason(instance *rayiov1alpha1.RayCluster, clusterReason string) error {
987+
instance.Status.Reason = clusterReason
988+
return r.Status().Update(context.Background(), instance)
989+
}

0 commit comments

Comments
 (0)