diff --git a/controllers/actions.github.com/ephemeralrunner_controller.go b/controllers/actions.github.com/ephemeralrunner_controller.go index 0590627f..39f3a16e 100644 --- a/controllers/actions.github.com/ephemeralrunner_controller.go +++ b/controllers/actions.github.com/ephemeralrunner_controller.go @@ -268,13 +268,15 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ log.Error(err, "Failed to fetch the pod") return ctrl.Result{}, err } + log.Info("Ephemeral runner pod does not exist. Creating new ephemeral runner") - // Pod was not found. Create if the pod has never been created - log.Info("Creating new EphemeralRunner pod.") result, err := r.createPod(ctx, ephemeralRunner, secret, log) switch { case err == nil: return result, nil + case kerrors.IsAlreadyExists(err): + log.Info("Runner pod already exists. Waiting for the pod event to be received") + return ctrl.Result{Requeue: true, RequeueAfter: 5 * time.Second}, nil case kerrors.IsInvalid(err) || kerrors.IsForbidden(err): log.Error(err, "Failed to create a pod due to unrecoverable failure") errMessage := fmt.Sprintf("Failed to create the pod: %v", err)