Repository navigation
feat: add HPA & PodDisruptionBudget support - #202
Merged
Merged
Conversation
When autoscaling is enabled, omit the replicas field from the Deployment and StatefulSet so the HorizontalPodAutoscaler owns the replica count. Previously the StatefulSet hardcoded replicas: 1 (when replicaCountEnabled was false), which clashed with an HPA: a GitOps controller (ArgoCD) would reset the StatefulSet to 1 while the HPA scaled it back up, causing an endless reconcile loop. Adds a new autoscaling block in values.yaml and an hpa.yaml template (autoscaling/v2) targeting either the Deployment or StatefulSet. Fixes PLA-5974
Adds a policy/v1 PodDisruptionBudget template gated on podDisruptionBudget.enabled, with mutually-exclusive minAvailable/ maxUnavailable. Useful alongside multi-replica/HPA setups to keep pods available during voluntary disruptions (node drains, upgrades). Refs PLA-5974
Replace the inline if/else for the HPA scaleTargetRef kind with a reusable verdaccio.workloadKind helper.
Address PR review: default the PDB to maxUnavailable: 1 instead of minAvailable: 1.
Contributor
Author
|
@juanpicado can i please have a review on this? |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class autoscaling and disruption-budget support to the Verdaccio Helm chart, and prevents GitOps controllers from continuously resetting replica counts when an HPA is enabled.
Changes:
- Add
autoscalingvalues plus anautoscaling/v2(or equivalent) HorizontalPodAutoscaler template targeting Deployment/StatefulSet. - Add
podDisruptionBudgetvalues plus a PodDisruptionBudget template. - Refactor workload kind selection into a helper and omit
replicasin workload templates when autoscaling is enabled.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new autoscaling.* and podDisruptionBudget.* values. |
| charts/verdaccio/values.yaml | Adds default config blocks for HPA and PDB. |
| charts/verdaccio/templates/deployment.yaml | Omits spec.replicas when autoscaling is enabled so HPA owns scaling. |
| charts/verdaccio/templates/statefulset.yaml | Same as deployment: omit spec.replicas when autoscaling is enabled. |
| charts/verdaccio/templates/hpa.yaml | Introduces HPA resource targeting the selected workload kind. |
| charts/verdaccio/templates/pdb.yaml | Introduces optional PDB resource for voluntary disruption protection. |
| charts/verdaccio/templates/_helpers.tpl | Adds verdaccio.workloadKind helper for HPA target kind. |
| charts/verdaccio/Chart.yaml | Bumps chart version to 4.34.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- hpa: fail on Kubernetes < 1.23 (autoscaling/v2) and when no CPU/memory target is configured - pdb: select policy/v1 vs policy/v1beta1 by cluster version, fail when both or neither of minAvailable/maxUnavailable are set
Contributor
Author
|
@juanpicado i addressed copilot comments |
juanpicado
self-requested a review
August 18, 2026 11:14
juanpicado
approved these changes
Aug 26, 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.
Closes #192
Summary
When
autoscaling/HPA is used together with a GitOps controller (e.g. ArgoCD), the chart and the HPA fight over the replica count because theStatefulSet/Deploymenttemplate hardcodesreplicas: 1. This PR fixes that and adds HPA + PDB support.Problem
StatefulSettemplate hardcodesreplicas: 1whenreplicaCountEnabledisfalse.1from the rendered manifest, causing an endless reconcile loop.HorizontalPodAutoscalerorPodDisruptionBudget.Changes
feat(verdaccio): add HPA and stop hardcoding replicas when autoscalingautoscalingblock invalues.yamland anhpa.yamltemplate (autoscaling/v2) targeting either theDeploymentorStatefulSet.autoscaling.enabled: true, thereplicasfield is omitted from theDeployment/StatefulSetso the HPA owns the replica count (fixes the ArgoCD <-> HPA loop).feat(verdaccio): add optional PodDisruptionBudgetpdb.yamltemplate (policy/v1) gated onpodDisruptionBudget.enabled, with mutually-exclusiveminAvailable/maxUnavailable. Defaults tomaxUnavailable: 1.refactor(verdaccio): extract workload kind into helper templateverdaccio.workloadKindhelper (Deployment vs StatefulSet) used by the HPAscaleTargetRef.New values
Testing
helm lintpassesreplicas: 1present, no HPA/PDBautoscaling.enabled=true(Deployment) -- noreplicasfield, HPA targetsDeploymentautoscaling.enabled=true+type=statefulset-- noreplicasfield, HPA targetsStatefulSetpodDisruptionBudget.enabled=true-- PDB withmaxUnavailable: 1replicasfieldminAvailable=2-- PDB rendersminAvailable: 2, nomaxUnavailablebehaviorblock presentChart version
Bumped
4.33.1->4.34.0(new features warrant a minor bump).Rebased on latest
master(appVersion6.9.2).