Skip to content

Commit 5e741e2

Browse files
committed
1 parent c3b17f3 commit 5e741e2

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
@@ -141,6 +141,8 @@ type RayClusterStatus struct {
141141
// LastUpdateTime indicates last update timestamp for this cluster status.
142142
// +nullable
143143
LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`
144+
// StateTransitionTimes indicates the time of the last state transition for each state.
145+
StateTransitionTimes map[ClusterState]*metav1.Time `json:"stateTransitionTimes,omitempty"`
144146
// Service Endpoints
145147
Endpoints map[string]string `json:"endpoints,omitempty"`
146148
// 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
@@ -1294,6 +1294,13 @@ func (r *RayClusterReconciler) calculateStatus(ctx context.Context, instance *ra
12941294
timeNow := metav1.Now()
12951295
newInstance.Status.LastUpdateTime = &timeNow
12961296

1297+
if instance.Status.State != newInstance.Status.State {
1298+
if newInstance.Status.StateTransitionTimes == nil {
1299+
newInstance.Status.StateTransitionTimes = make(map[rayv1.ClusterState]*metav1.Time)
1300+
}
1301+
newInstance.Status.StateTransitionTimes[newInstance.Status.State] = &timeNow
1302+
}
1303+
12971304
return newInstance, nil
12981305
}
12991306

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)