feature(controller): allow autoscaler to scale down to 0 (#447)

This commit is contained in:
Christoph Brand 2021-05-02 09:46:51 +02:00 committed by GitHub
parent 0901456320
commit a18ac330bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -19,9 +19,10 @@ package controllers
import (
"context"
"fmt"
corev1 "k8s.io/api/core/v1"
"time"
corev1 "k8s.io/api/core/v1"
"github.com/summerwind/actions-runner-controller/github"
"k8s.io/apimachinery/pkg/types"
@ -186,7 +187,7 @@ func (r *HorizontalRunnerAutoscalerReconciler) SetupWithManager(mgr ctrl.Manager
func (r *HorizontalRunnerAutoscalerReconciler) computeReplicasWithCache(log logr.Logger, now time.Time, rd v1alpha1.RunnerDeployment, hra v1alpha1.HorizontalRunnerAutoscaler) (int, int, *int, error) {
minReplicas := defaultReplicas
if hra.Spec.MinReplicas != nil && *hra.Spec.MinReplicas > 0 {
if hra.Spec.MinReplicas != nil && *hra.Spec.MinReplicas >= 0 {
minReplicas = *hra.Spec.MinReplicas
}