Repository navigation
fix(helm): two frontend replicas, never on the same node - #2342
Merged
Merged
Conversation
A spot reclaim took the single frontend replica down twice on 2026-10-19: about 40 s at 15:19Z (the replacement waited for a node) and about 5 s at 15:29Z. values-dev runs two replicas with a required hostname anti-affinity, so the autoscaler keeps a second spot node and a reclaim leaves one replica serving. The spot pool is capped at 2 nodes, so a surge pod would have nowhere to go: a rollout replaces one replica at a time instead (maxSurge 0, maxUnavailable 1). The chart gains frontend.strategy and frontend.affinity, empty by default, and the CI render asserts the dev values. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MCgCsf3UJRCPRbnNKxsECe
lilyshen0722
commented
Oct 19, 2026
lilyshen0722
left a comment
Contributor
Author
There was a problem hiding this comment.
Gate review @ 4989d03: PASS.
What I checked
- Template.
frontend-deployment.yamlpassesfrontend.strategythrough underspecandfrontend.affinityunderspec.template.spec. Both are wrapped inwith, so the basevalues.yamldefaults ({}) render nothing, and other installs keep the Kubernetes defaults. The indentation matches the neighbouringtolerationsblock. - Anti-affinity selector. It selects
app: frontend.commonly.frontend.selectorLabels(_helpers.tpl:78) puts that label on every frontend pod, so the rule matches its own replicas and nothing else. - Rollout.
maxSurge: 0withmaxUnavailable: 1replaces one replica at a time. With required hostname anti-affinity and the spot pool capped at two nodes, a surge pod would have nowhere to schedule. This shape can't deadlock, and one replica serves throughout. - Nothing else sets the frontend's replicas. No frontend HPA or PDB exists in the chart (only
backend-hpa.yaml), soreplicaCount: 2is the whole story. - Live cluster (read-only):
frontendis at replicas 2, surge/unavailable 0/1, topologyKeykubernetes.io/hostname. Its two pods are Ready on two different spot nodes. So this PR records what's already running, and Helm won't reset it to one replica on the next deploy. - CI guard. The new
tests.ymlassertions pin replicas, surge, unavailable, topologyKey and the selector label on the rendered dev chart, so a later values edit can't silently undo this. - Hygiene. The commit author is Lily with the noreply email. The head matches the branch (
ls-remote), and CI is green at this head. The diff carries no project id or registry host: the image line it sits next to is the existing placeholder.
Residual (accepted, not a defect). If a spot node is reclaimed, the replacement replica stays Pending until the autoscaler supplies a second node. Until then the site runs on one replica, which is the state the single-replica config was in all the time.
GATE: PASS
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.
Must merge before any Deploy Dev, including a Tuesday TASK-300 ship. The live frontend already runs this spec, applied by
kubectl patchon 10-19; without this PR, the next Helm upgrade resets it to one replica.Why. A spot reclaim took the single frontend replica down twice on 2026-10-19:
Change.
frontend.strategyandfrontend.affinity, passed through as written. Both are empty invalues.yaml, so the base render is unchanged.values-dev.yamlsets:replicaCount: 2;kubernetes.io/hostnameforapp: frontend. Two replicas never share a node, so the autoscaler keeps a second spot node and a reclaim leaves one replica serving;RollingUpdatewithmaxSurge: 0, maxUnavailable: 1. The spot pool is capped at 2 nodes, so a surge pod would have nowhere to schedule and the rollout would hang; replacing one replica at a time keeps one serving.Checks.
helm template: the dev render has replicas 2, the strategy and the anti-affinity. The base render's frontend is unchanged (replicas 1, no strategy, no affinity).kubectl create --dry-run=client -o json, equals the live object field for field: replicas, strategy, affinity, nodeSelector and tolerations. So the next Helm upgrade changes nothing for the frontend.k6dn(about 30 s), then each replica was replaced in turn. It finished in about 66 s.k6dnand79t7.https://commonly.me/returned 200 on 39 of 39 two-second probes throughout.Cost. A second spot n2-standard-2 while it runs, about $15/mo.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MCgCsf3UJRCPRbnNKxsECe