Skip to content

Commit

Permalink
[Feature]: Add a new event type FailedToDeleteWorkerPodCollection (#2680
Browse files Browse the repository at this point in the history
)
  • Loading branch information
CheyuWu authored Dec 29, 2024
1 parent 9d25660 commit f2d7c1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ray-operator/controllers/ray/raycluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func (r *RayClusterReconciler) reconcilePods(ctx context.Context, instance *rayv
if suspendStatus == rayv1.RayClusterSuspending ||
(!statusConditionGateEnabled && instance.Spec.Suspend != nil && *instance.Spec.Suspend) {
if _, err := r.deleteAllPods(ctx, common.RayClusterAllPodsAssociationOptions(instance)); err != nil {
r.Recorder.Eventf(instance, corev1.EventTypeWarning, string(utils.FailedToDeletePod),
r.Recorder.Eventf(instance, corev1.EventTypeWarning, string(utils.FailedToDeletePodCollection),
"Failed deleting Pods due to suspension for RayCluster %s/%s, %v",
instance.Namespace, instance.Name, err)
return errstd.Join(utils.ErrFailedDeleteAllPods, err)
Expand Down Expand Up @@ -779,7 +779,7 @@ func (r *RayClusterReconciler) reconcilePods(ctx context.Context, instance *rayv
// Delete all workers if worker group is suspended and skip reconcile
if worker.Suspend != nil && *worker.Suspend {
if _, err := r.deleteAllPods(ctx, common.RayClusterGroupPodsAssociationOptions(instance, worker.GroupName)); err != nil {
r.Recorder.Eventf(instance, corev1.EventTypeWarning, string(utils.FailedToDeleteWorkerPod),
r.Recorder.Eventf(instance, corev1.EventTypeWarning, string(utils.FailedToDeleteWorkerPodCollection),
"Failed deleting worker Pods for suspended group %s in RayCluster %s/%s, %v", worker.GroupName, instance.Namespace, instance.Name, err)
return errstd.Join(utils.ErrFailedDeleteWorkerPod, err)
}
Expand Down
14 changes: 8 additions & 6 deletions ray-operator/controllers/ray/utils/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ const (
FailedToDeleteHeadPod K8sEventType = "FailedToDeleteHeadPod"

// Worker Pod event list
CreatedWorkerPod K8sEventType = "CreatedWorkerPod"
FailedToCreateWorkerPod K8sEventType = "FailedToCreateWorkerPod"
DeletedWorkerPod K8sEventType = "DeletedWorkerPod"
FailedToDeleteWorkerPod K8sEventType = "FailedToDeleteWorkerPod"
CreatedWorkerPod K8sEventType = "CreatedWorkerPod"
FailedToCreateWorkerPod K8sEventType = "FailedToCreateWorkerPod"
DeletedWorkerPod K8sEventType = "DeletedWorkerPod"
FailedToDeleteWorkerPod K8sEventType = "FailedToDeleteWorkerPod"
FailedToDeleteWorkerPodCollection K8sEventType = "FailedToDeleteWorkerPodCollection"

// Redis Cleanup Job event list
CreatedRedisCleanupJob K8sEventType = "CreatedRedisCleanupJob"
Expand All @@ -271,8 +272,9 @@ const (
InvalidRayServiceSpec K8sEventType = "InvalidRayServiceSpec"

// Generic Pod event list
DeletedPod K8sEventType = "DeletedPod"
FailedToDeletePod K8sEventType = "FailedToDeletePod"
DeletedPod K8sEventType = "DeletedPod"
FailedToDeletePod K8sEventType = "FailedToDeletePod"
FailedToDeletePodCollection K8sEventType = "FailedToDeletePodCollection"

// Ingress event list
CreatedIngress K8sEventType = "CreatedIngress"
Expand Down

0 comments on commit f2d7c1f

Please sign in to comment.