INNER CODE UNIT · Go
shouldScaleDown
evryfs/github-actions-runner-operator · controllers/githubactionrunner_controller.go:179
func shouldScaleDown(podRunnerPairs podRunnerPairList, instance *garov1alpha1.GithubActionRunner) bool {
return podRunnerPairs.numRunners() > instance.Spec.MaxRunners || (podRunnerPairs.numIdle() > 1 && (podRunnerPairs.numRunners() > instance.Spec.MinRunners))
}
func (r *GithubActionRunnerReconciler) manageOutcome(ctx context.Context, instance *garov1alpha1.GithubActionRunner, issue error) (reconcile.Result, error) {
return r.ManageOutcomeWithRequeue(ctx, instance, issue, instance.Spec.ReconciliationPeriod.Duration)
}
// SetupWithManager configures the controller by using the passed mgr
func (r *GithubActionRunnerReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&garov1alpha1.GithubActionRunner{}).
Owns(&corev1.Pod{}).
Owns(&corev1.Secret{}).
WithOptions(controller.Options{MaxConcurrentReconciles: 1}).
WithEventFilter(predicate.Funcs{
// ignore updates to status: https://stuartleeks.com/posts/kubebuilder-event-filters-part-2-update/
UpdateFunc: func(e event.UpdateEvent) bool {