From 933d7b6046d5f3bfa148fb0156d274ecd916800c Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Fri, 29 Jul 2022 00:49:42 +0800 Subject: [PATCH] Fix nil pointer dereference Signed-off-by: Kevin Su --- ray-operator/controllers/ray/rayjob_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ray-operator/controllers/ray/rayjob_controller.go b/ray-operator/controllers/ray/rayjob_controller.go index 1a9fe5fae8..af6ecee641 100644 --- a/ray-operator/controllers/ray/rayjob_controller.go +++ b/ray-operator/controllers/ray/rayjob_controller.go @@ -190,8 +190,8 @@ func (r *RayJobReconciler) Reconcile(ctx context.Context, request ctrl.Request) // Let's use rayJobInstance.Status.JobStatus to make sure we only delete cluster after the CR is updated. if isJobSucceedOrFailed(rayJobInstance.Status.JobStatus) && rayJobInstance.Status.JobDeploymentStatus == rayv1alpha1.JobDeploymentStatusRunning { if rayJobInstance.Spec.ShutdownAfterJobFinishes { - r.Log.V(3).Info("TTLSecondsAfterSetting", "end_time", rayJobInstance.Status.EndTime.Time, "now", time.Now(), "ttl", *rayJobInstance.Spec.TTLSecondsAfterFinished) if rayJobInstance.Spec.TTLSecondsAfterFinished != nil { + r.Log.V(3).Info("TTLSecondsAfterSetting", "end_time", rayJobInstance.Status.EndTime.Time, "now", time.Now(), "ttl", *rayJobInstance.Spec.TTLSecondsAfterFinished) ttlDuration := time.Duration(*rayJobInstance.Spec.TTLSecondsAfterFinished) * time.Second if rayJobInstance.Status.EndTime.Time.Add(ttlDuration).After(time.Now()) { // time.Until prints duration until target time. We add additional 2 seconds to make sure we have buffer and requeueAfter is not 0.