-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-2952] Splits CI into k8s + docker-compose #3797
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
Closed
dimberman
wants to merge
10
commits into
apache:master
from
bloomberg:AIRFLOW-2952_fix_kubernetes_ci
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
250a11c
[AIRFLOW-2952] Splits CI into k8s + docker-compose
dimberman 0064e98
Tox modifications to make new build work
dimberman d28546c
Setting up kubeadm-dind-cluster for kubernetes testing
dimberman f9e4652
Hack to make s3 tests work. This needs to be fixed before merge
dimberman 6cea6ff
attempting kubeadm host
dimberman 3f1cfdc
added -e to set
dimberman 20770b7
removed comments
dimberman 0afad49
removed boto3 and moto from travis.yaml
dimberman eacfc71
added python 3 for k8s testing
dimberman d942f25
Attempting to access dind for Airflow API
dimberman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "insecure-registries" : ["10.192.0.1:5000"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| _UNAME_OUT=$(uname -s) | ||
| case "${_UNAME_OUT}" in | ||
| Linux*) _MY_OS=linux;; | ||
| Darwin*) _MY_OS=darwin;; | ||
| *) echo "${_UNAME_OUT} is unsupported." | ||
| exit 1;; | ||
| esac | ||
|
|
||
| if [ "$_MY_OS" = "linux" ]; then | ||
| export _REGISTRY_IP=10.192.0.1 | ||
| else | ||
| export _REGISTRY_IP=`ipconfig getifaddr en0` | ||
| fi | ||
| echo "Deploying insecure registry" | ||
| if [ "$_MY_OS" = "linux" ]; then | ||
| DIRNAME=$(cd "$(dirname "$0")"; pwd) | ||
| # sudo rm /etc/docker/daemon.json | ||
| # sudo cp $DIRNAME/daemon.json /etc/docker/ | ||
| sudo sed -i "s/\DOCKER_OPTS=\"/DOCKER_OPTS=\"--insecure-registry=$_REGISTRY_IP:5000 /g" /etc/default/docker | ||
| sudo cat /etc/default/docker | ||
| sudo service docker restart | ||
| fi | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/usr/bin/env bash | ||
| _MY_SCRIPT="${BASH_SOURCE[0]}" | ||
| _MY_DIR=$(cd "$(dirname "$_MY_SCRIPT")" && pwd) | ||
| _UNAME_OUT=$(uname -s) | ||
| case "${_UNAME_OUT}" in | ||
| Linux*) _MY_OS=linux;; | ||
| Darwin*) _MY_OS=darwin;; | ||
| *) echo "${_UNAME_OUT} is not unsupported." | ||
| exit 1;; | ||
| esac | ||
| echo "Local OS is ${_MY_OS}" | ||
| _KUBERNETES_VERSION="${KUBERNETES_VERSION}" | ||
| if [ "$_MY_OS" = "linux" ]; then | ||
| export _REGISTRY_IP="10.192.0.1" | ||
| else | ||
| export _REGISTRY_IP=`ipconfig getifaddr en0` | ||
| fi | ||
|
|
||
| cd $_MY_DIR | ||
| rm -rf tmp | ||
| mkdir -p bin tmp | ||
|
|
||
| rm $DIRNAME/dind-cluster-* | ||
| wget https://cdn.rawgit.com/kubernetes-sigs/kubeadm-dind-cluster/master/fixed/dind-cluster-v1.10.sh | ||
|
|
||
| chmod +x $_MY_DIR/dind-cluster-v1.10.sh | ||
| $_MY_DIR/dind-cluster-v1.10.sh clean | ||
| echo "registries are "[\"${_REGISTRY_IP}:5000\"]"" | ||
| DIND_INSECURE_REGISTRIES="[\"${_REGISTRY_IP}:5000\"]" DIND_SUBNET="10.192.0.0" DIND_SUBNET_SIZE=16 $_MY_DIR/dind-cluster-v1.10.sh up | ||
| export PATH="$HOME/.kubeadm-dind-cluster:$PATH" | ||
|
|
||
| if [[ ! -x /usr/local/bin/kubectl ]]; then | ||
| echo Downloading kubectl, which is a requirement for using minikube. | ||
| curl -Lo bin/kubectl \ | ||
| https://storage.googleapis.com/kubernetes-release/release/${_KUBERNETES_VERSION}/bin/${_MY_OS}/amd64/kubectl | ||
| chmod +x bin/kubectl | ||
| sudo mv bin/kubectl /usr/local/bin/kubectl | ||
| fi | ||
|
|
||
| REG=`docker ps -f name=registry -q` | ||
|
|
||
| if [ -n "$REG" ]; then | ||
| docker stop $REG; docker rm $REG | ||
| fi | ||
|
|
||
| if [ "$_MY_OS" = "linux" ]; then | ||
| docker run -d -p :5000:5000 --restart=always --name registry registry:2 | ||
| else | ||
| docker run -d -p 5000:5000 --restart=always --name registry registry:2 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -x -e | ||
|
|
||
| DIRNAME=$(cd "$(dirname "$0")"; pwd) | ||
| AIRFLOW_ROOT="$DIRNAME/../.." | ||
|
|
||
| # Fix file permissions | ||
| sudo chown -R airflow.airflow . $HOME/.wheelhouse/ $HOME/.cache/pip | ||
|
|
||
| if [[ $PYTHON_VERSION == '3' ]]; then | ||
| PIP=pip3 | ||
| else | ||
| PIP=pip | ||
| fi | ||
|
|
||
| sudo $PIP install --upgrade pip | ||
| sudo $PIP install tox | ||
|
|
||
| cd $AIRFLOW_ROOT && $PIP --version && tox --version | ||
|
|
||
| tox -e $TOX_ENV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -x -e | ||
|
|
||
| DIRNAME=$(cd "$(dirname "$0")"; pwd) | ||
| AIRFLOW_ROOT="$DIRNAME/../.." | ||
|
|
||
| # Fix file permissions | ||
| sudo chown -R travis.travis . $HOME/.wheelhouse/ $HOME/.cache/pip | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if I want to be able to run kube-based tests locally, what does the workflow for that look like? |
||
| sudo apt-get install python3-pip | ||
|
|
||
| if [[ $PYTHON_VERSION == '3' ]]; then | ||
| PIP=pip3 | ||
| else | ||
| PIP=pip | ||
| fi | ||
|
|
||
| sudo $PIP install --upgrade pip | ||
| sudo $PIP install tox | ||
|
|
||
| KUBERNETES_VERSION=${KUBERNETES_VERSION} $DIRNAME/kubernetes/setup_kubernetes.sh && \ | ||
| tox -e $TOX_ENV -- tests.contrib.minikube \ | ||
| --with-coverage \ | ||
| --cover-erase \ | ||
| --cover-html \ | ||
| --cover-package=airflow \ | ||
| --cover-html-dir=airflow/www/static/coverage \ | ||
| --with-ignore-docstrings \ | ||
| --rednose \ | ||
| --with-timer \ | ||
| -v \ | ||
| --logging-level=DEBUG | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -e