KEDA deployer: default minReplicaCount prevents scale-to-zero
- Dominant language
- Go
- Stars
- 365
- Forks
- 223
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 25
Description
The KEDA deployer defaults `minReplicaCount` to `1`, which means functions never scale to zero — KEDA will only scale down to the configured minimum.
**Location:** `pkg/keda/deployer.go`
```go
minScale := int32(1)
```
This value is set on the HTTPScaledObject's `Replicas.Min`. For scale-to-zero to happen, `minReplicaCount` must be `0`.
**Current behavior:** Functions always keep at least 1 replica running, even with no traffic.
**Expected behavior:** Consider defaulting to `0` so functions can scale to zero when idle, which is one of KEDA's main features. Users who prefer to avoid cold-start latency can explicitly set `scale.min: 1` in their function config.
**Trade-off:** Changing the default to `0` enables scale-to-zero but introduces cold-start latency for the first request after idle. The KEDA HTTP add-on interceptor handles this by holding the request until a pod is ready, so requests aren't dropped — but latency increases.
Contributor guide
Research direction
Start in pkg/keda/deployer.go at the minScale default and trace how it is assigned to the HTTPScaledObject's Replicas.Min. Done means idle functions can scale to zero by default while users can still set scale.min: 1 explicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100