-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Description
As also experienced by @ashb in #44463, our K8S tests are rather slow to iterate on and fix locally.
The way how to run those tests locally is explained in https://github.com/apache/airflow/blob/main/contributing-docs/testing/k8s_tests.rst#typical-testing-pattern-for-kubernetes-tests in detail - but there are a fewproblems to solve with them:
-
The k8s image needs to use PROD base image to be build first and - especially when dependencies change - sometimes, but not always the PROD image needs to be rebuilt with
--rebuild-base-imageflag ofbreeze k8s build-k8s-image. This might cause the Helm chart to not work at all (for example it failed whenasyncpgwas not installed in the base image -
Currently when you modify the
./kubernetest_tests- i.e. tests that you run in the local k8s-dedicated virtulenv environment specially prepared for those tests, they can be re-run right after modification - which is great to iterate on the tests. However, this is NOT the case for "airflow" code that you modify and iterate on. While thisis understandable that if you modify helm chart, you need to redeploy the chart, you also need to rebuild the "k8s image" and re-build and re-upload the image to the kind cluster in order to iterate on your changes. This is SLOW LIKE HELL. Rebuilding the image, re-uploading it and re-deploying chart to reload airflow takes minutes.
So in order to fix it we can do several things:
-
better detection when we need to re-build the image because of dependency change
-
using uv to install dependencies in PROD image as well (currently it is only used by default in CI image) - this way we could likely even rebuild the image more often as it wil be faster
-
add extra layer to add missing dependencies (with UV) in the K8S image:
- which means that we could continue to only rebuilding the k8s image (withoutFROM {params.airflow_image_name_with_tag} --rebuild-base-imageflag even if dependencies change) -
we could integrate solutions (or build our own) like Telepresence: https://www.telepresence.io/ where local sources of airflow would be synced (via ssh) with the sources in the k8s cluster (for example via local folder mounting or SSH) - this is a bit difficult to implement it to work in all circumstances (Linux/ MacOS/ WSL2) and all kind of docker engines our users might have (Docker Desktop, Orbstack, Podman etc.) - so doing it righ is a bit of a challenge. But that should be an ultimate way of iteration where changes to airflow and kuberntes providers could be followed by just pod restart and no need to build an upload new image.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status