Skip to content

Add HPA & PodDisruptionBudget support; fix hardcoded replicas conflicting with HPA/GitOps (unable to open PR) #192

@pyhp2017

Description

@pyhp2017

Summary

We've been running the Verdaccio chart with GitOps (ArgoCD) and an HPA, and hit a reconcile loop because the chart hardcodes the replica count. We fixed it in our fork (corticph/verdaccio-charts) and would love to contribute the changes back, but we're unable to open a pull request against this repository (PR creation appears to be restricted for outside contributors - pushing a branch / opening a PR is blocked for us). Opening this issue instead so a maintainer can pull the changes in or advise on the contribution path.

Full diff against master: master...corticph:verdaccio-charts:master

Problem

When autoscaling/HPA is used together with a GitOps controller, the chart and the HPA fight over the replica count:

  • The StatefulSet template hardcodes replicas: 1 when replicaCountEnabled is false.
  • An HPA scales the workload up, but the GitOps controller (ArgoCD) then resets it back to 1 from the rendered manifest, which the HPA scales up again - an endless reconcile loop.

There is also currently no built-in support for a HorizontalPodAutoscaler or a PodDisruptionBudget, both of which are useful for running Verdaccio with more than one replica.

Changes in our fork

  1. feat(verdaccio): add HPA and stop hardcoding replicas when autoscaling

    • New autoscaling block in values.yaml and an hpa.yaml template (autoscaling/v2) targeting either the Deployment or StatefulSet.
    • When autoscaling.enabled: true, the replicas field is omitted from the Deployment/StatefulSet so the HPA owns the replica count (fixes the ArgoCD ↔ HPA loop).
  2. feat(verdaccio): add optional PodDisruptionBudget

    • New pdb.yaml template (policy/v1) gated on podDisruptionBudget.enabled, with mutually-exclusive minAvailable / maxUnavailable. Defaults to maxUnavailable: 1.
  3. refactor(verdaccio): extract workload kind into helper template

    • New reusable verdaccio.workloadKind helper (Deployment vs StatefulSet) used by the HPA scaleTargetRef.

These follow the contribution guidelines: README documentation added for all new values, and Chart.yaml bumped 4.32.04.33.0.

New values

autoscaling:
  enabled: false
  minReplicas: 2
  maxReplicas: 5
  targetCPUUtilizationPercentage: 80
  # targetMemoryUtilizationPercentage: 80
  behavior: {}

podDisruptionBudget:
  enabled: false
  # minAvailable: 1
  maxUnavailable: 1

Ask

Happy to adjust anything to match your conventions. If you can let us know how to get a PR opened (or grant whatever access is needed), we'll send these up properly. Otherwise the compare link above has everything needed to cherry-pick the commits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions