Fokko closed pull request #4416: [AIRFLOW-3608] Allow devs to submit custom airflow images to k8s CI URL: https://github.com/apache/incubator-airflow/pull/4416
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/scripts/ci/kubernetes/docker/build.sh b/scripts/ci/kubernetes/docker/build.sh index df755f9659..69126dcd4e 100755 --- a/scripts/ci/kubernetes/docker/build.sh +++ b/scripts/ci/kubernetes/docker/build.sh @@ -17,8 +17,8 @@ # specific language governing permissions and limitations * # under the License. * -IMAGE=${1:-airflow} -TAG=${2:-latest} +IMAGE=${IMAGE:-airflow} +TAG=${TAG:-latest} DIRNAME=$(cd "$(dirname "$0")"; pwd) AIRFLOW_ROOT="$DIRNAME/../../../.." diff --git a/scripts/ci/kubernetes/kube/deploy.sh b/scripts/ci/kubernetes/kube/deploy.sh index abbf4f8d0f..9bc20e0b78 100755 --- a/scripts/ci/kubernetes/kube/deploy.sh +++ b/scripts/ci/kubernetes/kube/deploy.sh @@ -19,8 +19,8 @@ set -x -IMAGE=${1:-airflow/ci} -TAG=${2:-latest} +AIRFLOW_IMAGE=${IMAGE:-airflow} +AIRFLOW_TAG=${TAG:-latest} DIRNAME=$(cd "$(dirname "$0")"; pwd) TEMPLATE_DIRNAME=${DIRNAME}/templates BUILD_DIRNAME=${DIRNAME}/build @@ -117,6 +117,8 @@ else ${SED_COMMAND} -e "/{{INIT_GIT_SYNC}}/{r $TEMPLATE_DIRNAME/init_git_sync.template.yaml" -e 'd}' \ ${TEMPLATE_DIRNAME}/airflow.template.yaml > ${BUILD_DIRNAME}/airflow.yaml fi +${SED_COMMAND} -i "s|{{AIRFLOW_IMAGE}}|$AIRFLOW_IMAGE|g" ${BUILD_DIRNAME}/airflow.yaml +${SED_COMMAND} -i "s|{{AIRFLOW_TAG}}|$AIRFLOW_TAG|g" ${BUILD_DIRNAME}/airflow.yaml ${SED_COMMAND} -i "s|{{CONFIGMAP_GIT_REPO}}|$CONFIGMAP_GIT_REPO|g" ${BUILD_DIRNAME}/airflow.yaml ${SED_COMMAND} -i "s|{{CONFIGMAP_BRANCH}}|$CONFIGMAP_BRANCH|g" ${BUILD_DIRNAME}/airflow.yaml @@ -130,6 +132,10 @@ ${SED_COMMAND} -i "s|{{CONFIGMAP_BRANCH}}|$CONFIGMAP_BRANCH|g" ${BUILD_DIRNAME}/ ${SED_COMMAND} -i "s|{{CONFIGMAP_GIT_DAGS_FOLDER_MOUNT_POINT}}|$CONFIGMAP_GIT_DAGS_FOLDER_MOUNT_POINT|g" ${BUILD_DIRNAME}/configmaps.yaml ${SED_COMMAND} -i "s|{{CONFIGMAP_DAGS_VOLUME_CLAIM}}|$CONFIGMAP_DAGS_VOLUME_CLAIM|g" ${BUILD_DIRNAME}/configmaps.yaml + +cat ${BUILD_DIRNAME}/airflow.yaml +cat ${BUILD_DIRNAME}/configmaps.yaml + # Fix file permissions if [[ "${TRAVIS}" == true ]]; then sudo chown -R travis.travis $HOME/.kube $HOME/.minikube diff --git a/scripts/ci/kubernetes/kube/templates/airflow.template.yaml b/scripts/ci/kubernetes/kube/templates/airflow.template.yaml index 82f7b8b17d..7c32b43d4e 100644 --- a/scripts/ci/kubernetes/kube/templates/airflow.template.yaml +++ b/scripts/ci/kubernetes/kube/templates/airflow.template.yaml @@ -43,7 +43,7 @@ spec: spec: initContainers: - name: "init" - image: airflow + image: {{AIRFLOW_IMAGE}}:{{AIRFLOW_TAG}} imagePullPolicy: IfNotPresent volumeMounts: - name: airflow-configmap @@ -67,7 +67,7 @@ spec: {{INIT_GIT_SYNC}} containers: - name: webserver - image: airflow + image: {{AIRFLOW_IMAGE}}:{{AIRFLOW_TAG}} imagePullPolicy: IfNotPresent ports: - name: webserver @@ -92,7 +92,7 @@ spec: - name: airflow-logs mountPath: /root/airflow/logs - name: scheduler - image: airflow + image: {{AIRFLOW_IMAGE}}:{{AIRFLOW_TAG}} imagePullPolicy: IfNotPresent args: ["scheduler"] env: diff --git a/scripts/ci/kubernetes/setup_kubernetes.sh b/scripts/ci/kubernetes/setup_kubernetes.sh index e0ef216f07..d56cfad12a 100755 --- a/scripts/ci/kubernetes/setup_kubernetes.sh +++ b/scripts/ci/kubernetes/setup_kubernetes.sh @@ -31,4 +31,7 @@ fi $DIRNAME/minikube/start_minikube.sh $DIRNAME/docker/build.sh + + + echo "Airflow environment on kubernetes is good to go!" ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services