From 291ef7216a5bb80bfa41784327c04255489f6a9d Mon Sep 17 00:00:00 2001 From: "Yagyansh S. Kumar" Date: Wed, 3 Aug 2022 10:55:43 +0530 Subject: [PATCH] Bug Fix - Delete evicted pods after de-registration. --- controllers/githubactionrunner_controller.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/githubactionrunner_controller.go b/controllers/githubactionrunner_controller.go index 4333f167..8ece1fdf 100644 --- a/controllers/githubactionrunner_controller.go +++ b/controllers/githubactionrunner_controller.go @@ -364,6 +364,13 @@ func (r *GithubActionRunnerReconciler) handleFinalization(ctx context.Context, c if err := r.unregisterRunner(ctx, cr, item); err != nil { return err } + if isEvicted(&item.pod) { + logr.FromContextOrDiscard(ctx).Info("Deleting evicted pod", "podname", item.pod.Name) + err := r.DeleteResourceIfExists(ctx, &item.pod) + if err != nil { + return err + } + } if isCompleted(&item.pod) { logr.FromContextOrDiscard(ctx).Info("Deleting succeeded pod", "podname", item.pod.Name) err := r.DeleteResourceIfExists(ctx, &item.pod)