fix min/max runners

This commit is contained in:
Nikola Jokic
2026-06-16 00:09:25 +02:00
parent 9dd6c62452
commit cecd6388f6
2 changed files with 9 additions and 8 deletions
@@ -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"`
@@ -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,