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

[AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing #6516

Merged
merged 1 commit into from
Jan 11, 2020

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Nov 7, 2019

  • Fixed problem that Kubernetes tests were testing latest master
    rather than what came from the local sources.
  • Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
  • Moved Kubernetes scripts to 'in_container' dir where they belong now
  • Kubernetes cluster is reused until it is stopped
  • Kubernetes image is build from image in docker already + mounted sources
  • Kubectl version name is corrected in the Dockerfile
  • KUBERNETES_VERSION can now be used to select Kubernetes version
  • Running kubernetes scripts is now easy in Breeze
  • We can start/recreate/stop cluster using ---kind-cluster
  • Instructions on how to run Kubernetes tests are updated
  • The old "bare" environment is replaced by --no-deps switch

Issue link: AIRFLOW-5704

  • Description above provides context of the change
  • Commit message/PR title starts with [AIRFLOW-NNNN]. AIRFLOW-NNNN = JIRA ID*
  • Unit tests coverage for changes (not needed for documentation changes)
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions.
  • I will engage committers as explained in Contribution Workflow Example.

* For document-only changes commit message can start with [AIRFLOW-XXXX].


In case of fundamental code change, 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 UPDATING.md.
Read the Pull Request Guidelines for more information.

@feluelle feluelle added k8s area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code labels Nov 10, 2019
@potiuk potiuk changed the title [AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing [AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing. Depends on [AIRFLOW-5885] [AIRFLOW-5886] [AIRFLOW-5887] Nov 11, 2019
@potiuk potiuk force-pushed the improve-kind-kubernetes branch 2 times, most recently from d502319 to 8e2940b Compare November 12, 2019 22:06
@potiuk potiuk changed the title [AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing. Depends on [AIRFLOW-5885] [AIRFLOW-5886] [AIRFLOW-5887] [AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing. Nov 12, 2019
@potiuk
Copy link
Member Author

potiuk commented Nov 12, 2019

@ashb @dimberman @gerardo -> I merged all the smaller PRs separated out from the Kind change and I am working on making the tests work for this one. While trying to fix and tests the kubernetes tests I noticed how difficult it was to iterate and re-test Kubernetes tests, so this one is now optimising even more:

  1. Only the basic image for CI is built outside and sent to the docker. It is sent via untarred folder rather than as whole file. This makes it much nicer for the slow Mac Host->Docker volume mounting because the untarred image save contains separate .tars for all Docker image layers. I sync the layer dir via rsync based on checksum - this way I make sure than whenever the CI image is rebuilt, only the last rebuilt layers are changed. Then when the image is imported to DinD only the last layers are updated. this way while the environment is up and running and images are loaded to DiND and cluster, only incremental changes will be loaded.

  2. Then I came back to building the kubernetes image inside breeze container. I will speed it up more, but it is actually much better for iterating when you are inside the breeze container. In order to reload last image to the cluster you will just need to run "rebuild_ariflow_image.sh" inside the container and it will (incrementally of course) rebuild and sent the new image layers to DiND and then to cluster.

I am still working on fixing the tests but I think it is much more developer-friendly than before.

@davlum
Copy link
Contributor

davlum commented Nov 27, 2019

I'm getting an error /opt/airflow/scripts/ci/in_container/kubernetes/app/deploy_app.sh: line 78: AIRFLOW_CI_KUBERNETES_IMAGE: unbound variable when running ./breeze -K.

If that's a required argument it should fail up front.

@potiuk potiuk force-pushed the improve-kind-kubernetes branch 8 times, most recently from f4bc94e to 1e43c78 Compare January 7, 2020 11:47
@potiuk potiuk changed the title [AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing. [AIRFLOW-5704] Improve Kind Kubernetes scripts for local testing [WIP] Jan 7, 2020
BREEZE.rst Outdated Show resolved Hide resolved
BREEZE.rst Outdated Show resolved Hide resolved
BREEZE.rst Outdated Show resolved Hide resolved
breeze Outdated Show resolved Hide resolved
@potiuk potiuk closed this Jan 11, 2020
@potiuk potiuk reopened this Jan 11, 2020
@potiuk potiuk closed this Jan 11, 2020
@potiuk potiuk reopened this Jan 11, 2020
* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch
@potiuk potiuk closed this Jan 11, 2020
@potiuk potiuk reopened this Jan 11, 2020
@potiuk
Copy link
Member Author

potiuk commented Jan 11, 2020

@nuclearpinguin @kaxil @mik-laj - one last final review and I'd love to merge it

@potiuk potiuk merged commit 73403cc into apache:master Jan 11, 2020
potiuk added a commit that referenced this pull request Jan 21, 2020
* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch

(cherry picked from commit 73403cc)
kaxil pushed a commit that referenced this pull request Jan 22, 2020
* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch

(cherry picked from commit 73403cc)
kaxil pushed a commit that referenced this pull request Jan 23, 2020
* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch

(cherry picked from commit 73403cc)
potiuk added a commit that referenced this pull request Jan 26, 2020
* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch

(cherry picked from commit 73403cc)
kaxil pushed a commit that referenced this pull request Jan 26, 2020
* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch

(cherry picked from commit 73403cc)
galuszkak pushed a commit to FlyrInc/apache-airflow that referenced this pull request Mar 5, 2020
…che#6516)

* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch
kaxil pushed a commit to astronomer/airflow that referenced this pull request Mar 30, 2020
…che#6516)

* Fixed problem that Kubernetes tests were testing latest master
  rather than what came from the local sources.
* Kind (Kubernetes in Dcocker) is run in the same Docker as Breeze env
* Moved Kubernetes scripts to 'in_container' dir where they belong now
* Kubernetes cluster is reused until it is stopped
* Kubernetes image is build from image in docker already + mounted sources
* Kubectl version name is corrected in the Dockerfile
* KUBERNETES_VERSION can now be used to select Kubernetes version
* Running kubernetes scripts is now easy in Breeze
* We can start/recreate/stop cluster using  --<ACTION>-kind-cluster
* Instructions on how to run Kubernetes tests are updated
* The old "bare" environment is replaced by --no-deps switch

(cherry picked from commit 73403cc)
(cherry picked from commit c7c5aa3)
@potiuk potiuk added the area:production-image Production image improvements and fixes label Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code area:dev-tools area:production-image Production image improvements and fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants