• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zalando-incubator / es-operator / 20160591336
28%
master: 28%

Build:
Build:
LAST BUILD BRANCH: dependabot/github_actions/github-actions-76468cb07f
DEFAULT BRANCH: master
Ran 12 Dec 2025 08:21AM UTC
Jobs 1
Files 31
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Dec 2025 08:15AM UTC coverage: 27.622% (-0.1%) from 27.75%
20160591336

Pull #515

github

otrosien
Fix scale-to-zero bug when spec.replicas is nil

This fixes a critical regression introduced in PR #511 (commit c53f570)
where an EDS could scale to 0 replicas despite having minReplicas set.

Bug Scenario:
1. kubectl patch clears spec.replicas to nil
2. edsReplicas() returns 0 (per c53f570 change)
3. scaleEDS() writes eds.Spec.Replicas = &0 at line 935
4. Autoscaler returns no-op (e.g., excludeSystemIndices filters all indices)
5. No-op means scalingOperation.NodeReplicas = nil
6. Line 945 condition fails, so line 959 doesn't execute
7. Result: spec.replicas stays at 0, violating minReplicas

Root Cause:
The c53f570 change made edsReplicas() return 0 for autoscaling-enabled EDS
with nil replicas, intending to let the autoscaler calculate the initial
value. However, when the autoscaler returns a no-op (nil NodeReplicas),
there's no fallback to prevent spec.replicas from being set to 0.

Fix:
Add defensive check in scaleEDS() before writing to spec.replicas:
- When currentReplicas == 0 and minReplicas > 0:
  - First try status.replicas (reflects actual StatefulSet state)
  - Fall back to minReplicas for new/uninitialized EDS
- This prevents writing 0 when it would violate bounds

Test Coverage:
- Added TestScaleToZeroPrevention with 3 test cases
- Validates the defensive logic for all scenarios
- All existing tests continue to pass

Signed-off-by: Oliver Trosien <oliver.trosien@zalando.de>
Pull Request #515: Fix scale-to-zero bug when spec.replicas is nil

0 of 14 new or added lines in 1 file covered. (0.0%)

835 of 3023 relevant lines covered (27.62%)

0.31 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
14
16.05
-0.3% operator/elasticsearch.go
Jobs
ID Job ID Ran Files Coverage
1 20160591336.1 12 Dec 2025 08:21AM UTC 31
27.62
GitHub Action Run
Source Files on build 20160591336
  • Tree
  • List 31
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #515
  • PR Base - master (#20096974038)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc