From cecd6388f6b06d85ac3d2e011c86d74edc0ba7f0 Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Tue, 16 Jun 2026 00:09:25 +0200 Subject: [PATCH] fix min/max runners --- .../v1alpha1/autoscalinglistener_types.go | 10 +++++----- controllers/actions.github.com/resourcebuilder.go | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go b/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go index b35705f8..20f46135 100644 --- a/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go +++ b/apis/actions.github.com/v1alpha1/autoscalinglistener_types.go @@ -31,7 +31,7 @@ type AutoscalingListenerSpec struct { GitHubConfigSecret string `json:"githubConfigSecret,omitempty"` // +required - // +kubebuilder:validation:Minimum=1 + // +kubebuilder:validation:Minimum:=1 RunnerScaleSetID int `json:"runnerScaleSetId,omitempty"` // +required @@ -43,13 +43,13 @@ type AutoscalingListenerSpec struct { // +required EphemeralRunnerSetName string `json:"ephemeralRunnerSetName,omitempty"` - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum:=0 // +required - MaxRunners int `json:"maxRunners,omitempty"` + MaxRunners int `json:"maxRunners"` - // +kubebuilder:validation:Minimum=0 + // +kubebuilder:validation:Minimum:=0 // +required - MinRunners int `json:"minRunners,omitempty"` + MinRunners int `json:"minRunners"` // +required Image string `json:"image,omitempty"` diff --git a/controllers/actions.github.com/resourcebuilder.go b/controllers/actions.github.com/resourcebuilder.go index 7c50a092..bdce614a 100644 --- a/controllers/actions.github.com/resourcebuilder.go +++ b/controllers/actions.github.com/resourcebuilder.go @@ -122,13 +122,14 @@ func (b *ResourceBuilder) newAutoscalingListener(autoscalingRunnerSet *v1alpha1. } effectiveMinRunners := 0 + if autoscalingRunnerSet.Spec.MinRunners != nil { + effectiveMinRunners = *autoscalingRunnerSet.Spec.MinRunners + } + effectiveMaxRunners := math.MaxInt32 if autoscalingRunnerSet.Spec.MaxRunners != nil { effectiveMaxRunners = *autoscalingRunnerSet.Spec.MaxRunners } - if autoscalingRunnerSet.Spec.MinRunners != nil { - effectiveMinRunners = *autoscalingRunnerSet.Spec.MinRunners - } spec := v1alpha1.AutoscalingListenerSpec{ GitHubConfigURL: autoscalingRunnerSet.Spec.GitHubConfigUrl,