From 303866cccc095d9d2884265940b3004518165692 Mon Sep 17 00:00:00 2001 From: agga Date: Wed, 6 Nov 2024 17:36:21 +1100 Subject: [PATCH 1/2] Removing Runner when runner container Not Ready --- .../ephemeralrunner_controller.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/controllers/actions.github.com/ephemeralrunner_controller.go b/controllers/actions.github.com/ephemeralrunner_controller.go index 36ea1146ba..46655014e6 100644 --- a/controllers/actions.github.com/ephemeralrunner_controller.go +++ b/controllers/actions.github.com/ephemeralrunner_controller.go @@ -251,6 +251,20 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ return ctrl.Result{}, nil } + if pod.Status.Phase == corev1.PodPending && cs.State.Waiting.Reason == "ContainersNotReady" { + log.Info("Runner Container Not Ready, deleting the pod", + "PodPhase", pod.Status.Phase, + "PodReason", pod.Status.Reason, + "PodMessage", pod.Status.Message, + ) + + if err := r.deletePodAsFailed(ctx, ephemeralRunner, pod, log); err != nil { + log.Error(err, "failed to delete pod as failed on pod.Status.Phase: Failed") + return ctrl.Result{}, err + } + return ctrl.Result{}, nil + } + log.Info("Ephemeral runner container is still running") if err := r.updateRunStatusFromPod(ctx, ephemeralRunner, pod, log); err != nil { log.Info("Failed to update ephemeral runner status. Requeue to not miss this event") From 26a24d0b3f70fe8142f790fb596245d9b71ab643 Mon Sep 17 00:00:00 2001 From: agga Date: Thu, 7 Nov 2024 09:32:02 +1100 Subject: [PATCH 2/2] Fix Typo --- .../actions.github.com/ephemeralrunnerset_controller_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/actions.github.com/ephemeralrunnerset_controller_test.go b/controllers/actions.github.com/ephemeralrunnerset_controller_test.go index 0ea2027d9c..d264274998 100644 --- a/controllers/actions.github.com/ephemeralrunnerset_controller_test.go +++ b/controllers/actions.github.com/ephemeralrunnerset_controller_test.go @@ -1109,7 +1109,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func( startManagers(GinkgoT(), mgr) }) - It("should create a proxy secret and delete the proxy secreat after the runner-set is deleted", func() { + It("should create a proxy secret and delete the proxy secret after the runner-set is deleted", func() { secretCredentials := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: "proxy-credentials",