Skip to content

fix(charts): make replicaCount work, add test/prod PDB + autoscaling … - #226

Open
NikhilMM89 wants to merge 1 commit into
mainfrom
fix/pdb-hpa-autoscaling
Open

NikhilMM89 wants to merge 1 commit into
mainfrom
fix/pdb-hpa-autoscaling

Conversation

@NikhilMM89

@NikhilMM89 NikhilMM89 commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

…values

The deployments and the HPAs disagreed about when autoscaling is active, so with the shipped defaults neither set a replica count.

deployment.yaml gated replicas on <component>.autoscaling.enabled alone, while hpa.yaml requires global.autoscaling AND that same flag. The defaults are global.autoscaling=false with backend/frontend autoscaling.enabled=true, so the HPA was not rendered and the replicas field was omitted as well — Kubernetes then silently defaulted to 1 and replicaCount was dead config. Setting replicaCount=3 rendered no replicas field at all; it now renders 3.

Both deployment templates now gate on the same condition as hpa.yaml, so exactly one of the HPA or the static replica count owns the field.

Move the per-environment shape out of merge.yml --set flags and into charts/app/values-test.yaml and values-prod.yaml. The deployed shape of test and prod was previously visible only as a long --set line in CI, which is invisible in code review and drifts from git.

Environment changes beyond the straight port of the existing flags:

  • TEST gains PDBs (minAvailable 1). Only prod had them, so a node drain could evict both test pods at once.
  • PROD PDB minAvailable 1 -> 2. At 1 a node drain could reduce production to a single pod.
  • maxReplicas raised above minReplicas (test 2->4, prod 5->7). Both were pinned min==max, which makes the HPA a fixed replica count and leaves targetCPUUtilizationPercentage with nothing to act on.

DEV/PR keep the chart defaults: single replica, Recreate, no PDB. f6bc3f-dev hosts every open PR environment in one namespace against a 3-core quota, so HPAs at minReplicas 3 per PR would exhaust it, and a PDB over a single replica blocks node drains indefinitely. Both are now documented in values.yaml rather than left implicit.

Verified with helm template for all three environments: dev renders replicas=1/Recreate/no HPA/no PDB; test renders no replicas field, RollingUpdate, HPA 2-4, PDB 1; prod renders no replicas field, RollingUpdate, HPA 5-7, PDB 2. minAvailable < minReplicas holds for every component. helm lint passes for all three value sets.

Description

Please provide a summary of the change and the issue fixed. Please include relevant context. List dependency changes.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation update

How Has This Been Tested?

  • New unit tests
  • New integrated tests
  • New component tests
  • New end-to-end tests
  • New user flow tests
  • No new tests are required
  • Manual tests (description below)
  • Updated existing tests

Checklist

  • I have read the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have already been accepted and merged

Further comments


Thanks for the PR!

Deployments, as required, will be available below:

Please create PRs in draft mode. Mark as ready to enable:

After merge, new images are deployed in:

…values

The deployments and the HPAs disagreed about when autoscaling is active,
so with the shipped defaults neither set a replica count.

deployment.yaml gated `replicas` on `<component>.autoscaling.enabled`
alone, while hpa.yaml requires `global.autoscaling` AND that same flag.
The defaults are global.autoscaling=false with backend/frontend
autoscaling.enabled=true, so the HPA was not rendered and the `replicas`
field was omitted as well — Kubernetes then silently defaulted to 1 and
`replicaCount` was dead config. Setting replicaCount=3 rendered no
replicas field at all; it now renders 3.

Both deployment templates now gate on the same condition as hpa.yaml, so
exactly one of the HPA or the static replica count owns the field.

Move the per-environment shape out of merge.yml --set flags and into
charts/app/values-test.yaml and values-prod.yaml. The deployed shape of
test and prod was previously visible only as a long --set line in CI,
which is invisible in code review and drifts from git.

Environment changes beyond the straight port of the existing flags:
- TEST gains PDBs (minAvailable 1). Only prod had them, so a node drain
  could evict both test pods at once.
- PROD PDB minAvailable 1 -> 2. At 1 a node drain could reduce production
  to a single pod.
- maxReplicas raised above minReplicas (test 2->4, prod 5->7). Both were
  pinned min==max, which makes the HPA a fixed replica count and leaves
  targetCPUUtilizationPercentage with nothing to act on.

DEV/PR keep the chart defaults: single replica, Recreate, no PDB.
f6bc3f-dev hosts every open PR environment in one namespace against a
3-core quota, so HPAs at minReplicas 3 per PR would exhaust it, and a PDB
over a single replica blocks node drains indefinitely. Both are now
documented in values.yaml rather than left implicit.

Verified with helm template for all three environments: dev renders
replicas=1/Recreate/no HPA/no PDB; test renders no replicas field,
RollingUpdate, HPA 2-4, PDB 1; prod renders no replicas field,
RollingUpdate, HPA 5-7, PDB 2. minAvailable < minReplicas holds for every
component. helm lint passes for all three value sets.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant