aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVictor Morales <victor.morales@intel.com>2018-05-03 00:37:18 -0700
committerVictor Morales <victor.morales@intel.com>2018-05-03 00:37:18 -0700
commit1d88c96c47c15d06b4a85f4b579e51df84a052b3 (patch)
tree490d95a3f0fc494795f8251b9c9fe9be70dc14e3 /lib
parent9659e8fceedd5b8b0b75456c4b30f1d1848baffb (diff)
General improvements
This script contains several changes to improve the code: - The OOM configuration file for deploying ONAP services has been changed to enable more services. - Expose the proxy configuration process for docker. - Remove All-in-One scenario from the options and documentation Change-Id: I7e089f846148fc3ee2ba3572628b7175a677d324 Signed-off-by: Victor Morales <victor.morales@intel.com> Issue-ID: INT-478
Diffstat (limited to 'lib')
-rwxr-xr-xlib/_installers32
-rwxr-xr-xlib/_onap_functions24
-rwxr-xr-xlib/aai2
-rw-r--r--lib/files/dev.yaml28
-rwxr-xr-xlib/oom17
-rwxr-xr-xlib/openstack45
6 files changed, 106 insertions, 42 deletions
diff --git a/lib/_installers b/lib/_installers
index e01b15c..bfc8574 100755
--- a/lib/_installers
+++ b/lib/_installers
@@ -109,12 +109,11 @@ function install_python_requirements {
popd
}
-# _configure_docker_settings() - Configures Docker settings
-function _configure_docker_settings {
+# _configure_docker_proxy() - Configure Docker proxy settings
+function _configure_docker_proxy {
local docker_conf_backup=/tmp/docker.backup
- local docker_conf=/etc/default/docker
+ local docker_conf=${1:-/etc/default/docker}
local chameleonsocks_filename=chameleonsocks.sh
- local max_concurrent_downloads=${1:-3}
cp ${docker_conf} ${docker_conf_backup}
if [ $http_proxy ]; then
@@ -129,12 +128,21 @@ function _configure_docker_settings {
chmod 755 $chameleonsocks_filename
socks=$(echo $socks_proxy | sed -e "s/^.*\///" | sed -e "s/:.*$//")
port=$(echo $socks_proxy | sed -e "s/^.*://")
+ ./$chameleonsocks_filename --uninstall
PROXY=$socks PORT=$port ./$chameleonsocks_filename --install
rm $chameleonsocks_filename
cp ${docker_conf_backup} ${docker_conf}
fi
fi
rm ${docker_conf_backup}
+}
+
+# _configure_docker_settings() - Configures Docker settings
+function _configure_docker_settings {
+ local docker_conf=/etc/default/docker
+ local max_concurrent_downloads=${1:-3}
+
+ _configure_docker_proxy $docker_conf
echo "DOCKER_OPTS=\"-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock --max-concurrent-downloads $max_concurrent_downloads \"" >> $docker_conf
usermod -aG docker $USER
@@ -334,15 +342,7 @@ function _install_rancher {
# install_kubernetes() - Function that deploys kubernetes
function install_kubernetes {
local installer_k8s_type=${1:-rancher}
-
- case $installer_k8s_type in
- kubespray)
- _install_kubespray_k8s
- ;;
- rancher)
- _install_rancher_k8s
- ;;
- esac
+ _install_${installer_k8s_type}_k8s
}
# _install_kubespray_k8s() - Function that installs Kubernetes using kubespray tool
@@ -352,6 +352,7 @@ function _install_kubespray_k8s {
clone_repo kubernetes-incubator/kubespray $src_folder https://github.com/
install_python_package netaddr
install_python_package ansible==2.4.0.0
+ install_docker
pushd $src_folder
rm -rf inventory/*
mkdir -p inventory/group_vars
@@ -372,6 +373,8 @@ function _install_kubespray_k8s {
echo " type: NodePort" >> roles/kubernetes-apps/ansible/templates/dashboard.yml.j2
ansible-playbook -vvv -i inventory/inventory.cfg cluster.yml -b | tee setup-kubernetes.log
popd
+ swapon -a
+ _configure_docker_proxy
}
# _pull_rancher_images() - Function that retrieves Rancher images required for k8s
@@ -426,9 +429,6 @@ function _install_kubectl {
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
mkdir ~/.kube
- pushd ~/.kube
- python /var/onap/files/kubectl_config_generator.py
- popd
fi
}
diff --git a/lib/_onap_functions b/lib/_onap_functions
index 0844216..29f6bbd 100755
--- a/lib/_onap_functions
+++ b/lib/_onap_functions
@@ -101,8 +101,24 @@ function _configure_maven {
# configure_service() - Download and configure a specific service in upstart
function configure_service {
- local service_script=$1
- curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/$service_script -o /etc/init.d/$service_script
- chmod +x /etc/init.d/$service_script
- update-rc.d $service_script defaults
+ local service=$1
+ declare -A service_paths
+ service_paths=(
+["aai"]="aai"
+["appc"]="appc"
+["sdc"]="asdc"
+["dcae"]="dcae"
+["mr"]="mr"
+["mso"]="mso"
+["policy"]="policy"
+["portal"]="portal"
+["robot"]="robot"
+["sdnc"]="sdnc"
+["vid"]="vid"
+)
+ if [ ${service_paths[$service]} ]; then
+ curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/$service_script -o /etc/init.d/$service_script
+ chmod +x /etc/init.d/$service_script
+ update-rc.d $service_script defaults
+ fi
}
diff --git a/lib/aai b/lib/aai
index 2b4bb65..3ad4adb 100755
--- a/lib/aai
+++ b/lib/aai
@@ -70,7 +70,7 @@ function get_aai_images {
local elasticsearch_version=2.4.1
local hbase_version=1.2.0
- pull_docker_image cassandra:${cassandra_version} &
+ pull_docker_image cassandra:${cassandra_version}
pull_docker_image elasticsearch:${elasticsearch_version} &
docker_openecomp_login
pull_docker_image ${nexus_docker_repo:-nexus3.onap.org:10001}/aaionap/hbase:${hbase_version} &
diff --git a/lib/files/dev.yaml b/lib/files/dev.yaml
index a8dd524..eab05fb 100644
--- a/lib/files/dev.yaml
+++ b/lib/files/dev.yaml
@@ -54,39 +54,39 @@ global:
aaf:
enabled: false
aai:
- enabled: false
+ enabled: true
appc:
- enabled: false
-clamp:
enabled: true
-cli:
+clamp:
enabled: false
+cli:
+ enabled: true
consul:
- enabled: false
+ enabled: true
dcaegen2:
enabled: false
esr:
enabled: false
log:
- enabled: false
+ enabled: true
message-router:
- enabled: false
+ enabled: true
mock:
enabled: false
msb:
- enabled: false
+ enabled: true
multicloud:
- enabled: false
+ enabled: true
policy:
- enabled: false
+ enabled: true
portal:
- enabled: false
+ enabled: true
robot:
enabled: true
sdc:
- enabled: false
+ enabled: true
sdnc:
- enabled: false
+ enabled: true
replicaCount: 1
@@ -132,4 +132,4 @@ vfc:
vid:
enabled: false
vnfsdk:
- enabled: false \ No newline at end of file
+ enabled: false
diff --git a/lib/oom b/lib/oom
index 988c574..91df0a9 100755
--- a/lib/oom
+++ b/lib/oom
@@ -44,8 +44,10 @@ for (i in vname) {
# get_oom_images() - Function that retrieves ONAP images from official hub
function get_oom_images {
if [[ "$build_image" == "True" ]]; then
- # TODO(electrocucaracha): Create a function for calling the build docker function of every ONAP project
- echo "Not Implemented"
+ for project in aai appc dcae dmaap mr msb mso multicloud policy portal robot sdc sdnc vfc vid; do
+ source /var/onap/$project
+ get_${project}_images
+ done
else
if [[ "$clone_repo" != "True" ]]; then
clone_repos "oom"
@@ -62,13 +64,21 @@ function get_oom_images {
# install_oom() - Function that clones OOM and deploys ONAP
function install_oom {
+ local k8s_deployment_tool="kubespray"
+
mount_external_partition sda /var/lib/docker/
install_kubernetes kubespray
- install_helm
+ if [[ "$deployment_tool" == "rancher" ]]; then
+ pushd ~/.kube
+ install_python_package requests
+ python /var/onap/files/kubectl_config_generator.py
+ popd
+ fi
until kubectl cluster-info; do
echo "waiting for kubernetes host"
sleep $oom_delay
done
+ install_helm
printf "Kubernetes Info\n===============\n" > k8s_info.log
echo "Dashboard URL: http://$IP_ADDRESS:$(kubectl get service -n kube-system |grep kubernetes-dashboard | awk '{print $5}' |awk -F "[:/]" '{print $2}')" >> k8s_info.log
echo "Admin user: $(cat /etc/kubernetes/users/known_users.csv |awk -F ',' '{print $2}')" >> k8s_info.log
@@ -88,7 +98,6 @@ function init_oom {
if [[ "$clone_repo" == "True" ]]; then
clone_repos "oom"
fi
-
if [[ "$skip_get_images" == "False" ]]; then
get_oom_images
fi
diff --git a/lib/openstack b/lib/openstack
index 5e51890..38a38a6 100755
--- a/lib/openstack
+++ b/lib/openstack
@@ -63,13 +63,52 @@ function get_openstack_images {
fi
}
-# deploy_openstack() - Function that provisions an OpenStack deployment
-function deploy_openstack {
+# install_openstack() - Function that installs OpenStack services
+function install_openstack {
+ local installer_os_type=${1:-kolla_ansible}
+ _install_${installer_os_type}
+}
+
+# _install_kolla_ansible() - Function that installs OpenStack services thru Kolla-Ansible project
+function _install_kolla_ansible {
install_dependencies
configure_deploy ${1:-"192.168.53.0"} "True"
-
get_openstack_images
kolla-ansible deploy -i $kolla_inventory
kolla-ansible post-deploy
echo "source /etc/kolla/admin-openrc.sh" >> ${HOME}/.bashrc
}
+
+# _install_openstack_helm() - Function that installs OpenStack services thru OpenStack-Helm project
+function _install_openstack_helm {
+ local src_folder=/opt/openstack-helm
+
+ install_kubernetes kubespray
+ install_helm
+ clone_repo openstack/openstack-helm $src_folder https://github.com/
+ install_python_package python-openstackclient python-heatclient
+ mkdir -p /etc/openstack
+ chown -R $(id -un): /etc/openstack
+ tee /etc/openstack/clouds.yaml << EOF
+clouds:
+ openstack_helm:
+ region_name: RegionOne
+ identity_api_version: 3
+ auth:
+ username: 'admin'
+ password: 'password'
+ project_name: 'admin'
+ project_domain_name: 'default'
+ user_domain_name: 'default'
+ auth_url: 'http://keystone.openstack.svc.cluster.local/v3'
+EOF
+ pushd $src_folder
+ make all
+ popd
+}
+
+# init_openstack() - Function that provisions an OpenStack deployment
+function init_openstack {
+ #install_openstack openstack_helm
+ install_openstack
+}