Skip to content

Commit

Permalink
Avoid trying to get metrics from non-running pod. (#1911)
Browse files Browse the repository at this point in the history
* Avoid trying to get metrics from non-running pod.

If the importer pod is not running, the attempt to get metrics can hit a
30-second HTTP timeout. For multi-stage imports, this causes the
transition to "Paused" to take much longer than it needs to.

Signed-off-by: Matthew Arnold <marnold@redhat.com>

* Return nil instead of new error.

Signed-off-by: Matthew Arnold <marnold@redhat.com>
  • Loading branch information
mrnold committed Sep 3, 2021
1 parent 6f8356c commit 33b43a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/datavolume-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,10 @@ func (r *DatavolumeReconciler) reconcileProgressUpdate(datavolume *cdiv1.DataVol
}
pod, err := r.getPodFromPvc(podNamespace, pvcUID)
if err == nil {
if pod.Status.Phase != corev1.PodRunning {
// Avoid long timeouts and error traces from HTTP get when pod is already gone
return reconcile.Result{}, nil
}
if err := updateProgressUsingPod(datavolume, pod); err != nil {
return reconcile.Result{}, err
}
Expand Down

0 comments on commit 33b43a6

Please sign in to comment.