From 138e326705ef1a2cae3f52a638061f179cb81e32 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Thu, 3 Mar 2022 09:56:12 +0000 Subject: [PATCH] chore: Add comment on lastSyncTime in runnerset controller --- controllers/runnerset_controller.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/runnerset_controller.go b/controllers/runnerset_controller.go index 85a38452..906b4691 100644 --- a/controllers/runnerset_controller.go +++ b/controllers/runnerset_controller.go @@ -139,6 +139,13 @@ func (r *RunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( // Even though the error message includes "Forbidden", this error's reason is "Invalid". // So we used to match these errors by using errors.IsInvalid. But that's another story... + // lastSyncTime becomes non-nil only when there are one or more statefulset(s) hence there are same number of runner pods. + // It's used to prevent runnerset-controller from recreating "completed ephemeral runners". + // This is needed to prevent runners from being terminated prematurely. + // See https://github.com/actions-runner-controller/actions-runner-controller/issues/911 for more context. + // + // This becomes nil when there are zero statefulset(s). That's fine because then there should be zero stateful(s) to be recreated either hence + // we don't need to guard with lastSyncTime. var lastSyncTime *time.Time for _, ss := range statefulsets {