feat: default scale down flag (#963)

Resolves #899

Co-authored-by: Callum <[email protected]>
Co-authored-by: Yusuke Kuoka <[email protected]>
This commit is contained in:
Callum Tait
2022-04-20 11:09:09 +09:00
committed by GitHub
co-authored by Callum Yusuke Kuoka
parent 13bfa2da4e
commit 24aae58dbc
3 changed files with 25 additions and 19 deletions
@@ -47,13 +47,13 @@ const (
// HorizontalRunnerAutoscalerReconciler reconciles a HorizontalRunnerAutoscaler object
type HorizontalRunnerAutoscalerReconciler struct {
client.Client
GitHubClient *github.Client
Log logr.Logger
Recorder record.EventRecorder
Scheme *runtime.Scheme
CacheDuration time.Duration
Name string
GitHubClient *github.Client
Log logr.Logger
Recorder record.EventRecorder
Scheme *runtime.Scheme
CacheDuration time.Duration
DefaultScaleDownDelay time.Duration
Name string
}
const defaultReplicas = 1
@@ -497,7 +497,7 @@ func (r *HorizontalRunnerAutoscalerReconciler) computeReplicasWithCache(log logr
if hra.Spec.ScaleDownDelaySecondsAfterScaleUp != nil {
scaleDownDelay = time.Duration(*hra.Spec.ScaleDownDelaySecondsAfterScaleUp) * time.Second
} else {
scaleDownDelay = DefaultScaleDownDelay
scaleDownDelay = r.DefaultScaleDownDelay
}
var scaleDownDelayUntil *time.Time