[AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing#6496
Conversation
466b5af to
315e6a0
Compare
|
Notes especially to @dimberman and @gerardo (but also @ashb and @mik-laj you might be interested). As preparation work for the production images I improved the way how the kind cluster is run. First of all I realised that the current cluster does not test really the latest sources - but instead whatever could be pulled from the latest master CI image on Dockerhub (which was usually at least one commit old). I think @gerardo mentioned it last time we spoke. Luckily we did not have breaking changes :) This change fixes it - I am now building the Kubernetes image from locally built image in the host and run The .tar image contains latest sources:
This way the image with latest sources will be build/saved and made available to airflow-testing container via mounted volume. @dimberman - you migth also be interested that I made the development workflow for Kubernetes tests with Breeze as nice as possible (we will later improve it - maybe with the production image). The original "Kind" change was working fine for CI (except not taking latest sources), but running it for local development was not really feasible. You really needed to rebuild everything from the scratch when you entered the environment (which took like 10-20 minutes on my PC) and there was no easy way to test the latest sources - short of forwarding, building and pushing your own images to dind container :(. I optimised it now so that when you have not closed the Breeze environment it will take far less time:
It's not ideal and rather slow, but at least it is automated now and you can run Kubernetes tests with your latest sources rather easily/automatically. |
Codecov Report
@@ Coverage Diff @@
## master #6496 +/- ##
=========================================
- Coverage 84% 83.7% -0.31%
=========================================
Files 635 635
Lines 36715 36715
=========================================
- Hits 30844 30733 -111
- Misses 5871 5982 +111
Continue to review full report at Codecov.
|
1944e80 to
b1de806
Compare
b1de806 to
256385d
Compare
|
Good catch and improvements @potiuk. I particularly like how the K8S image is built outside of the container. I have one observation. Regarding |
a270f54 to
66297db
Compare
|
I actually will improve it even further @gerardo -> when I get the prod image up and running i will actually use this production image for those tests. Which will basically mean that we will test both the Kubernetes Tests and Production image at the same time (and it will be way smaller so it's likely we will have much faster tests overall :). Vast majority of the test now is just preparation of the environment and particularly exporting/loading the Airflow images :(. What do you mean by resetting the cluster ? From what I understand the "deploy_app.sh" script will actually delete the pods - postgres/airflow/webserver. This will effectively destroy any state - i.e. the postgres volume, and next time when we redeploy the app we anyhow run "initContainer" in the airflow.yaml (airflow-test-env-init.sh) which will perform If we want to re-run tests, presumably we want to do it because we modified code, so we have to rebuild and re-deploy the application (after building the image) so we should be fine anyway ? I just now will have to make an easy way to trigger it for iterative development. I think it should be possible to rebuild the image and re-deploy app with a single trigger from the host without even restarting breeze. I will likely have to mount the whole folder rather than single file to let the exported .tar file to be updated in container. |
e3db1ee to
1216627
Compare
1216627 to
55cb1b9
Compare
* Fixed problem that Kubernetes tests were testing latest master rather than what came from the local sources. * Moved Kubernetes scripts to 'in_container' dir where they belong now * Kubernetes tests are now better suited for running locally * Kubernetes cluster is not deleted until environment is stopped * Kubernetes image is built outside of the container and passed as .tar * Kubectl version name is corrected in the Dockerfile * Kubernetes Version can be used to select Kubernetes versio * Running kubernetes scripts is now easy in Breeze * Instructions on how to run Kubernetes tests are updated * Better flags in Breeze are used to run Kubernetes environment/tests * The old "bare" environment is replaced by --no-deps switch
55cb1b9 to
9d921a1
Compare
|
This one has been reverted - we have #6516 instead. |
rather than what came from the local sources.
Jira
Description
Tests
Commits
Documentation