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

Add Helm chart for Airflow (fix #7) #16

Merged
merged 51 commits into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f84d458
Add Helm chart for Airflow
gsemet Oct 24, 2017
0c38fd8
requirements*.txt support + docs
gsemet Oct 28, 2017
445999d
This commit adds and icon to the Chart.
Nov 3, 2017
5fadf86
This commit adds a helpers to access name variables in the templates
Nov 3, 2017
ca66688
Adding of optional pvc WIP
Nov 3, 2017
2d579e5
Refactor deployments and add a dags path variable
gsemet Nov 6, 2017
2b4401b
Change the PVC access mode
Nov 3, 2017
afa9a1a
This commit adds a more up to date version
Nov 3, 2017
2a861a0
Fixes after PVC merge
gsemet Nov 7, 2017
b2cf5bb
Protect all names
gsemet Nov 7, 2017
f6d35b1
fix some issues on the charts
gsemet Nov 7, 2017
0930caf
fix in airflow.cfg
gsemet Nov 7, 2017
8cf8dd4
airflow.cfg configmap
gsemet Nov 7, 2017
6a1e26b
beware of the sed when replacing url_prefix
gsemet Nov 7, 2017
168c624
update README
gsemet Nov 7, 2017
91bc107
Fix credentials applying + update config.yaml example
gsemet Nov 7, 2017
f064316
Minor glitch fixes
gsemet Nov 7, 2017
229a05e
make helm-check
gsemet Nov 7, 2017
561a661
Rework
Nov 21, 2017
e492d8c
update about values.yaml
gsemet Nov 26, 2017
2ca5bf5
Values configuration
gsemet Nov 26, 2017
ea51bb6
statefulset: burst mode
gsemet Nov 27, 2017
8bb9e41
Cleaner example
gsemet Nov 27, 2017
c73d0bc
Rolling update
gsemet Nov 27, 2017
1206199
Add web service liveness probe
gsemet Nov 27, 2017
8884c02
no wait
Nov 28, 2017
948ff3e
Removed embedded postgresql pieces.
jpds Feb 21, 2018
9845a39
Added dependency on postgresql chart.
jpds Feb 21, 2018
27178fe
Leverage postgres dependency in configmaps.
jpds Feb 21, 2018
31bcf03
airflow/values.yaml: Removed concourse reference.
jpds Feb 21, 2018
1cd1e32
Merge pull request #13 from jpds/postgresql-dependency
gsemet Feb 21, 2018
abb90e2
Use puckel image and split out imageTag.
jpds Feb 21, 2018
07faee4
Removed airflow_cfg and all references to it.
jpds Feb 21, 2018
b018c1d
Use database environment variables for all services.
jpds Feb 21, 2018
47af54a
Integrated redis chart and variables.
jpds Feb 21, 2018
421bc57
deployments-web.yaml: Fixed health check endpoint.
jpds Feb 21, 2018
52ab63b
values.yaml: Removed airflow_cfg.
jpds Feb 21, 2018
7049217
Removed RabbitMQ references.
jpds Feb 21, 2018
036b700
services.yaml: Don't use NodePorts to allow for multiple deployments on
jpds Feb 21, 2018
03fd6c7
templates/configmaps-env.yaml: Removed.
jpds Feb 21, 2018
29ac02b
Adapted deployment labels to `helm create` defaults.
jpds Feb 21, 2018
b8f942b
Replaced prefix option with dynamically generated helm release name.
jpds Feb 21, 2018
e784966
Added airflow.config option for dynamic airflow variable setting.
jpds Feb 21, 2018
94d7d74
airflow/values.yaml: config value for dynamic airflow env assignment.
jpds Feb 21, 2018
974b2ab
statefulsets-workers: Specify imageTag.
jpds Feb 21, 2018
e7ae900
statefulsets-workers: Fixed name field for lint.
jpds Feb 21, 2018
d2bebb8
services.yaml: Match ingress serviceNames.
jpds Feb 22, 2018
39664a5
ingresses.yml: Match other chart label annotations and use subdomain for
jpds Feb 22, 2018
83c82e3
values.yaml: Removed rabbitmq section.
jpds Feb 22, 2018
539696c
install airflow HEAD now my patch has been integrated
gsemet Mar 1, 2018
74059f2
Merge pull request #14 from jpds/puckel-image
gsemet Mar 2, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.yaml]
indent_size = 2

[Makefile]
indent_style = tab
indent_size = 4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
build
rootfs
144 changes: 77 additions & 67 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,84 +4,94 @@
# BUILD: docker build --rm -t mumoshu/kube-airflow
# SOURCE: https://github.com/mumoshu/kube-airflow

FROM debian:jessie
FROM debian:stretch
MAINTAINER Yusuke KUOKA <ykuoka@gmail.com>

# Never prompts the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux

# Airflow
ARG AIRFLOW_VERSION=%%AIRFLOW_VERSION%%
ENV AIRFLOW_HOME /usr/local/airflow
ARG AIRFLOW_VERSION=%%AIRFLOW_VERSION%%
ENV AIRFLOW_HOME /usr/local/airflow
ENV EMBEDDED_DAGS_LOCATION=%%EMBEDDED_DAGS_LOCATION%%
ENV REQUIREMENTS_TXT_LOCATION=%%REQUIREMENTS_TXT_LOCATION%%

# Define en_US.
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
ENV LC_MESSAGES en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
ENV LC_MESSAGES en_US.UTF-8
ENV LC_ALL en_US.UTF-8

RUN set -ex \
&& buildDeps=' \
python-pip \
python-dev \
libkrb5-dev \
libsasl2-dev \
libxml2-dev \
libssl-dev \
libffi-dev \
build-essential \
libblas-dev \
liblapack-dev \
libxslt1-dev \
zlib1g-dev \
' \
&& echo "deb http://http.debian.net/debian jessie-backports main" >/etc/apt/sources.list.d/backports.list \
&& apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
$buildDeps \
apt-utils \
curl \
netcat \
locales \
&& apt-get install -yqq -t jessie-backports python-requests libpq-dev \
&& sed -i 's/^# en_US.UTF-8 UTF-8$/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
&& locale-gen \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
&& useradd -ms /bin/bash -d ${AIRFLOW_HOME} airflow \
&& pip uninstall setuptools \
&& pip install setuptools==33.1.1 \
&& pip install pytz==2015.7 \
&& pip install cryptography \
&& pip install pyOpenSSL \
&& pip install ndg-httpsclient \
&& pip install pyasn1 \
&& pip install psycopg2 \
&& pip install airflow[celery,postgresql,hive]==$AIRFLOW_VERSION \
&& apt-get remove --purge -yqq $buildDeps libpq-dev \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
WORKDIR /requirements
# Only copy needed files
COPY requirements/airflow.txt /requirements/airflow.txt
COPY ${REQUIREMENTS_TXT_LOCATION} /requirements/dags.txt

ENV KUBECTL_VERSION %%KUBECTL_VERSION%%

RUN curl -L -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN set -ex \
&& buildDeps=' \
build-essential \
libblas-dev \
libffi-dev \
libkrb5-dev \
liblapack-dev \
libpq-dev \
libsasl2-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
python3-dev \
python3-pip \
zlib1g-dev \
' \
&& apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
$buildDeps \
apt-utils \
curl \
git \
locales \
netcat \
&& sed -i 's/^# en_US.UTF-8 UTF-8$/en_US.UTF-8 UTF-8/g' /etc/locale.gen \
&& locale-gen \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
&& useradd -ms /bin/bash -d ${AIRFLOW_HOME} airflow \
&& pip3 install --upgrade pip 'setuptools!=36.0.0' \
&& if [ ! -e /usr/bin/pip ]; then ln -s /usr/bin/pip3 /usr/bin/pip ; fi \
&& if [ ! -e /usr/bin/python ]; then ln -sf /usr/bin/python3 /usr/bin/python; fi \
&& pip3 install -r /requirements/airflow.txt \
&& pip3 install -r /requirements/dags.txt \
&& apt-get remove --purge -yqq $buildDeps libpq-dev \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base

COPY script/entrypoint.sh ${AIRFLOW_HOME}/entrypoint.sh
COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
ENV KUBECTL_VERSION %%KUBECTL_VERSION%%

RUN chown -R airflow: ${AIRFLOW_HOME} \
&& chmod +x ${AIRFLOW_HOME}/entrypoint.sh
RUN curl -L -o /usr/local/bin/kubectl \
https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl \
&& chmod +x /usr/local/bin/kubectl

EXPOSE 8080 5555 8793
COPY script/entrypoint.sh ${AIRFLOW_HOME}/entrypoint.sh
COPY config/airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
COPY script/git-sync ${AIRFLOW_HOME}/git-sync
COPY ${EMBEDDED_DAGS_LOCATION} ${AIRFLOW_HOME}/dags
COPY script/git-sync ${AIRFLOW_HOME}/git-sync

USER airflow
WORKDIR ${AIRFLOW_HOME}
ENTRYPOINT ["./entrypoint.sh"]
RUN chown -R airflow: ${AIRFLOW_HOME} \
&& chmod +x ${AIRFLOW_HOME}/entrypoint.sh \
&& chmod +x ${AIRFLOW_HOME}/git-sync

EXPOSE 8080 5555 8793

USER airflow
WORKDIR ${AIRFLOW_HOME}
ENTRYPOINT ["./entrypoint.sh"]
55 changes: 53 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,59 @@ DOCKERFILE ?= $(BUILD_ROOT)/Dockerfile
ROOTFS ?= $(BUILD_ROOT)/rootfs
AIRFLOW_CONF ?= $(BUILD_ROOT)/config/airflow.cfg
ENTRYPOINT_SH ?= $(BUILD_ROOT)/script/entrypoint.sh
GIT_SYNC ?= $(BUILD_ROOT)/script/git-sync
DAGS ?= $(BUILD_ROOT)/dags
AIRFLOW_REQUIREMENTS ?= $(BUILD_ROOT)/requirements/airflow.txt
DAGS_REQUIREMENTS ?= $(BUILD_ROOT)/requirements/dags.txt
DOCKER_CACHE ?= docker-cache
SAVED_IMAGE ?= $(DOCKER_CACHE)/image-$(AIRFLOW_VERSION)-$(KUBECTL_VERSION).tar

NAMESPACE ?= airflow-dev
HELM_APPLICATION_NAME ?= airflow
HELM_VALUES ?= airflow/values.yaml
CHART_LOCATION ?= ./airflow
EMBEDDED_DAGS_LOCATION ?= "./dags"
REQUIREMENTS_TXT_LOCATION ?= "requirements/dags.txt"

.PHONY: build clean

clean:
rm -Rf build

build: $(DOCKERFILE) $(ROOTFS) $(AIRFLOW_CONF) $(ENTRYPOINT_SH)
helm-install:
helm upgrade -f $(HELM_VALUES) \
--install \
--debug \
$(HELM_APPLICATION_NAME) \
$(CHART_LOCATION)

helm-check:
helm install --dry_run \
$(CHART_LOCATION) \
--version=v0.1.0 \
--name=$(HELM_APPLICATION_NAME) \
--namespace=$(NAMESPACE) \
--debug \
-f $(HELM_VALUES)

helm-ls:
helm ls --all $(HELM_APPLICATION_NAME)

helm-uninstall:
helm del --purge $(HELM_APPLICATION_NAME)

build: clean $(DOCKERFILE) $(ROOTFS) $(DAGS) $(AIRFLOW_CONF) $(ENTRYPOINT_SH) $(GIT_SYNC) $(AIRFLOW_REQUIREMENTS) $(DAGS_REQUIREMENTS)
cd $(BUILD_ROOT) && docker build -t $(IMAGE) . && docker tag $(IMAGE) $(ALIAS)

publish:
docker push $(IMAGE) && docker push $(ALIAS)

$(DOCKERFILE): $(BUILD_ROOT)
sed -e 's/%%KUBECTL_VERSION%%/'"$(KUBECTL_VERSION)"'/g;' -e 's/%%AIRFLOW_VERSION%%/'"$(AIRFLOW_VERSION)"'/g;' Dockerfile.template > $(DOCKERFILE)
sed -e 's/%%KUBECTL_VERSION%%/'"$(KUBECTL_VERSION)"'/g;' \
-e 's/%%AIRFLOW_VERSION%%/'"$(AIRFLOW_VERSION)"'/g;' \
-e 's#%%EMBEDDED_DAGS_LOCATION%%#'"$(EMBEDDED_DAGS_LOCATION)"'#g;' \
-e 's#%%REQUIREMENTS_TXT_LOCATION%%#'"$(REQUIREMENTS_TXT_LOCATION)"'#g;' \
Dockerfile.template > $(DOCKERFILE)

$(ROOTFS): $(BUILD_ROOT)
mkdir -p rootfs
Expand All @@ -43,6 +78,22 @@ $(ENTRYPOINT_SH): $(BUILD_ROOT)
mkdir -p $(shell dirname $(ENTRYPOINT_SH))
cp script/entrypoint.sh $(ENTRYPOINT_SH)

$(GIT_SYNC): $(BUILD_ROOT)
mkdir -p $(shell dirname $(GIT_SYNC))
cp script/git-sync $(GIT_SYNC)

$(AIRFLOW_REQUIREMENTS): $(BUILD_ROOT)
mkdir -p $(shell dirname $(AIRFLOW_REQUIREMENTS))
cp requirements/airflow.txt $(AIRFLOW_REQUIREMENTS)

$(DAGS_REQUIREMENTS): $(BUILD_ROOT)
mkdir -p $(shell dirname $(DAGS_REQUIREMENTS))
cp $(REQUIREMENTS_TXT_LOCATION) $(DAGS_REQUIREMENTS)

$(DAGS): $(BUILD_ROOT)
mkdir -p $(shell dirname $(DAGS))
cp -R $(EMBEDDED_DAGS_LOCATION) $(DAGS)

$(BUILD_ROOT):
mkdir -p $(BUILD_ROOT)

Expand Down
Loading