Skip to content

Conversation

@HsiuChuanHsu
Copy link
Contributor

Description:

This pull request introduces Horizontal Pod Autoscaler (HPA) support for the Airflow API server in the Helm chart, enabling automatic scaling of API server pods based on resource utilization or custom metrics. The changes enhance the chart's flexibility and scalability, allowing users to configure autoscaling for the API server to handle varying workloads efficiently.

Changes:

  1. Added HPA Configuration Template
    Created chart/templates/api-server/api-server-hpa.yaml to define the HPA resource for the API server.
  2. Updated Values Schema
    Modified chart/values.schema.json to include a new hpa section under apiServer.
  3. Updated Default Values
    Added HPA configuration in chart/values.yaml under apiServer.hpa with sensible defaults
  4. Added Unit Tests:
    Introduced helm-tests/tests/helm_tests/apiserver/test_hpa_apiserver.py to validate HPA behavior

How to Test:

  1. Enable HPA with apiServer.hpa.enabled=true and verify the HPA resource is created with default settings.
  2. Override minReplicaCount, maxReplicaCount, metrics, or behavior in values.yaml and confirm the HPA resource reflects the changes.
  3. Run unit tests with pytest helm-tests/tests/helm_tests/apiserver/test_hpa_apiserver.py to validate logic.

Additional Notes:

Screenshot 2025-06-28 at 3 15 04 PM
Included deployment and HPA status screenshot from kubectl displaying an Airflow API server deployment with 4 pods running.

Related Issues:

#51935


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg
Copy link

boring-cyborg bot commented Jun 28, 2025

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 pre-commits 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: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@HsiuChuanHsu
Copy link
Contributor Author

Hi @romsharon98, @eladkal could you help review this PR? Thanks!

@eladkal eladkal requested a review from romsharon98 July 25, 2025 15:00
@HsiuChuanHsu HsiuChuanHsu force-pushed the feature/api_server_hap branch from 04b9b32 to 8b8528c Compare September 5, 2025 06:09
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 23, 2025
@HsiuChuanHsu
Copy link
Contributor Author

No!! Pls don't!!

@HsiuChuanHsu HsiuChuanHsu force-pushed the feature/api_server_hap branch from 8b8528c to cd16f0f Compare November 2, 2025 06:24
@eladkal eladkal removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Nov 2, 2025
@eladkal eladkal added this to the Airflow Helm Chart 1.19.0 milestone Nov 2, 2025
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

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

Tanks for being patient with the PR. From review this looks good to me. Some nit in regards of docs as what the users will see - mainly to be clear.

Then if adjusted I assume good to merge, if not somebody objects.

@HsiuChuanHsu HsiuChuanHsu force-pushed the feature/api_server_hap branch from cd16f0f to df11bf4 Compare November 3, 2025 13:19
@HsiuChuanHsu
Copy link
Contributor Author

HsiuChuanHsu commented Nov 3, 2025

Happy to see my first PR got reviewed from you. Thanks.

@HsiuChuanHsu HsiuChuanHsu force-pushed the feature/api_server_hap branch from b40801d to 06f2f8c Compare November 26, 2025 14:33
@HsiuChuanHsu HsiuChuanHsu force-pushed the feature/api_server_hap branch from 06f2f8c to 2281693 Compare November 26, 2025 15:33
@jscheffl jscheffl merged commit 9023c38 into apache:main Dec 7, 2025
88 checks passed
amoghrajesh pushed a commit to astronomer/airflow that referenced this pull request Dec 8, 2025
…pache#52392)

* Add api-server hpa yaml
1. add hpa ymal
2. add hpa schema into values.schema

* Refine HPA enablement condition for Airflow API Server

* Add tests for Airflow API Server HPA configuration

* refactor(chart): clarify apiServer HPA configuration and update default CPU utilization

* Fix CI Error

* Swap assertion operands for consistency

* Apply suggestions from code review

---------

Co-authored-by: Jens Scheffler <95105677+jscheffl@users.noreply.github.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants