aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rwxr-xr-x[-rw-r--r--]deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml6
-rw-r--r--deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml16
-rw-r--r--deploy/adapters/cobbler/snippets/kickstart_sysctl.conf1
-rw-r--r--deploy/adapters/cobbler/snippets/preseed_sysctl.conf1
-rw-r--r--deploy/adapters/cobbler/snippets/sysctl.xml1
-rw-r--r--deploy/client.py17
-rwxr-xr-xdeploy/compass_vm.sh20
-rw-r--r--deploy/conf/base.conf1
-rw-r--r--deploy/config_parse.py1
-rwxr-xr-xdeploy/launch.sh5
-rw-r--r--deploy/status_callback.py2
11 files changed, 57 insertions, 14 deletions
diff --git a/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml b/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
index 9f20cdbc..eb80066e 100644..100755
--- a/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
+++ b/deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
@@ -30,3 +30,9 @@
max_fail_percentage: 0
roles:
- kargo
+
+- hosts: kube_master
+ remote_user: root
+ max_fail_percentage: 0
+ roles:
+ - post-k8s
diff --git a/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml
new file mode 100644
index 00000000..3feca3e5
--- /dev/null
+++ b/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml
@@ -0,0 +1,16 @@
+##############################################################################
+# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others.
+#
+# 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
+##############################################################################
+---
+
+- name: fetch admin.conf
+ fetch:
+ src: /etc/kubernetes/admin.conf
+ dest: /opt/admin.conf
+ flat: "yes"
+ when: inventory_hostname == groups['kube_master'][0]
diff --git a/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf b/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf
index c227ecfa..112f010d 100644
--- a/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf
+++ b/deploy/adapters/cobbler/snippets/kickstart_sysctl.conf
@@ -59,7 +59,6 @@ net.ipv4.ip_local_port_range = 15000 61000
net.ipv4.tcp_fin_timeout=30
# fast cycling of sockets in time_wait state and re-using them
-net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
# increase the maximum number of requests queued to a listen socket
diff --git a/deploy/adapters/cobbler/snippets/preseed_sysctl.conf b/deploy/adapters/cobbler/snippets/preseed_sysctl.conf
index c227ecfa..112f010d 100644
--- a/deploy/adapters/cobbler/snippets/preseed_sysctl.conf
+++ b/deploy/adapters/cobbler/snippets/preseed_sysctl.conf
@@ -59,7 +59,6 @@ net.ipv4.ip_local_port_range = 15000 61000
net.ipv4.tcp_fin_timeout=30
# fast cycling of sockets in time_wait state and re-using them
-net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
# increase the maximum number of requests queued to a listen socket
diff --git a/deploy/adapters/cobbler/snippets/sysctl.xml b/deploy/adapters/cobbler/snippets/sysctl.xml
index fe13bf7f..42f95976 100644
--- a/deploy/adapters/cobbler/snippets/sysctl.xml
+++ b/deploy/adapters/cobbler/snippets/sysctl.xml
@@ -62,7 +62,6 @@ net.ipv4.ip_local_port_range = 15000 61000
net.ipv4.tcp_fin_timeout=30
# fast cycling of sockets in time_wait state and re-using them
-net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
# increase the maximum number of requests queued to a listen socket
diff --git a/deploy/client.py b/deploy/client.py
index 910aa7f8..891e632c 100644
--- a/deploy/client.py
+++ b/deploy/client.py
@@ -399,17 +399,20 @@ class CompassClient(object):
except:
raise RuntimeError('subnet %s format is invalid' % subnet)
- if CONF.expansion == "false":
+ subnet_exist = False
+ for subnet_in_db in subnets_in_db:
+ if subnet == subnet_in_db['subnet']:
+ subnet_mapping[subnet] = subnet_in_db['id']
+ subnet_exist = True
+ break
+
+ if not subnet_exist:
status, resp = self.client.add_subnet(subnet)
LOG.info('add subnet %s status %s response %s',
subnet, status, resp)
if not self.is_ok(status):
raise RuntimeError('failed to add subnet %s' % subnet)
subnet_mapping[resp['subnet']] = resp['id']
- else:
- for subnet_in_db in subnets_in_db:
- if subnet == subnet_in_db['subnet']:
- subnet_mapping[subnet] = subnet_in_db['id']
self.subnet_mapping = subnet_mapping
@@ -475,8 +478,8 @@ class CompassClient(object):
if host['hostname'] in hostnames:
self.host_mapping[host['hostname']] = host['id']
- if CONF.expansion == "false":
- assert(len(self.host_mapping) == len(machines))
+ # if CONF.expansion == "false":
+ # assert(len(self.host_mapping) == len(machines))
def set_cluster_os_config(self, cluster_id):
"""set cluster os config."""
diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh
index 7689f41c..cf215f3b 100755
--- a/deploy/compass_vm.sh
+++ b/deploy/compass_vm.sh
@@ -10,6 +10,26 @@
compass_vm_dir=$WORK_DIR/vm/compass
rsa_file=$compass_vm_dir/boot.rsa
ssh_args="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $rsa_file"
+
+function check_container_alive() {
+ docker exec -it compass-deck bash -c "exit" 1>/dev/null 2>&1
+ local deck_state=$?
+ docker exec -it compass-tasks bash -c "exit" 1>/dev/null 2>&1
+ local tasks_state=$?
+ docker exec -it compass-cobbler bash -c "exit" 1>/dev/null 2>&1
+ local cobbler_state=$?
+ docker exec -it compass-db bash -c "exit" 1>/dev/null 2>&1
+ local db_state=$?
+ docker exec -it compass-mq bash -c "exit" 1>/dev/null 2>&1
+ local mq_state=$?
+
+ if [ $((deck_state||tasks_state||cobbler_state||db_state||mq-state)) == 0 ]; then
+ echo "true"
+ else
+ echo "false"
+ fi
+}
+
function tear_down_compass() {
sudo virsh destroy compass > /dev/null 2>&1
sudo virsh undefine compass > /dev/null 2>&1
diff --git a/deploy/conf/base.conf b/deploy/conf/base.conf
index c2bf5291..5395405d 100644
--- a/deploy/conf/base.conf
+++ b/deploy/conf/base.conf
@@ -8,7 +8,6 @@ export EXT_NAT_GW=${EXT_NAT_GW:-192.16.1.1}
export EXT_NAT_IP_START=${EXT_NAT_IP_START:-192.16.1.3}
export EXT_NAT_IP_END=${EXT_NAT_IP_END:-192.16.1.254}
export EXTERNAL_NIC=${EXTERNAL_NIC:-eth0}
-export CLUSTER_NAME="opnfv2"
export DOMAIN="ods.com"
export PARTITIONS="/=30%,/home=5%,/tmp=5%,/var=60%"
export SUBNETS="10.1.0.0/24,172.16.2.0/24,172.16.3.0/24,172.16.4.0/24"
diff --git a/deploy/config_parse.py b/deploy/config_parse.py
index 3d8dedc5..1575ca37 100644
--- a/deploy/config_parse.py
+++ b/deploy/config_parse.py
@@ -104,6 +104,7 @@ def export_dha_file(dha, dha_file, ofile):
plugin_list.append(plugin_str)
env.update({'plugins': ','.join(plugin_list)})
+ env.update({'CLUSTER_NAME': dha.get('NAME', "opnfv")})
env.update({'TYPE': dha.get('TYPE', "virtual")})
env.update({'FLAVOR': dha.get('FLAVOR', "cluster")})
env.update({'HOSTNAMES': hostnames(dha, ',')})
diff --git a/deploy/launch.sh b/deploy/launch.sh
index 6cbad1fa..98d9e4d6 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -55,7 +55,8 @@ if [[ "$EXPANSION" == "false" ]]; then
export machines
- if [[ "$DEPLOY_COMPASS" == "true" ]]; then
+ CONTAINER_ALIVE=$(check_container_alive)
+ if [[ "$DEPLOY_COMPASS" == "true" && "$CONTAINER_ALIVE" == "false" ]]; then
if ! prepare_env;then
echo "prepare_env failed"
exit 1
@@ -71,7 +72,7 @@ if [[ "$EXPANSION" == "false" ]]; then
log_error "launch_compass failed"
exit 1
fi
- else
+ elif [[ "$DEPLOY_COMPASS" == "true" && "$CONTAINER_ALIVE" == "true" ]]; then
refresh_compass_core
fi
else
diff --git a/deploy/status_callback.py b/deploy/status_callback.py
index f0615f3f..6169b87f 100644
--- a/deploy/status_callback.py
+++ b/deploy/status_callback.py
@@ -8,7 +8,7 @@
##############################################################################
import httplib
-import json
+import simplejson as json
import sys # noqa:F401
from ansible.plugins.callback import CallbackBase