Gate: Refactor and setup for integration gating
This PS tidies up the gate and introduces the intial framework for integration gating. Change-Id: I0bbdfa2088e9ebbe86640c79df4d8b716d9a9705
This commit is contained in:
parent
a908761e68
commit
67d80770e6
@ -17,7 +17,7 @@ Setup etc/hosts
|
||||
---------------
|
||||
|
||||
::
|
||||
|
||||
|
||||
#Replace eth0 with your interface name
|
||||
LOCAL_IP=$(ip addr | awk '/inet/ && /eth0/{sub(/\/.*$/,"",$2); print $2}')
|
||||
cat << EOF | sudo tee -a /etc/hosts
|
||||
@ -31,12 +31,12 @@ Install the latest versions of Docker, Network File System, Git & Make
|
||||
|
||||
::
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends -qq \
|
||||
docker.io \
|
||||
nfs-common \
|
||||
git \
|
||||
make
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends -qq \
|
||||
docker.io \
|
||||
nfs-common \
|
||||
git \
|
||||
make
|
||||
|
||||
Kubectl
|
||||
-------
|
||||
@ -45,13 +45,13 @@ Download and install kubectl, the command line interface for running commands ag
|
||||
|
||||
::
|
||||
|
||||
KUBE_VERSION=v1.6.0
|
||||
HELM_VERSION=v2.3.0
|
||||
TMP_DIR=$(mktemp -d)
|
||||
|
||||
KUBE_VERSION=v1.6.0
|
||||
HELM_VERSION=v2.3.0
|
||||
TMP_DIR=$(mktemp -d)
|
||||
|
||||
curl -sSL https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
|
||||
chmod +x ${TMP_DIR}/kubectl
|
||||
sudo mv ${TMP_DIR}/kubectl /usr/local/bin/kubectl
|
||||
chmod +x ${TMP_DIR}/kubectl
|
||||
sudo mv ${TMP_DIR}/kubectl /usr/local/bin/kubectl
|
||||
|
||||
Helm
|
||||
----
|
||||
@ -61,8 +61,8 @@ Download and install Helm, the package manager for Kubernetes
|
||||
::
|
||||
|
||||
curl -sSL https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxv --strip-components=1 -C ${TMP_DIR}
|
||||
sudo mv ${TMP_DIR}/helm /usr/local/bin/helm
|
||||
rm -rf ${TMP_DIR}
|
||||
sudo mv ${TMP_DIR}/helm /usr/local/bin/helm
|
||||
rm -rf ${TMP_DIR}
|
||||
|
||||
OpenStack-Helm
|
||||
==============
|
||||
@ -145,7 +145,7 @@ In the below examples the default values that would be used in a production-like
|
||||
|
||||
::
|
||||
|
||||
helm install --name=glance local/glance --namespace=openstack --values=./glance/_values-mvp.yaml
|
||||
helm install --name=nova local/nova --namespace=openstack --values=./nova/_values-mvp.yaml --set=conf.nova.libvirt.nova.conf.virt_type=qemu
|
||||
helm install --name=neutron local/neutron --namespace=openstack --values=./neutron/_values-mvp.yaml
|
||||
helm install --name=glance local/glance --namespace=openstack --values=./tools/overrides/mvp/neutron.yaml
|
||||
helm install --name=nova local/nova --namespace=openstack --values=./tools/overrides/mvp/nova.yaml --set=conf.nova.libvirt.nova.conf.virt_type=qemu
|
||||
helm install --name=neutron local/neutron --namespace=openstack --values=./tools/overrides/mvp/neutron.yaml
|
||||
helm install --name=horizon local/horizon --namespace=openstack --set=network.enable_node_port=true
|
||||
|
35
tools/gate/basic_launch.sh
Executable file
35
tools/gate/basic_launch.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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 -ex
|
||||
|
||||
source ${WORK_DIR}/tools/gate/funcs/helm.sh
|
||||
source ${WORK_DIR}/tools/gate/funcs/kube.sh
|
||||
|
||||
helm_build
|
||||
|
||||
helm search
|
||||
|
||||
helm install local/mariadb --name=mariadb --namespace=openstack
|
||||
helm install local/memcached --name=memcached --namespace=openstack
|
||||
helm install local/etcd --name=etcd-rabbitmq --namespace=openstack
|
||||
helm install local/rabbitmq --name=rabbitmq --namespace=openstack
|
||||
kube_wait_for_pods openstack 600
|
||||
|
||||
helm install local/keystone --name=keystone --namespace=openstack
|
||||
kube_wait_for_pods openstack 240
|
||||
|
||||
helm install local/glance --name=glance --namespace=openstack --values=${WORK_DIR}/tools/overrides/glance.yaml
|
||||
helm install local/nova --name=nova --namespace=openstack --values=${WORK_DIR}/tools/overrides/nova.yaml --set=conf.nova.libvirt.nova.conf.virt_type=qemu
|
||||
helm install local/neutron --name=neutron --namespace=openstack --values=${WORK_DIR}/tools/overrides/neutron.yaml
|
||||
kube_wait_for_pods openstack 600
|
62
tools/gate/funcs/helm.sh
Executable file
62
tools/gate/funcs/helm.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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 -e
|
||||
|
||||
function helm_install {
|
||||
TMP_DIR=$(mktemp -d)
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends -qq \
|
||||
git \
|
||||
make \
|
||||
curl \
|
||||
ca-certificates
|
||||
|
||||
# install helm
|
||||
curl -sSL https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxv --strip-components=1 -C ${TMP_DIR}
|
||||
sudo mv ${TMP_DIR}/helm /usr/local/bin/helm
|
||||
rm -rf ${TMP_DIR}
|
||||
}
|
||||
|
||||
function helm_serve {
|
||||
if [[ -d "$HOME/.helm" ]]; then
|
||||
echo ".helm directory found"
|
||||
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 remove stable
|
||||
fi
|
||||
|
||||
helm repo add local http://localhost:8879/charts
|
||||
|
||||
}
|
||||
|
||||
function helm_lint {
|
||||
make build-helm-toolkit -C ${WORK_DIR}
|
||||
make TASK=lint -C ${WORK_DIR}
|
||||
}
|
||||
|
||||
function helm_build {
|
||||
make TASK=build -C ${WORK_DIR}
|
||||
}
|
70
tools/gate/funcs/kube.sh
Executable file
70
tools/gate/funcs/kube.sh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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 -e
|
||||
|
||||
function kube_wait_for_pods {
|
||||
# From Kolla-Kubernetes, orginal authors Kevin Fox & Serguei Bezverkhi
|
||||
# Default wait timeout is 180 seconds
|
||||
set +x
|
||||
end=$(date +%s)
|
||||
if [ x$2 != "x" ]; then
|
||||
end=$((end + $2))
|
||||
else
|
||||
end=$((end + 180))
|
||||
fi
|
||||
while true; do
|
||||
kubectl get pods --namespace=$1 -o json | jq -r \
|
||||
'.items[].status.phase' | grep Pending > /dev/null && \
|
||||
PENDING=True || PENDING=False
|
||||
query='.items[]|select(.status.phase=="Running")'
|
||||
query="$query|.status.containerStatuses[].ready"
|
||||
kubectl get pods --namespace=$1 -o json | jq -r "$query" | \
|
||||
grep false > /dev/null && READY="False" || READY="True"
|
||||
kubectl get jobs -o json --namespace=$1 | jq -r \
|
||||
'.items[] | .spec.completions == .status.succeeded' | \
|
||||
grep false > /dev/null && JOBR="False" || JOBR="True"
|
||||
[ $PENDING == "False" -a $READY == "True" -a $JOBR == "True" ] && \
|
||||
break || true
|
||||
sleep 1
|
||||
now=$(date +%s)
|
||||
[ $now -gt $end ] && echo containers failed to start. && \
|
||||
kubectl get pods --namespace $1 && exit -1
|
||||
done
|
||||
set -x
|
||||
}
|
||||
|
||||
function kubeadm_aio_reqs_install {
|
||||
TMP_DIR=$(mktemp -d)
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends -qq \
|
||||
docker.io \
|
||||
nfs-common \
|
||||
jq
|
||||
|
||||
curl -sSL https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
|
||||
chmod +x ${TMP_DIR}/kubectl
|
||||
sudo mv ${TMP_DIR}/kubectl /usr/local/bin/kubectl
|
||||
}
|
||||
|
||||
function kubeadm_aio_build {
|
||||
sudo docker build --pull -t ${KUBEADM_IMAGE} tools/kubeadm-aio
|
||||
}
|
||||
|
||||
function kubeadm_aio_launch {
|
||||
${WORK_DIR}/tools/kubeadm-aio/kubeadm-aio-launcher.sh
|
||||
mkdir -p ${HOME}/.kube
|
||||
cat ${KUBECONFIG} > ${HOME}/.kube/config
|
||||
kube_wait_for_pods kube-system 240
|
||||
kube_wait_for_pods default 240
|
||||
}
|
20
tools/gate/kubeadm_aio.sh
Executable file
20
tools/gate/kubeadm_aio.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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 -ex
|
||||
|
||||
source ${WORK_DIR}/tools/gate/funcs/kube.sh
|
||||
|
||||
kubeadm_aio_reqs_install
|
||||
kubeadm_aio_build
|
||||
kubeadm_aio_launch
|
@ -13,49 +13,21 @@
|
||||
# limitations under the License.
|
||||
set -ex
|
||||
|
||||
HELM_VERSION=${2:-v2.3.0}
|
||||
WORK_DIR=$(pwd)
|
||||
export HELM_VERSION=${2:-v2.3.0}
|
||||
export KUBE_VERSION=${3:-v1.6.0}
|
||||
export KUBECONFIG=${HOME}/.kubeadm-aio/admin.conf
|
||||
export KUBEADM_IMAGE=openstack-helm/kubeadm-aio:v1.6
|
||||
|
||||
function helm_install {
|
||||
TMP_DIR=$(mktemp -d)
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends -qq \
|
||||
git \
|
||||
make \
|
||||
curl
|
||||
|
||||
# install helm
|
||||
curl -sSL https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxv --strip-components=1 -C ${TMP_DIR}
|
||||
sudo mv ${TMP_DIR}/helm /usr/local/bin/helm
|
||||
rm -rf ${TMP_DIR}
|
||||
}
|
||||
|
||||
function helm_lint {
|
||||
if [[ -d "$HOME/.helm" ]]; then
|
||||
echo ".helm directory found"
|
||||
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 [[ -f "$HOME/.helm/repository/stable/index.yaml" ]]; then
|
||||
helm repo remove stable
|
||||
fi
|
||||
if [[ -z $(-f "$HOME/.helm/repository/local/index.yaml") ]]; then
|
||||
helm repo add local http://localhost:8879/charts
|
||||
fi
|
||||
|
||||
make build-helm-toolkit -C ${WORK_DIR}
|
||||
make TASK=lint -C ${WORK_DIR}
|
||||
}
|
||||
export WORK_DIR=$(pwd)
|
||||
source ${WORK_DIR}/tools/gate/funcs/helm.sh
|
||||
|
||||
helm_install
|
||||
helm_serve
|
||||
helm_lint
|
||||
|
||||
if [ "x$INTEGRATION" == "xAIO" ]; then
|
||||
bash ${WORK_DIR}/tools/gate/kubeadm_aio.sh
|
||||
if [ "x$INTEGRATION_TYPE" == "xbasic" ]; then
|
||||
bash ${WORK_DIR}/tools/gate/basic_launch.sh
|
||||
fi
|
||||
fi
|
||||
|
15
tools/overrides/mvp/README.rst
Normal file
15
tools/overrides/mvp/README.rst
Normal file
@ -0,0 +1,15 @@
|
||||
============================
|
||||
OpenStack-Helm MVP Overrides
|
||||
============================
|
||||
|
||||
The project specific overrides in this directory allow you to reduce the default
|
||||
resilience of OpenStack-Helm, by turning off HA of the Neutron Agents.
|
||||
Additionally the default distributed storage backend, Ceph, is disabled and
|
||||
replaced by local storage for OpenStack components.
|
||||
|
||||
These changed are made to achieve these goals:
|
||||
* Demonstrating how values can be set and defined within OpenStack-Helm
|
||||
* Allowing OpenStack-Helm to run on a single node for:
|
||||
* Development
|
||||
* Demonstration
|
||||
* Basic integration pipelines in a CI System
|
Loading…
Reference in New Issue
Block a user