Try starting kubernetes built from source

Seems to work somewhat. the pre/post/gate hook(s) are not kicking
in though. So just getting this in and will iterate.

Change-Id: Ibf6e7a431271de8fb8533e269bb4985fd3e74ff0
This commit is contained in:
Davanum Srinivas 2017-03-30 16:10:36 -04:00 committed by Davanum Srinivas (dims)
parent e64f9f8a93
commit 67b4836ccd
7 changed files with 106 additions and 23 deletions

View File

@ -83,7 +83,7 @@ $(DEST): $(GOPATH)
.bindep:
virtualenv .bindep
.bindep/bin/pip install bindep
.bindep/bin/pip install -i https://pypi.python.org/simple bindep
bindep: .bindep
@.bindep/bin/bindep -b -f bindep.txt || true

0
contrib/gate_hook.sh Normal file → Executable file
View File

0
contrib/post_test_hook.sh Normal file → Executable file
View File

0
contrib/pre_test_hook.sh Normal file → Executable file
View File

118
devstack/plugin.sh Normal file → Executable file
View File

@ -1,37 +1,109 @@
#!/usr/bin/env bash
# plugin.sh - DevStack plugin.sh dispatch script zun-ui
#!/bin/bash
#
# lib/dlm
#
# Functions to control the installation and configuration of kubernetes with the
# external OpenStack cloud provider enabled.
# Dependencies:
#
# - ``functions`` file
# ``stack.sh`` calls the entry points in this order:
#
# - install_k8s_cloud_provider
# - configure_k8s_cloud_provider
# - cleanup_dlm
# Save trace setting
_XTRACE_K8S_PROVIDER=$(set +o | grep xtrace)
set -o xtrace
BASE_DIR=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
# Defaults
# --------
export GOPATH=${BASE_DIR}/go
CONFORMANCE_REPO=${CONFORMANCE_REPO:-github.com/kubernetes/kubernetes}
K8S_SRC=${GOPATH}/src/k8s.io/kubernetes
ETCD_VERSION=v3.1.4
function install_prereqs {
# Install pre-reqs
$BASE_DIR/tools/install-distro-packages.sh
$BASE_DIR/tools/test-setup.sh
}
function install_docker {
# Install docker if needed
if ! is_package_installed docker-engine; then
curl -sSL https://get.docker.io | sudo bash
fi
docker --version
# Get the latest stable version of kubernetes
export K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/stable.txt)
echo "K8S_VERSION : ${K8S_VERSION}"
echo "Starting docker service"
sudo systemctl enable docker.service
sudo systemctl start docker.service --ignore-dependencies
echo "Checking docker service"
sudo docker ps
}
function install_k8s_cloud_provider {
echo_summary "Installing Devstack Plugin"
echo_summary "Installing Devstack Plugin for k8s-cloud-provider"
# golang env details
go env
go version
# Get Kubernetes from source
mkdir -p ${GOPATH}/src/k8s.io/
if [ ! -d "${K8S_SRC}" ]; then
git clone https://${CONFORMANCE_REPO} ${K8S_SRC}
fi
go get -u github.com/jteeuwen/go-bindata/go-bindata || true
# Run the script that builds kubernetes from source and starts the processes
pushd ${K8S_SRC} >/dev/null
hack/install-etcd.sh
run_process kubernetes "sudo -E hack/local-up-cluster.sh"
popd >/dev/null
}
function init_k8s_cloud_provider {
echo_summary "Initialize Devstack Plugin"
# cleanup_k8s_cloud_provider() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_k8s_cloud_provider {
echo_summary "Cleaning up Devstack Plugin for k8s-cloud-provider"
sudo rm -rf "$K8S_SRC"
sudo rm -rf "$DEST/etcd"
}
function configure_k8s_cloud_provider {
echo_summary "Configuring Devstack Plugin"
function stop_k8s_cloud_provider {
echo_summary "Stop Devstack Plugin for k8s-cloud-provider"
stop_process kubernetes
stop_process etcd-server
}
# check for service enabled
if is_service_enabled zun-ui; then
if is_service_enabled k8s-cloud-provider; then
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# Set up system services
# no-op
:
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
# Perform installation of service source
# no-op
:
install_prereqs
install_docker
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
# Configure after the other layer 1 and 2 services have been configured
# no-op
:
install_k8s_cloud_provider
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# no-op
@ -39,14 +111,18 @@ if is_service_enabled zun-ui; then
fi
if [[ "$1" == "unstack" ]]; then
# no-op
:
stop_k8s_cloud_provider
fi
if [[ "$1" == "clean" ]]; then
# Remove state and transient data
# Remember clean.sh first calls unstack.sh
# no-op
:
cleanup_k8s_cloud_provider
fi
fi
# Restore xtrace
$_XTRACE_K8S_PROVIDER
# Tell emacs to use shell-script-mode
## Local variables:
## mode: shell-script
## End:

View File

@ -1,2 +1,5 @@
# settings file for devstack plugin
enable_service k8s_cloud_provider
enable_service k8s-cloud-provider
enable_service etcd-server
enable_service kubernetes

View File

@ -1,5 +1,7 @@
#!/bin/bash -xe
BASE_DIR=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
# Local version to install bindep packages
# Suitable for use for development
@ -20,7 +22,9 @@ fi
# Check for bindep
if ! which bindep; then
pushd $BASE_DIR >/dev/null
make bindep
popd >/dev/null
fi
PACKAGES=$(make bindep || true)