Merge "Create Makefile target to install Helm binary"
This commit is contained in:
commit
9a92abe1d7
20
Makefile
20
Makefile
|
@ -13,11 +13,12 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# APP INFO
|
# APP INFO
|
||||||
|
BUILD_DIR := $(shell mktemp -d)
|
||||||
DOCKER_REGISTRY ?= quay.io
|
DOCKER_REGISTRY ?= quay.io
|
||||||
IMAGE_PREFIX ?= airshipit
|
IMAGE_PREFIX ?= airshipit
|
||||||
IMAGE_NAME ?= armada
|
IMAGE_NAME ?= armada
|
||||||
IMAGE_TAG ?= latest
|
IMAGE_TAG ?= latest
|
||||||
HELM ?= helm
|
HELM ?= $(BUILD_DIR)/helm
|
||||||
PROXY ?= http://proxy.foo.com:8000
|
PROXY ?= http://proxy.foo.com:8000
|
||||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||||
USE_PROXY ?= false
|
USE_PROXY ?= false
|
||||||
|
@ -36,6 +37,8 @@ GIT_SHA = $(shell git rev-parse --short HEAD)
|
||||||
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
|
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
|
||||||
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
|
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
|
||||||
|
|
||||||
|
HELM_PIDFILE ?= $(abspath ./.helm-pid)
|
||||||
|
|
||||||
ifdef VERSION
|
ifdef VERSION
|
||||||
DOCKER_VERSION = $(VERSION)
|
DOCKER_VERSION = $(VERSION)
|
||||||
endif
|
endif
|
||||||
|
@ -82,12 +85,6 @@ check-tox:
|
||||||
.PHONY: images
|
.PHONY: images
|
||||||
images: check-docker build_armada
|
images: check-docker build_armada
|
||||||
|
|
||||||
.PHONY: dry-run
|
|
||||||
dry-run: clean
|
|
||||||
tools/helm_tk.sh $(HELM)
|
|
||||||
$(HELM) dep up charts/$(CHART)
|
|
||||||
$(HELM) template charts/$(CHART)
|
|
||||||
|
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs: clean build_docs
|
docs: clean build_docs
|
||||||
|
|
||||||
|
@ -187,7 +184,7 @@ helm-init-%: helm-serve
|
||||||
cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi
|
cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi
|
||||||
|
|
||||||
.PHONY: helm-serve
|
.PHONY: helm-serve
|
||||||
helm-serve:
|
helm-serve: helm-install
|
||||||
./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE)
|
./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE)
|
||||||
|
|
||||||
.PHONY: helm-lint
|
.PHONY: helm-lint
|
||||||
|
@ -199,7 +196,7 @@ helm-lint-%: helm-init-%
|
||||||
cd charts;$(HELM) lint $*
|
cd charts;$(HELM) lint $*
|
||||||
|
|
||||||
.PHONY: dry-run
|
.PHONY: dry-run
|
||||||
dry-run: $(addprefix dry-run-,$(CHARTS))
|
dry-run: clean $(addprefix dry-run-,$(CHARTS))
|
||||||
|
|
||||||
.PHONY: dry-run-%
|
.PHONY: dry-run-%
|
||||||
dry-run-%: helm-lint-%
|
dry-run-%: helm-lint-%
|
||||||
|
@ -209,3 +206,8 @@ dry-run-%: helm-lint-%
|
||||||
.PHONY: $(CHARTS)
|
.PHONY: $(CHARTS)
|
||||||
$(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner
|
$(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner
|
||||||
$(HELM) package -d charts charts/$@
|
$(HELM) package -d charts charts/$@
|
||||||
|
|
||||||
|
# Install helm binary
|
||||||
|
.PHONY: helm-install
|
||||||
|
helm-install:
|
||||||
|
./tools/helm_install.sh $(HELM)
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2018 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 -x
|
||||||
|
|
||||||
|
HELM=$1
|
||||||
|
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://storage.googleapis.com/kubernetes-helm/helm-v2.10.0-linux-amd64.tar.gz"}
|
||||||
|
|
||||||
|
|
||||||
|
function install_helm_binary {
|
||||||
|
if [[ -z "${HELM}" ]]
|
||||||
|
then
|
||||||
|
echo "No Helm binary target location."
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -w "$(dirname ${HELM})" ]]
|
||||||
|
then
|
||||||
|
TMP_DIR=${BUILD_DIR:-$(mktemp -d)}
|
||||||
|
curl -o "${TMP_DIR}/helm.tar.gz" "${HELM_ARTIFACT_URL}"
|
||||||
|
cd ${TMP_DIR}
|
||||||
|
tar -xvzf helm.tar.gz
|
||||||
|
cp "${TMP_DIR}/linux-amd64/helm" "${HELM}"
|
||||||
|
else
|
||||||
|
echo "Cannot write to ${HELM}"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_helm_binary
|
|
@ -15,37 +15,62 @@
|
||||||
#
|
#
|
||||||
# Script to setup helm-toolkit and helm dep up the armada chart
|
# Script to setup helm-toolkit and helm dep up the armada chart
|
||||||
#
|
#
|
||||||
HELM=$1
|
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
HELM=${1}
|
||||||
|
HELM_PIDFILE=${2}
|
||||||
|
SERVE_DIR=$(mktemp -d)
|
||||||
|
|
||||||
|
${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
|
set -x
|
||||||
|
|
||||||
function helm_serve {
|
if ${HELM} repo list | grep -q "^stable" ; then
|
||||||
if [[ -d "$HOME/.helm" ]]; then
|
${HELM} repo remove stable
|
||||||
echo ".helm directory found"
|
fi
|
||||||
else
|
|
||||||
${HELM} init --client-only
|
|
||||||
fi
|
|
||||||
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
|
|
||||||
${HELM} serve & > /dev/null
|
|
||||||
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
|
|
||||||
|
|
||||||
if ${HELM} repo list | grep -q "^stable" ; then
|
${HELM} repo add local http://localhost:8879/charts
|
||||||
${HELM} repo remove stable
|
|
||||||
fi
|
|
||||||
|
|
||||||
${HELM} repo add local http://localhost:8879/charts
|
|
||||||
|
#OSH Makefile is bugged, so ensure helm is in the path
|
||||||
|
if [[ ${HELM} != "helm" ]]
|
||||||
|
then
|
||||||
|
export PATH=${PATH}:$(dirname ${HELM})
|
||||||
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
|
cd "${SERVE_DIR}"
|
||||||
|
git clone --depth 1 https://git.openstack.org/openstack/openstack-helm-infra.git || true
|
||||||
|
cd openstack-helm-infra
|
||||||
|
|
||||||
|
make helm-toolkit
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdir -p build
|
rm -rf "${SERVE_DIR}"
|
||||||
cd build
|
|
||||||
git clone --depth 1 https://git.openstack.org/openstack/openstack-helm-infra.git || true
|
|
||||||
cd openstack-helm-infra
|
|
||||||
git pull
|
|
||||||
helm_serve
|
|
||||||
make charts
|
|
||||||
|
|
Loading…
Reference in New Issue