chore: Add comment on lastSyncTime in runnerset controller

This commit is contained in:
Yusuke Kuoka 2022-03-03 09:56:12 +00:00
parent c21fa75afa
commit 138e326705
1 changed files with 7 additions and 0 deletions

View File

@ -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 {