Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Breeze K8s: Patch ConfigMap [api/base_url] with Port-Forwarded Host Port #47544

Conversation

jason810496
Copy link
Contributor

closes: #47521

Why

The [api/base_url] is set to http://localhost:8080 by default, which causes issues in the Breeze K8s environment. The redirect URL after login does not match the host:port defined in KUBERNETES_HOST_PORT, also leading to CORS problems as described in #47521.

What

  • Patch the [api/base_url] value in airflow.cfg within the ConfigMap using KUBERNETES_HOST_PORT.
  • Roll out a restart of the airflow-api-server deployment before running tests.

Note

We could also move the ConfigMap patching step into a Breeze k8s utility that runs before shell and test commands. Open to discussion—any advice would be greatly appreciated!

@potiuk
Copy link
Member

potiuk commented Mar 9, 2025

We could also move the ConfigMap patching step into a Breeze k8s utility that runs before shell and test commands. Open to discussion—any advice would be greatly appreciated!

That one is better I think, as theorethically we could run the tests outside of the breeze k8s utiltity. I always prefer to run setup - if only possible - in a pytest fixture, as this makes tests far more portable in general. We had a lot, a lot of cases where we had some environmental setup in outside scripts or even breeze image and that was a cause for many problems where someone attempted to run tests in not-exactly-the-way-it-was-supposed-to-be causing lots of confusion and time lost for diagnosing the issues.

@potiuk potiuk merged commit cffbb58 into apache:main Mar 9, 2025
53 checks passed
@potiuk
Copy link
Member

potiuk commented Mar 9, 2025

BTW. Very nice and out-of-the-box idea ;) . I would have never come up with such an aproach, but it is really nice :)

@potiuk
Copy link
Member

potiuk commented Mar 9, 2025

Also it has a very nice side-effect ..... We are ACTUALLY testing rolling restart of API server this way :)

@jason810496
Copy link
Contributor Author

We could also move the ConfigMap patching step into a Breeze k8s utility that runs before shell and test commands. Open to discussion—any advice would be greatly appreciated!

That one is better I think, as theorethically we could run the tests outside of the breeze k8s utiltity. I always prefer to run setup - if only possible - in a pytest fixture, as this makes tests far more portable in general. We had a lot, a lot of cases where we had some environmental setup in outside scripts or even breeze image and that was a cause for many problems where someone attempted to run tests in not-exactly-the-way-it-was-supposed-to-be causing lots of confusion and time lost for diagnosing the issues.

Thanks for confirming, @potiuk I’ll move it to Breeze in the next PR—already noted in my backlog.

BTW. Very nice and out-of-the-box idea ;) . I would have never come up with such an approach, but it is really nice :)

Really appreciate that! Glad you liked the idea—you just made my day!

@jscheffl
Copy link
Contributor

jscheffl commented Mar 9, 2025

Cool! Thanks for the fix!

azharizz pushed a commit to azharizz/airflow that referenced this pull request Mar 9, 2025
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.

Test Deployment via breeze in KinD/K8s need to realx Same Origin Policy
3 participants