Gate: CentOS, Fedora and local use support
This PS adds support for CentOS, Fedora and running the gate locally on a developers machine. It also expands on the original gate scripts by setting up dns access to the OpenStack cluster from the host's running OpenStack-Helm using a daemonset. Change-Id: I99c573a44a73452d558e612fc020e22e7f41ade7
This commit is contained in:
parent
b7f22c35a7
commit
f68b0306ab
21
tools/gate/README.md
Normal file
21
tools/gate/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Openstack-Helm Gate Scripts
|
||||
|
||||
These scripts are used in the OpenStack-Helm Gates and can also be run locally to aid development and for demonstration purposes. Please note that they assume full control of a machine, and may be destructive in nature, so should only be run on a dedicated host.
|
||||
|
||||
## Usage
|
||||
|
||||
The Gate scripts use the `setup_gate.sh` as an entrypoint and are controlled by environment variables, an example of use to run the basic integration test is below:
|
||||
|
||||
``` bash
|
||||
export INTEGRATION=aio
|
||||
export INTEGRATION_TYPE=basic
|
||||
./tools/gate/setup_gate.sh
|
||||
```
|
||||
|
||||
### Supported Platforms
|
||||
|
||||
Currently supported host platforms are:
|
||||
* Ubuntu 16.04
|
||||
* CentOS 7
|
||||
|
||||
With some preparation to docker, and disabling of SELinux operation of Fedora 25 is also supported.
|
@ -29,6 +29,13 @@ kube_wait_for_pods openstack 600
|
||||
helm install local/keystone --name=keystone --namespace=openstack
|
||||
kube_wait_for_pods openstack 240
|
||||
|
||||
# NOTE(portdirect): Temp workaround until module loading is supported by
|
||||
# OpenStack-Helm in Fedora
|
||||
if [ "x$HOST_OS" == "xfedora" ]; then
|
||||
sudo modprobe openvswitch
|
||||
sudo modprobe gre
|
||||
sudo modprobe vxlan
|
||||
fi
|
||||
helm install local/glance --name=glance --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/glance.yaml
|
||||
helm install local/nova --name=nova --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/nova.yaml --set=conf.nova.libvirt.nova.conf.virt_type=qemu
|
||||
helm install local/neutron --name=neutron --namespace=openstack --values=${WORK_DIR}/tools/overrides/mvp/neutron.yaml
|
||||
|
@ -15,16 +15,29 @@ 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
|
||||
if [ "x$HOST_OS" == "xubuntu" ]; then
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends -qq \
|
||||
git \
|
||||
make \
|
||||
curl \
|
||||
ca-certificates
|
||||
elif [ "x$HOST_OS" == "xcentos" ]; then
|
||||
sudo yum install -y \
|
||||
git \
|
||||
make \
|
||||
curl
|
||||
elif [ "x$HOST_OS" == "xfedora" ]; then
|
||||
sudo dnf install -y \
|
||||
git \
|
||||
make \
|
||||
curl
|
||||
fi
|
||||
|
||||
# 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}
|
||||
}
|
||||
|
||||
|
@ -46,15 +46,40 @@ function kube_wait_for_pods {
|
||||
|
||||
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
|
||||
if [ "x$HOST_OS" == "xubuntu" ]; then
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y --no-install-recommends -qq \
|
||||
docker.io \
|
||||
nfs-common \
|
||||
jq
|
||||
elif [ "x$HOST_OS" == "xcentos" ]; then
|
||||
sudo yum install -y \
|
||||
epel-release
|
||||
sudo yum install -y \
|
||||
docker \
|
||||
nfs-utils \
|
||||
jq
|
||||
sudo cp -f /usr/lib/systemd/system/docker.service /etc/systemd/system/docker.service
|
||||
sudo sed -i "s|^MountFlags=slave|MountFlags=share|g" /etc/systemd/system/docker.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
elif [ "x$HOST_OS" == "xfedora" ]; then
|
||||
sudo dnf install -y \
|
||||
docker-latest \
|
||||
nfs-utils \
|
||||
jq
|
||||
sudo cp -f /usr/lib/systemd/system/docker-latest.service /etc/systemd/system/docker.service
|
||||
sudo sed -i "s|/var/lib/docker-latest|/var/lib/docker|g" /etc/systemd/system/docker.service
|
||||
echo "DOCKER_STORAGE_OPTIONS=--storage-driver=overlay2" | sudo tee /etc/sysconfig/docker-latest-storage
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
rm -rf ${TMP_DIR}
|
||||
}
|
||||
|
||||
function kubeadm_aio_build {
|
||||
@ -62,6 +87,11 @@ function kubeadm_aio_build {
|
||||
}
|
||||
|
||||
function kubeadm_aio_launch {
|
||||
if [ "x$HOST_OS" == "xcentos" ]; then
|
||||
sudo setenforce 0 || true
|
||||
elif [ "x$HOST_OS" == "xfedora" ]; then
|
||||
sudo setenforce 0 || true
|
||||
fi
|
||||
${WORK_DIR}/tools/kubeadm-aio/kubeadm-aio-launcher.sh
|
||||
mkdir -p ${HOME}/.kube
|
||||
cat ${KUBECONFIG} > ${HOME}/.kube/config
|
||||
|
44
tools/gate/funcs/network.sh
Executable file
44
tools/gate/funcs/network.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/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 net_resolv_pre_kube {
|
||||
sudo cp -f /etc/resolv.conf /etc/resolv-pre-kube.conf
|
||||
cat << EOF | sudo tee /etc/resolv.conf
|
||||
nameserver 8.8.8.8
|
||||
EOF
|
||||
}
|
||||
|
||||
function net_resolv_kube {
|
||||
kubectl get namespace openstack || kubectl create namespace openstack
|
||||
kubectl create --namespace openstack -f ${WORK_DIR}/tools/gate/manifests/resolv-conf-util.yaml
|
||||
kube_wait_for_pods openstack 240
|
||||
}
|
||||
|
||||
function net_resolv_post_kube {
|
||||
sudo cp -f /etc/resolv-pre-kube.conf /etc/resolv.conf
|
||||
}
|
||||
|
||||
function net_hosts_pre_kube {
|
||||
sudo cp -f /etc/hosts /etc/hosts-pre-kube
|
||||
HOST_IFACE=$(ip route | grep "^default" | awk '{ print $5 }')
|
||||
HOST_IP=$(ip addr | awk "/inet/ && /${HOST_IFACE}/{sub(/\/.*$/,\"\",\$2); print \$2}")
|
||||
|
||||
sudo sed -i "/$(hostname)/d" /etc/hosts
|
||||
echo "${HOST_IP} $(hostname)" | sudo tee -a /etc/hosts
|
||||
}
|
||||
|
||||
function net_hosts_post_kube {
|
||||
sudo cp -f /etc/hosts-pre-kube /etc/hosts
|
||||
}
|
@ -13,8 +13,10 @@
|
||||
# limitations under the License.
|
||||
set -ex
|
||||
|
||||
source ${WORK_DIR}/tools/gate/funcs/network.sh
|
||||
source ${WORK_DIR}/tools/gate/funcs/kube.sh
|
||||
|
||||
kubeadm_aio_reqs_install
|
||||
#kubeadm_aio_build
|
||||
kubeadm_aio_launch
|
||||
net_resolv_kube
|
||||
|
41
tools/gate/manifests/resolv-conf-util.yaml
Normal file
41
tools/gate/manifests/resolv-conf-util.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
# Copyright 2017 The Openstack-Helm Authors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: resolv-conf-util
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
version: v0.1.0
|
||||
name: resolv-conf-util
|
||||
spec:
|
||||
containers:
|
||||
- name: resolv-conf-util
|
||||
image: docker.io/ubuntu:16.04
|
||||
command:
|
||||
- /bin/bash
|
||||
- -ecx
|
||||
- |
|
||||
cat /etc/resolv.conf > /host/etc/resolv.conf
|
||||
tail -f /dev/null
|
||||
volumeMounts:
|
||||
- mountPath: /host/etc/resolv.conf
|
||||
name: host-resolv-conf
|
||||
volumes:
|
||||
- name: host-resolv-conf
|
||||
hostPath:
|
||||
path: /etc/resolv.conf
|
@ -14,13 +14,21 @@
|
||||
set -ex
|
||||
|
||||
export HELM_VERSION=${2:-v2.3.0}
|
||||
export KUBE_VERSION=${3:-v1.6.0}
|
||||
export KUBE_VERSION=${3:-v1.6.2}
|
||||
export KUBECONFIG=${HOME}/.kubeadm-aio/admin.conf
|
||||
export KUBEADM_IMAGE=openstackhelm/kubeadm-aio:v1.6
|
||||
|
||||
export WORK_DIR=$(pwd)
|
||||
source /etc/os-release
|
||||
export HOST_OS=${ID}
|
||||
source ${WORK_DIR}/tools/gate/funcs/network.sh
|
||||
source ${WORK_DIR}/tools/gate/funcs/helm.sh
|
||||
|
||||
# We setup the network for pre kube here, to enable cluster restarts on
|
||||
# development machines
|
||||
net_resolv_pre_kube
|
||||
net_hosts_pre_kube
|
||||
|
||||
helm_install
|
||||
helm_serve
|
||||
helm_lint
|
||||
|
@ -72,7 +72,7 @@ your host you may run the following, but note that this will wipe any previous
|
||||
client configuration you may have.
|
||||
|
||||
``` bash
|
||||
mkdir -p ${HOME}/.kube
|
||||
mkdir -p ${HOME}/.kube
|
||||
cat ${HOME}/.kubeadm-aio/admin.conf > ${HOME}/.kube/config
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user