summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deployments/.env6
-rwxr-xr-xdeployments/_functions.sh36
-rw-r--r--deployments/docker-compose.yml31
-rwxr-xr-xdeployments/start-dev.sh31
-rwxr-xr-xdeployments/start.sh35
-rwxr-xr-xkud/hosting_providers/vagrant/installer.sh6
-rw-r--r--kud/hosting_providers/vagrant/inventory/group_vars/k8s-cluster.yml4
7 files changed, 87 insertions, 62 deletions
diff --git a/deployments/.env b/deployments/.env
index c2630b85..b4740f9b 100644
--- a/deployments/.env
+++ b/deployments/.env
@@ -1,7 +1 @@
IMAGE_NAME=nexus3.onap.org:10003/onap/multicloud/k8s
-CSAR_DIR=/opt/csar
-KUBE_CONFIG_DIR=/opt/kubeconfig
-DATABASE_TYPE=mongo
-DATABASE_IP=172.19.0.2
-PLUGIN_IP=172.19.0.3
-PLUGINS_DIR=/opt/multicloud/k8s
diff --git a/deployments/_functions.sh b/deployments/_functions.sh
new file mode 100755
index 00000000..7942aed0
--- /dev/null
+++ b/deployments/_functions.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright 2019 © Samsung Electronics Co., Ltd.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+function stop_all {
+ docker-compose kill
+ docker-compose down
+}
+
+function start_mongo {
+ docker-compose up -d mongo
+ export DATABASE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=mongo"))
+ export no_proxy=${no_proxy:-},${DATABASE_IP}
+ export NO_PROXY=${NO_PROXY:-},${DATABASE_IP}
+}
+
+function generate_k8sconfig {
+cat << EOF > k8sconfig.json
+{
+ "database-address": "${DATABASE_IP}",
+ "database-type": "mongo",
+ "plugin-dir": "plugins",
+ "service-port": "9015"
+}
+EOF
+}
+
+function start_all {
+ docker-compose up -d
+}
diff --git a/deployments/docker-compose.yml b/deployments/docker-compose.yml
index c4faa537..3fa82fe5 100644
--- a/deployments/docker-compose.yml
+++ b/deployments/docker-compose.yml
@@ -9,53 +9,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-version: '2'
+version: '3'
services:
multicloud-k8s:
image: ${IMAGE_NAME}
- networks:
- multicloud_net:
- ipv4_address: ${PLUGIN_IP}
build:
context: ./
args:
- HTTP_PROXY=${HTTP_PROXY}
- HTTPS_PROXY=${HTTPS_PROXY}
- NO_PROXY=${NO_PROXY}
- ports:
- - "8081:8081"
environment:
- - CSAR_DIR=${CSAR_DIR}
- - KUBE_CONFIG_DIR=${KUBE_CONFIG_DIR}
- - DATABASE_TYPE=${DATABASE_TYPE}
- - DATABASE_IP=${DATABASE_IP}
- - PLUGINS_DIR=${PLUGINS_DIR}
- HTTP_PROXY=${HTTP_PROXY}
- HTTPS_PROXY=${HTTPS_PROXY}
- - NO_PROXY=${NO_PROXY},${DATABASE_IP}
+ - NO_PROXY=${NO_PROXY},mongo
depends_on:
- mongo
- links:
- - mongo
+ network_mode: host
volumes:
- /opt/csar:/opt/csar
- - /opt/kubeconfig:/opt/kubeconfig
+ - ${PWD}/k8sconfig.json:/opt/multicloud/k8splugin/k8sconfig.json:ro
mongo:
image: mongo
- networks:
- multicloud_net:
- ipv4_address: ${DATABASE_IP}
environment:
- HTTP_PROXY=${HTTP_PROXY}
- HTTPS_PROXY=${HTTPS_PROXY}
- NO_PROXY=${NO_PROXY}
-
-networks:
- multicloud_net:
- driver: bridge
- ipam:
- driver: default
- config:
- -
- subnet: 172.19.0.0/27
diff --git a/deployments/start-dev.sh b/deployments/start-dev.sh
new file mode 100755
index 00000000..c4b0cbc4
--- /dev/null
+++ b/deployments/start-dev.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright 2019 © Samsung Electronics Co., Ltd.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+set -o errexit
+set -o nounset
+set -o pipefail
+
+source _functions.sh
+
+#
+# Start k8splugin from compiled binaries to foreground. This is usable for development use.
+#
+source /etc/environment
+k8s_path="$(git rev-parse --show-toplevel)"
+
+stop_all
+start_mongo
+
+echo "Compiling source code"
+pushd $k8s_path/src/k8splugin/
+generate_k8sconfig
+make all
+./k8plugin
+popd
diff --git a/deployments/start.sh b/deployments/start.sh
index a57a6377..e7ff1334 100755
--- a/deployments/start.sh
+++ b/deployments/start.sh
@@ -8,33 +8,16 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+set -o errexit
set -o nounset
set -o pipefail
-source /etc/environment
+source _functions.sh
-k8s_path="$(git rev-parse --show-toplevel)"
-export GOPATH=$k8s_path
-export GO111MODULE=on
-
-echo "Starting mongo services"
-docker-compose kill
-docker-compose up -d mongo
-export DATABASE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aqf "name=mongo"))
-export no_proxy=${no_proxy:-},$DATABASE_IP
-export NO_PROXY=${NO_PROXY:-},$DATABASE_IP
-
-echo "Compiling source code"
-pushd $k8s_path/src/k8splugin/
-cat << EOF > k8sconfig.json
-{
- "database-address": "$DATABASE_IP",
- "database-type": "mongo",
- "plugin-dir": "$(pwd)/plugins",
- "service-port": "9015",
- "kube-config-dir": "$(pwd)/kubeconfigs"
-}
-EOF
-make all
-./k8plugin
-popd
+#
+# Start k8splugin from containers. build.sh should be run prior this script.
+#
+stop_all
+start_mongo
+generate_k8sconfig
+start_all
diff --git a/kud/hosting_providers/vagrant/installer.sh b/kud/hosting_providers/vagrant/installer.sh
index c37d2746..346e2f69 100755
--- a/kud/hosting_providers/vagrant/installer.sh
+++ b/kud/hosting_providers/vagrant/installer.sh
@@ -131,6 +131,8 @@ function install_k8s {
# Configure environment
mkdir -p $HOME/.kube
cp $kud_inventory_folder/artifacts/admin.conf $HOME/.kube/config
+ # Copy Kubespray kubectl to be usable in host running Ansible. Requires kubectl_localhost: true in inventory/group_vars/k8s-cluster.yml
+ sudo cp $kud_inventory_folder/artifacts/kubectl /usr/local/bin/
}
# install_addons() - Install Kubenertes AddOns
@@ -166,7 +168,7 @@ function install_plugin {
pushd $kud_folder/../../../deployments
sudo ./build.sh
if [[ "${testing_enabled}" == "true" ]]; then
- docker-compose up -d
+ sudo ./start.sh
pushd $kud_tests
for functional_test in plugin plugin_edgex; do
bash ${functional_test}.sh
@@ -216,7 +218,7 @@ kud_infra_folder=$kud_folder/../../deployment_infra
export kud_inventory_folder=$kud_folder/inventory
kud_inventory=$kud_inventory_folder/hosts.ini
kud_playbooks=$kud_infra_folder/playbooks
-kud_tests=$kud_folder/tests
+kud_tests=$kud_folder/../../tests
k8s_info_file=$kud_folder/k8s_info.log
testing_enabled=${KUD_ENABLE_TESTS:-false}
diff --git a/kud/hosting_providers/vagrant/inventory/group_vars/k8s-cluster.yml b/kud/hosting_providers/vagrant/inventory/group_vars/k8s-cluster.yml
index 8f719a43..9966ba8a 100644
--- a/kud/hosting_providers/vagrant/inventory/group_vars/k8s-cluster.yml
+++ b/kud/hosting_providers/vagrant/inventory/group_vars/k8s-cluster.yml
@@ -38,8 +38,10 @@ kube_token_auth: true
# Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
kube_network_plugin: flannel
-# Make a copy of kubeconfig on the host that runs Ansible in GITDIR/artifacts
+# Make a copy of kubeconfig (admin.conf) on the host that runs Ansible to inventory/artifacts
kubeconfig_localhost: true
+# Copy kubectl binary on the host that runs Ansible to inventory/artifacts
+kubectl_localhost: true
# Enable MountPropagation gate feature
local_volumes_enabled: true