aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2019-01-10 16:12:47 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-10 16:12:47 +0000
commit8db0a40746925ffdd98c6b6718a05e31d17fc755 (patch)
tree38c14c9c74d9238af8c7068967f8ff1baf930421
parent78316e2f313b414e224113150f80140dc0dc12e1 (diff)
parente2bf06f1e964b05334ac179831c18e6cb95b396d (diff)
Merge "Refactor docker-compose variables"
-rw-r--r--deployments/.env7
-rw-r--r--deployments/docker-compose.yml32
-rwxr-xr-xdeployments/start.sh3
-rwxr-xr-xvagrant/installer.sh17
4 files changed, 36 insertions, 23 deletions
diff --git a/deployments/.env b/deployments/.env
new file mode 100644
index 00000000..c2630b85
--- /dev/null
+++ b/deployments/.env
@@ -0,0 +1,7 @@
+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/docker-compose.yml b/deployments/docker-compose.yml
index a72bd096..c4faa537 100644
--- a/deployments/docker-compose.yml
+++ b/deployments/docker-compose.yml
@@ -16,24 +16,24 @@ services:
image: ${IMAGE_NAME}
networks:
multicloud_net:
- ipv4_address: 172.19.0.3
+ ipv4_address: ${PLUGIN_IP}
build:
context: ./
args:
- - HTTP_PROXY=$HTTP_PROXY
- - HTTPS_PROXY=$HTTPS_PROXY
- - NO_PROXY=$NO_PROXY
+ - HTTP_PROXY=${HTTP_PROXY}
+ - HTTPS_PROXY=${HTTPS_PROXY}
+ - NO_PROXY=${NO_PROXY}
ports:
- "8081:8081"
environment:
- - CSAR_DIR=/opt/csar
- - KUBE_CONFIG_DIR=/opt/kubeconfig
- - DATABASE_TYPE=mongo
- - DATABASE_IP=172.19.0.2
- - PLUGINS_DIR=/opt/multicloud/k8s
- - HTTP_PROXY=$HTTP_PROXY
- - HTTPS_PROXY=$HTTPS_PROXY
- - NO_PROXY=$NO_PROXY,172.19.0.2
+ - 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}
depends_on:
- mongo
links:
@@ -45,11 +45,11 @@ services:
image: mongo
networks:
multicloud_net:
- ipv4_address: 172.19.0.2
+ ipv4_address: ${DATABASE_IP}
environment:
- HTTP_PROXY: $HTTP_PROXY
- HTTPS_PROXY: $HTTPS_PROXY
- NO_PROXY: $NO_PROXY
+ - HTTP_PROXY=${HTTP_PROXY}
+ - HTTPS_PROXY=${HTTPS_PROXY}
+ - NO_PROXY=${NO_PROXY}
networks:
multicloud_net:
diff --git a/deployments/start.sh b/deployments/start.sh
index d1b9f68a..233e0282 100755
--- a/deployments/start.sh
+++ b/deployments/start.sh
@@ -15,10 +15,7 @@ source /etc/environment
k8s_path="$(git rev-parse --show-toplevel)"
export GOPATH=$k8s_path
-export IMAGE_NAME="nexus3.onap.org:10003/onap/multicloud/k8s"
-export CSAR_DIR=/opt/csar
-export KUBE_CONFIG_DIR=/opt/kubeconfig
export DATABASE_TYPE=mongo
export PLUGINS_DIR=$k8s_path/src/k8splugin/plugins
diff --git a/vagrant/installer.sh b/vagrant/installer.sh
index 271f44f5..cf1eb357 100755
--- a/vagrant/installer.sh
+++ b/vagrant/installer.sh
@@ -85,6 +85,16 @@ function _install_docker {
sleep 10
}
+function _set_environment_file {
+ ansible_ifconfig=$(ansible ovn-central[0] -i $krd_inventory -m shell -a "ifconfig eth1 |grep \"inet addr\" |awk '{print \$2}' |awk -F: '{print \$2}'")
+ if [[ $ansible_ifconfig != *CHANGED* ]]; then
+ echo "Fail to get the OVN central IP address from eth1 nic"
+ exit
+ fi
+ echo "export OVN_CENTRAL_ADDRESS=$(echo ${ansible_ifconfig#*>>} | tr '\n' ':')6641" | sudo tee --append /etc/environment
+ echo "export KUBE_CONFIG_DIR=/opt/kubeconfig" | sudo tee --append /etc/environment
+}
+
# install_k8s() - Install Kubernetes using kubespray tool
function install_k8s {
echo "Deploying kubernetes"
@@ -151,8 +161,8 @@ function install_plugin {
sudo mkdir -p /opt/{kubeconfig,consul/config}
sudo cp $HOME/.kube/config /opt/kubeconfig/krd
- export KUBE_CONFIG_DIR=/opt/kubeconfig
- echo "export KUBE_CONFIG_DIR=${KUBE_CONFIG_DIR}" | sudo tee --append /etc/environment
+ _set_environment_file
+ source /etc/environment
pushd $krd_folder/../deployments
sudo ./build.sh
@@ -213,8 +223,7 @@ testing_enabled=${KRD_ENABLE_TESTS:-false}
sudo mkdir -p $log_folder
sudo mkdir -p /opt/csar
sudo chown -R $USER /opt/csar
-export CSAR_DIR=/opt/csar
-echo "export CSAR_DIR=${CSAR_DIR}" | sudo tee --append /etc/environment
+echo "export CSAR_DIR=/opt/csar" | sudo tee --append /etc/environment
# Install dependencies
# Setup proxy variables