Skip to content

fix: don't render .spec.replicas if HPA is enabled#6249

Open
y-rabie wants to merge 1 commit intoenvoyproxy:mainfrom
y-rabie:dont-render-replicas-with-hpa
Open

fix: don't render .spec.replicas if HPA is enabled#6249
y-rabie wants to merge 1 commit intoenvoyproxy:mainfrom
y-rabie:dont-render-replicas-with-hpa

Conversation

@y-rabie
Copy link
Copy Markdown
Contributor

@y-rabie y-rabie commented Jun 2, 2025

What type of PR is this?
fix: don't render .spec.replicas if HPA is enabled

What this PR does / why we need it:

The current chart template will render .spec.replicas even if autoscaling is enabled. This causes a conflict in ownership of the .spec.replicas field between the HPA and whoever is installing/reconciling the manifests.

The effect of this depends on the tool used to install the manifests:

Helm CLI -> the .spec.replicas is reset to the .Values.deployment.replicas value everytime Helm Install/Update is invoked.

AgroCD (or any GitOps tool) -> .spec.replicas is reset on each Sync... which can result into a constant back and forth between ArgoCD and the HPA that technically eliminate the benefits of the HPA.

@y-rabie y-rabie requested a review from a team as a code owner June 2, 2025 16:27
@y-rabie y-rabie force-pushed the dont-render-replicas-with-hpa branch from d3f9f79 to 9996eea Compare June 2, 2025 16:38
@y-rabie y-rabie force-pushed the dont-render-replicas-with-hpa branch from 9996eea to d6ad285 Compare June 2, 2025 16:44
@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jun 2, 2025

thanks for flagging this @y-rabie, instead of disabling replicas, can we add templating to unset it ? and add a doc strin in the hpa section to recommend users to do so ?

@y-rabie
Copy link
Copy Markdown
Contributor Author

y-rabie commented Jun 3, 2025

@arkodg I'm not exactly sure what you mean by adding templating to unset it 😅 Do you mean leaving things as is and recommending to the users setting the replicas value to null when HPA is enabled?

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jun 4, 2025

if we added a doc string in the hpa section to comment out replicas

deployment:
  envoyGateway:
  .......
  # replicas: 1

could something like this be used in the template to avoid setting the replica ?

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 4, 2025

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale label Jul 4, 2025
@dberkerdem
Copy link
Copy Markdown

Any updates here?

@github-actions github-actions bot removed the stale label Aug 3, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 2, 2025

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale label Sep 2, 2025
@sherifabdlnaby
Copy link
Copy Markdown
Contributor

if we added a doc string in the hpa section to comment out replicas

deployment:
  envoyGateway:
  .......
  # replicas: 1

could something like this be used in the template to avoid setting the replica ?

If I understand the comment correctly then no, not with the current template. If we set replicas: null in the helm values it will still render, which means ArgoCD (and other GitOps tool) will track and own this field. We have to not render it at all so that the HPA can own the field without triggering an out-of-sync and fight the GitOps tool.

@github-actions github-actions bot removed the stale label Oct 15, 2025
@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Oct 15, 2025

@sherifabdlnaby will something like this work ?

+  {{- if hasKey (default (dict) .Values.deployment) "replicas" }}
   replicas: {{ .Values.deployment.replicas }}
+  {{- end }}

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

@proximix
Copy link
Copy Markdown

proximix commented Feb 2, 2026

Did this ever get merged into a release? I am still seeing this issue with Argo. Any update on this?

@zirain
Copy link
Copy Markdown
Member

zirain commented Feb 3, 2026

@y-rabie are you still working on this? if not, @proximix feel free to send another.

@github-actions github-actions bot removed the stale label Mar 7, 2026
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.

6 participants