Skip to content

fix(hpa): stop flagging HPAs idling at their minimum replica count#1679

Open
AlexsJones wants to merge 1 commit into
mainfrom
fix/1667-hpa-scalinglimited-toofewreplicas
Open

fix(hpa): stop flagging HPAs idling at their minimum replica count#1679
AlexsJones wants to merge 1 commit into
mainfrom
fix/1667-hpa-scalinglimited-toofewreplicas

Conversation

@AlexsJones

Copy link
Copy Markdown
Member

Problem

The HPA analyzer (pkg/analyzer/hpa.go) treated any ScalingLimited=True condition as a failure, inspecting only condition.Status and never condition.Reason. An HPA idling at its minimum replica floor reports ScalingLimited=True, reason=TooFewReplicas with desired == current == min — normal, healthy behaviour. This produced false-positive Result CRs that fired alerts every reconcile cycle.

Fix

Skip the ScalingLimited failure when reason == TooFewReplicas and the desired replica count equals the configured minimum. All other ScalingLimited reasons, and TooFewReplicas above the floor, are still surfaced.

Tests

  • Added TestHPAAnalyzerScalingLimitedTooFewReplicasAtMinIgnored — idle-at-floor HPA produces no results.
  • Added TestHPAAnalyzerScalingLimitedTooFewReplicasAboveMinFlaggedTooFewReplicas above the floor is still flagged.
  • Existing ScalingLimited tests unchanged and passing (they don't set reason/minReplicas, so behaviour is unchanged).

Fixes #1667

🤖 Generated with Claude Code

@AlexsJones AlexsJones requested review from a team as code owners July 2, 2026 15:14
@github-project-automation github-project-automation Bot moved this to Proposed in Backlog Jul 2, 2026
…eplicas

The HPA analyzer flagged any ScalingLimited=True condition as a failure,
checking only condition.Status and never condition.Reason. An HPA idling
at its minimum replica floor reports ScalingLimited=True,
reason=TooFewReplicas with desired == current == min, which is normal,
healthy behaviour. This produced false-positive Result CRs that fired
alerts every reconcile cycle.

Skip the failure when reason is TooFewReplicas and the desired replica
count equals the configured minimum. Other ScalingLimited reasons, and
TooFewReplicas above the floor, are still surfaced.

Fixes #1667

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Proposed

Development

Successfully merging this pull request may close these issues.

[Bug] HPA analyzer flags ScalingLimited=True as an error regardless of reason it produces false positives when replicas are at minimum

1 participant