fix(hpa): pause HPAs via scaleUp selectPolicy instead of breaking scaleTargetRef#56
Merged
Conversation
…leTargetRef Renaming the scaleTargetRef to a non-existent Deployment made the HPA emit FailedGetScale and turn the ArgoCD application Degraded for the whole migration window, and was reverted by any GitOps sync anyway. Pause instead with spec.behavior.scaleUp.selectPolicy: Disabled - the HPA stays Healthy but cannot start pods mid-migration, which is all we need. The pre-pause spec.behavior is saved in the wiremind.io/pre-pause-scale-behavior annotation and restored exactly on resume. A leftover pause is not cleaned up by GitOps (the live-only field is invisible to ArgoCD under server-side apply), so start_pods() and restore_stopped_pods() resume HPAs unconditionally for every tracked Deployment. The rename-repair path (re_enable_hpa) is kept one more minor for HPAs left broken by a pre-7.0.1 run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
haoov
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
disable_hpa()disables an HPA during migrations by renaming itsscaleTargetRefto a non-existentwm--disabled--kube-*Deployment. Two defects:FailedGetScale/AbleToScale=False, which ArgoCD's HPA health check reads as Degraded — every migration flips the app to Degraded (observed fleet-wide during the 2026-07-08 rollout), training humans and alerting to ignore Degraded and health-gating ArgoCD wave progression/PostSync hooks.scaleTargetRefand reverts it on any sync.Fix
Pause with the native mechanism instead:
spec.behavior.scaleUp.selectPolicy: Disabled. The HPA stays Healthy (no error events, no Degraded) but cannot scale up — the only thing a migration needs to prevent. The pre-pausespec.behavioris saved in thewiremind.io/pre-pause-scale-behaviorannotation and restored exactly on resume (or the field is cleared when there was none, avoiding server-defaulted leftovers).Safety trade-off handled: unlike the rename (accidentally healed by GitOps), a leftover pause is invisible to ArgoCD under server-side apply and would linger after a crashed run — so
start_pods()andrestore_stopped_pods()now resume HPAs unconditionally for every EDS-tracked Deployment (resuming an unpaused HPA is a no-op). The rename-repair path (re_enable_hpa) stays one more minor for HPAs left broken by a pre-7.0.1 run — TODO removal in 8.0.Versioning
7.0.1as a fix: no chart contract change (ensure_safe_runcompares major.minor, chart appVersion stays 7.0.0), consumers pick it up throughchartreuse~=7.0.0. No release train needed.Validation
v7.0.1-dev.1→ PyPI dev package → staging-demo migration; expected observation: app stays Healthy during migration, pause annotation +scaleUp: Disabledvisible on HPAs while the job runs, both gone after PostSync, zeroFailedGetScaleevents.🤖 Generated with Claude Code