Skip to content

chart: api-server Deployment always includes spec.replicas when HPA is enabled#63187

Merged
jscheffl merged 1 commit into
apache:mainfrom
thejoeejoee:fix/chart-api-server-hpa-replicas
Mar 11, 2026
Merged

chart: api-server Deployment always includes spec.replicas when HPA is enabled#63187
jscheffl merged 1 commit into
apache:mainfrom
thejoeejoee:fix/chart-api-server-hpa-replicas

Conversation

@thejoeejoee

@thejoeejoee thejoeejoee commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

When apiServer.hpa.enabled: true, the Deployment manifest still contains spec.replicas: 1.
HPA modifies this field at runtime, causing GitOps tooling to continuously detect a diff between
the desired state in Git and the live cluster state — a permanent out-of-sync condition.

Fix: wrap spec.replicas with a kindIs "invalid" guard so the field is omitted entirely when
apiServer.replicas is set to ~ (null), letting HPA be the sole owner of the replica count.

closes: #63186


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Sonnet 4.5 (Sisyphus / OhMyOpenCode)

Generated-by: Claude Sonnet 4.5 (Sisyphus / OhMyOpenCode) following the guidelines

@boring-cyborg

boring-cyborg Bot commented Mar 9, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added the area:helm-chart Airflow Helm Chart label Mar 9, 2026
@thejoeejoee thejoeejoee marked this pull request as ready for review March 9, 2026 13:27
Comment thread chart/values.yaml Outdated

@jscheffl jscheffl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's have CI green, then LGTM in my view.

@jscheffl jscheffl added this to the Airflow Helm Chart 1.20.0 milestone Mar 9, 2026
Comment thread chart/values.schema.json
Comment thread helm-tests/tests/helm_tests/apiserver/test_hpa_apiserver.py Outdated
Comment thread helm-tests/tests/helm_tests/apiserver/test_hpa_apiserver.py Outdated
@thejoeejoee thejoeejoee force-pushed the fix/chart-api-server-hpa-replicas branch 7 times, most recently from f636a15 to 61e4c80 Compare March 10, 2026 21:35
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Mar 11, 2026

@Miretpl Miretpl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally - looks good.

I checked how it is handled in e.g. workers, and basically it is handled automatically if on e.g. hpa.enabled flag to add/remove replicas field. The same goes for webserver and triggerer, which have HPA/KEDA implemented.

Could we make the behaviour consistent? (below example from webserver):

{{- if not .Values.webserver.hpa.enabled }}
replicas: {{ .Values.webserver.replicas }}
{{- end}}

@thejoeejoee thejoeejoee force-pushed the fix/chart-api-server-hpa-replicas branch 2 times, most recently from 75fcca8 to 0dad3b4 Compare March 11, 2026 21:34
@thejoeejoee thejoeejoee force-pushed the fix/chart-api-server-hpa-replicas branch from 0dad3b4 to d1e9c56 Compare March 11, 2026 21:37
@jscheffl jscheffl merged commit 51f663d into apache:main Mar 11, 2026
98 checks passed
@boring-cyborg

boring-cyborg Bot commented Mar 11, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

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

Labels

area:helm-chart Airflow Helm Chart ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chart: api-server Deployment always includes spec.replicas when HPA is enabled

4 participants