This commit is contained in:
Nikola Jokic
2025-12-11 16:24:33 +01:00
parent 71e9f54fda
commit 68c04fac00
2 changed files with 12 additions and 11 deletions

View File

@@ -316,26 +316,26 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
switch { switch {
case pod.Status.Reason == "Evicted": case pod.Status.Reason == "Evicted":
log.Info("Pod evicted; Deleting ephemeral runner or pod", log.Info("Pod evicted; Deleting ephemeral runner or pod",
"PodPhase", pod.Status.Phase, "podPhase", pod.Status.Phase,
"PodReason", pod.Status.Reason, "podReason", pod.Status.Reason,
"PodMessage", pod.Status.Message, "podMessage", pod.Status.Message,
) )
return ctrl.Result{}, r.deleteEphemeralRunnerOrPod(ctx, ephemeralRunner, pod, log) return ctrl.Result{}, r.deleteEphemeralRunnerOrPod(ctx, ephemeralRunner, pod, log)
case strings.HasPrefix(pod.Status.Reason, "OutOf"): // most likely a transient issue. case strings.HasPrefix(pod.Status.Reason, "OutOf"): // most likely a transient issue.
log.Info("Pod set the termination phase due to resource constraints, but container state is not terminated. Deleting ephemeral runner or pod", log.Info("Pod set the termination phase due to resource constraints, but container state is not terminated. Deleting ephemeral runner or pod",
"PodPhase", pod.Status.Phase, "podPhase", pod.Status.Phase,
"PodReason", pod.Status.Reason, "podReason", pod.Status.Reason,
"PodMessage", pod.Status.Message, "podMessage", pod.Status.Message,
) )
return ctrl.Result{}, r.deleteEphemeralRunnerOrPod(ctx, ephemeralRunner, pod, log) return ctrl.Result{}, r.deleteEphemeralRunnerOrPod(ctx, ephemeralRunner, pod, log)
default: default:
log.Info("Pod is in failed phase; updating ephemeral runner status", log.Info("Pod is in failed phase; updating ephemeral runner status",
"PodPhase", pod.Status.Phase, "podPhase", pod.Status.Phase,
"PodReason", pod.Status.Reason, "podReason", pod.Status.Reason,
"PodMessage", pod.Status.Message, "podMessage", pod.Status.Message,
) )
if err := r.updateRunStatusFromPod(ctx, ephemeralRunner, pod, log); err != nil { if err := r.updateRunStatusFromPod(ctx, ephemeralRunner, pod, log); err != nil {
log.Info("Failed to update ephemeral runner status. Requeue to not miss this event") log.Info("Failed to update ephemeral runner status. Requeue to not miss this event")
@@ -349,7 +349,8 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
log.Info("Waiting for runner container status to be available") log.Info("Waiting for runner container status to be available")
return ctrl.Result{}, nil return ctrl.Result{}, nil
case cs.State.Terminated == nil: // container is not terminated and pod phase is not faile< so runner is still running case cs.State.Terminated == nil: // container is not terminated and pod phase is not failed, so runner is still running
log.Info("Runner container is still running; updating ephemeral runner status")
if err := r.updateRunStatusFromPod(ctx, ephemeralRunner, pod, log); err != nil { if err := r.updateRunStatusFromPod(ctx, ephemeralRunner, pod, log); err != nil {
log.Info("Failed to update ephemeral runner status. Requeue to not miss this event") log.Info("Failed to update ephemeral runner status. Requeue to not miss this event")
return ctrl.Result{}, err return ctrl.Result{}, err

View File

@@ -745,7 +745,7 @@ var _ = Describe("EphemeralRunner", func() {
).Should(BeEquivalentTo(true)) ).Should(BeEquivalentTo(true))
}) })
It("It should re-create pod on OutOfsomething", func() { It("It should re-create pod on reason starting with OutOf", func() {
pod := new(corev1.Pod) pod := new(corev1.Pod)
Eventually( Eventually(
func() (bool, error) { func() (bool, error) {