Skip to content

Commit ade10dc

Browse files
davidxiasydneyw-spotify
authored andcommitted
1 parent 6186a7d commit ade10dc

File tree

7 files changed

+66
-14
lines changed

7 files changed

+66
-14
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ type RayClusterStatus struct {
140140
// LastUpdateTime indicates last update timestamp for this cluster status.
141141
// +nullable
142142
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
143+
// StateTransitionTimes indicates the time of the last state transition for each state.
144+
StateTransitionTimes map[ClusterState]*metav1.Time `json:"stateTransitionTimes,omitempty"`
143145
// Service Endpoints
144146
Endpoints map[string]string `json:"endpoints,omitempty"`
145147
// Head info

ray-operator/apis/ray/v1/zz_generated.deepcopy.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ray-operator/controllers/ray/raycluster_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,13 @@ func (r *RayClusterReconciler) calculateStatus(ctx context.Context, instance *ra
12521252
timeNow := metav1.Now()
12531253
newInstance.Status.LastUpdateTime = &timeNow
12541254

1255+
if instance.Status.State != newInstance.Status.State {
1256+
if newInstance.Status.StateTransitionTimes == nil {
1257+
newInstance.Status.StateTransitionTimes = make(map[rayv1.ClusterState]*metav1.Time)
1258+
}
1259+
newInstance.Status.StateTransitionTimes[newInstance.Status.State] = &timeNow
1260+
}
1261+
12551262
return newInstance, nil
12561263
}
12571264

ray-operator/pkg/client/applyconfiguration/ray/v1/rayclusterstatus.go

Lines changed: 29 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)