diff --git a/.dockerignore b/.dockerignore index b6e4bf1a..10182d87 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,26 @@ +# Pyenv version file +.python-version + +# Chart artifacts +charts/*.tgz +charts/*/charts +charts/*/requirements.lock + +# Build & test artifacts .eggs +.helm-pid .tox -__pycache__ +AUTHORS +ChangeLog build +conformance +promenade.egg-info +tmp + +# Python artifacts +__pycache__ + +# Non-image related files docs examples -promenade.egg-info tools diff --git a/.gitignore b/.gitignore index 5b4b3a6b..ff7eab03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,25 @@ -__pycache__ -/*.log +# Pyenv version file /.python-version + +# Chart artifacts +/charts/*.tgz +/charts/*/charts +/charts/*/requirements.lock + +# Build & test artifacts +/.eggs +/.helm-pid +/.tox /build /conformance /promenade.egg-info /tmp -.tox/ -/.eggs + +# Python artifacts +__pycache__ + +# Sphinx artifacts +/docs/build/ +/docs/*/_static/ /AUTHORS /ChangeLog - -# Sphinx documentation -docs/build/ -docs/*/_static/ diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..b02f9977 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +# Copyright 2017 AT&T Intellectual Property. All other rights reserved. +# +# Licensed 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. + +HELM ?= helm +HELM_PIDFILE ?= $(abspath ./.helm-pid) +TMP_DIR ?= $(abspath ./tmp) + +CHARTS := $(patsubst %/.,%,$(wildcard charts/*/.)) + +.PHONY: all +all: charts + +.PHONY: charts +charts: $(CHARTS) + @echo Done building charts. + +.PHONY: $(CHARTS) +$(CHARTS): helm-serve + @echo $@ + if [ -s $@/requirements.yaml ]; then $(HELM) dep up $@; fi + $(HELM) lint $@ + $(HELM) template $@ + $(HELM) package -d charts $@ + +.PHONY: helm-serve +helm-serve: + ./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE) $(TMP_DIR) + +.PHONY: clean +clean: + rm -f charts/*.tgz + rm -f charts/*/requirements.lock + rm -rf charts/*/charts diff --git a/charts/.gitignore b/charts/.gitignore index 17d6b367..ebe455eb 100644 --- a/charts/.gitignore +++ b/charts/.gitignore @@ -1 +1,3 @@ /*.tgz +/*/charts +/*/requirements.lock diff --git a/charts/calico/Chart.yaml b/charts/calico/Chart.yaml index b471ea41..440060dd 100644 --- a/charts/calico/Chart.yaml +++ b/charts/calico/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 -description: A Helm chart for Kubernetes +description: A Helm chart for Calico name: calico version: 0.1.0 diff --git a/charts/coredns/requirements.yaml b/charts/coredns/requirements.yaml new file mode 100644 index 00000000..4b156320 --- /dev/null +++ b/charts/coredns/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: helm-toolkit + repository: http://localhost:8879/charts + version: 0.1.0 diff --git a/charts/scheduler/requirements.yaml b/charts/scheduler/requirements.yaml new file mode 100644 index 00000000..4b156320 --- /dev/null +++ b/charts/scheduler/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: helm-toolkit + repository: http://localhost:8879/charts + version: 0.1.0 diff --git a/examples/basic/armada-resources.yaml b/examples/basic/armada-resources.yaml index 2b11c199..e1600d67 100644 --- a/examples/basic/armada-resources.yaml +++ b/examples/basic/armada-resources.yaml @@ -80,7 +80,7 @@ data: values: {} source: type: git - location: https://git.openstack.org/openstack/openstack-helm + location: https://git.openstack.org/openstack/openstack-helm-infra subpath: helm-toolkit reference: master dependencies: [] diff --git a/examples/complete/armada-resources.yaml b/examples/complete/armada-resources.yaml index 90d56e2a..053a0295 100644 --- a/examples/complete/armada-resources.yaml +++ b/examples/complete/armada-resources.yaml @@ -109,7 +109,7 @@ data: values: {} source: type: git - location: https://git.openstack.org/openstack/openstack-helm + location: https://git.openstack.org/openstack/openstack-helm-infra subpath: helm-toolkit reference: master dependencies: [] diff --git a/tools/gate/config-templates/bootstrap-armada-config.yaml b/tools/gate/config-templates/bootstrap-armada-config.yaml index eac9511e..5d7d90a7 100644 --- a/tools/gate/config-templates/bootstrap-armada-config.yaml +++ b/tools/gate/config-templates/bootstrap-armada-config.yaml @@ -96,7 +96,7 @@ data: values: {} source: type: git - location: https://git.openstack.org/openstack/openstack-helm + location: https://git.openstack.org/openstack/openstack-helm-infra subpath: helm-toolkit reference: master dependencies: [] diff --git a/tools/helm_tk.sh b/tools/helm_tk.sh new file mode 100755 index 00000000..9516181d --- /dev/null +++ b/tools/helm_tk.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# Copyright 2017 AT&T Intellectual Property. All other rights reserved. +# +# Licensed 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 -eux + +HELM=${1} +HELM_PIDFILE=${2} +SERVE_DIR=${3} + +${HELM} init --client-only + +if [[ -s ${HELM_PIDFILE} ]]; then + HELM_PID=$(cat "${HELM_PIDFILE}") + if ps "${HELM_PID}"; then + kill "${HELM_PID}" + sleep 0.5 + if ps "${HELM_PID}"; then + echo Failed to terminate Helm, PID = "${HELM_PID}" + exit 1 + fi + fi +fi + +${HELM} serve & > /dev/null +HELM_PID=${!} +echo Started Helm, PID = "${HELM_PID}" +echo "${HELM_PID}" > "${HELM_PIDFILE}" + +set +x +if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then + while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do + sleep 1 + echo "Waiting for Helm Repository" + done +else + echo "Helm serve already running" +fi +set -x + +if ${HELM} repo list | grep -q "^stable" ; then + ${HELM} repo remove stable +fi + +${HELM} repo add local http://localhost:8879/charts + +mkdir -p "${SERVE_DIR}" +cd "${SERVE_DIR}" +git clone --depth 1 https://git.openstack.org/openstack/openstack-helm-infra.git || true +cd openstack-helm + +make helm-toolkit