Skip to content

Commit

Permalink
Keep registration-token fresh
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkarlsen committed Feb 2, 2021
1 parent e0b5cea commit 2185bcf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions controllers/githubactionrunner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ func (r *GithubActionRunnerReconciler) handleScaling(ctx context.Context, instan
return r.manageOutcome(ctx, instance, err)
}

// keep the registration token fresh
if err := r.createOrUpdateRegistrationTokenSecret(ctx, instance); err != nil {
return r.manageOutcome(ctx, instance, err)
}

// safety guard - always look for finalizers in order to unregister runners for pods about to delete
// pods could have been deleted by user directly and not through operator
if err = r.handleFinalization(ctx, instance, podRunnerPairs); err != nil {
Expand All @@ -123,10 +128,6 @@ func (r *GithubActionRunnerReconciler) handleScaling(ctx context.Context, instan
scale := funk.MaxInt([]int{instance.Spec.MinRunners - podRunnerPairs.numRunners(), 1}).(int)
logger.Info("Scaling up", "numInstances", scale)

if err := r.createOrUpdateRegistrationTokenSecret(ctx, instance); err != nil {
return r.manageOutcome(ctx, instance, err)
}

if err := r.scaleUp(ctx, scale, instance); err != nil {
return r.manageOutcome(ctx, instance, err)
}
Expand Down

0 comments on commit 2185bcf

Please sign in to comment.