diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | Vagrantfile | 26 | ||||
-rwxr-xr-x | lib/_installers | 32 | ||||
-rwxr-xr-x | lib/_onap_functions | 24 | ||||
-rwxr-xr-x | lib/aai | 2 | ||||
-rw-r--r-- | lib/files/dev.yaml | 28 | ||||
-rwxr-xr-x | lib/oom | 17 | ||||
-rwxr-xr-x | lib/openstack | 45 | ||||
-rw-r--r-- | tools/Run.ps1 | 5 | ||||
-rwxr-xr-x | tools/run.sh | 4 | ||||
-rwxr-xr-x | vagrant_utils/postinstall.sh | 8 |
11 files changed, 113 insertions, 79 deletions
@@ -65,7 +65,6 @@ current options include: | app_name | description | |:----------:|------------------------------------------| -| all_in_one | All ONAP services in a VM (experimental) | | testing | Unit Test VM | | app_name | description | diff --git a/Vagrantfile b/Vagrantfile index d9a9542..f10e8b0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -54,17 +54,6 @@ nodes = [ ] }, { - :name => "all-in-one", - :ips => ['10.252.1.3', "192.168.51.3"], - :macs => [], - :cpus => 2, - :cpu => "50", - :ram => 12 * 1024, - :groups => ["all-in-one"], - :flavor => 'm1.xlarge', - :args => ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc', 'ccsdk', 'multicloud', 'vnfsdk', 'vpp', 'msb'], - }, - { :name => "appc", :ips => ['10.252.0.14', "192.168.50.14"], :macs => [], @@ -174,10 +163,10 @@ nodes = [ :macs => [], :cpus => 16, :cpu => "50", - :ram => 64 * 1024, + :ram => 70 * 1024, :groups => ["individual"], :args => ["oom"], - :hd => { :virtualbox => "61440", :libvirt => "60G", }, + :hd => { :virtualbox => "163840", :libvirt => "160G", }, :fwds => [ { :guest => 8880, :host => 8880, :guest_ip => '192.168.50.21' }, { :guest => 8989, :host => 8989, :guest_ip => '192.168.50.21' }, @@ -333,7 +322,7 @@ requested_machine = ARGV[1] deploy_mode = ENV.fetch('DEPLOY_MODE', 'individual') if requested_machine != nil - if requested_machine.include?("all-in-one") || requested_machine.include?("testing") + if requested_machine.include?("testing") deploy_mode = requested_machine end end @@ -345,15 +334,8 @@ end puts "[INFO] Deploy Mode: #{deploy_mode}" -# In case of all-in-one or testing clean the nodes list +# In case of testing clean the nodes list case deploy_mode - when 'all-in-one' - nodes.select! do |node| - if node[:name].include?("all-in-one") - true if node[:name] - end - end - when 'individual' nodes.select! do |node| if node[:groups][0].include?("individual") 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 } @@ -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 @@ -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 +} diff --git a/tools/Run.ps1 b/tools/Run.ps1 index 8caff0e..dfb38cf 100644 --- a/tools/Run.ps1 +++ b/tools/Run.ps1 @@ -31,7 +31,7 @@ https://wiki.onap.org/display/DW/ONAP+on+Vagrant #> Param( - [ValidateSet("all-in-one","dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "oom", "dmaap", "integration", "testing")] + [ValidateSet("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "oom", "dmaap", "integration", "testing")] [Parameter(Mandatory=$True,Position=0)] [ValidateNotNullOrEmpty()] @@ -85,7 +85,6 @@ $env:SKIP_INSTALL=$skip_install switch ($Command) { - "all-in-one" { $env:DEPLOY_MODE="all-in-one" } { @("dns", "mr", "sdc", "aai", "mso", "robot", "vid", "sdnc", "portal", "dcae", "policy", "appc", "vfc", "multicloud", "ccsdk", "vnfsdk", "vvp", "openstack", "msb", "oom", "dmaap", "integration") -contains $_ } { $env:DEPLOY_MODE="individual" } "testing" { @@ -111,7 +110,7 @@ switch ($Command) } default { - Write-Output $"Usage: $0 {all-in-one|dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|multicloud|ccsdk|vnfsdk|vvp|dmaap|integration|testing}" + Write-Output $"Usage: $0 {dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|multicloud|ccsdk|vnfsdk|vvp|dmaap|integration|testing}" exit 1 } } diff --git a/tools/run.sh b/tools/run.sh index 9718370..b09ddde 100755 --- a/tools/run.sh +++ b/tools/run.sh @@ -15,7 +15,6 @@ Optional arguments: -c <case> Test case to use in testing mode. Commands: - all-in-one Deploy in all-in-one mode. dns|mr|sdc|aai|mso|robot|vid|sdnc|portal|dcae|policy|appc|vfc|vnfsdk|multicloud|ccsdk|vvp|openstack|msb|oom|dmaap|integration Deploy chosen service. testing Deploy in testing mode. EOF @@ -62,9 +61,6 @@ while getopts "ygis:c:" OPTION "${@:2}"; do done case $COMMAND in - "all-in-one" ) - export DEPLOY_MODE='all-in-one' - ;; "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" | "vfc" | "vnfsdk"| "multicloud" | "ccsdk" | "vvp" | "openstack" | "msb" | "oom" | "dmaap" | "integration" ) export DEPLOY_MODE='individual' ;; diff --git a/vagrant_utils/postinstall.sh b/vagrant_utils/postinstall.sh index ea13cc5..24a55db 100755 --- a/vagrant_utils/postinstall.sh +++ b/vagrant_utils/postinstall.sh @@ -4,12 +4,6 @@ if [[ "$debug" == "True" ]]; then set -o xtrace fi -if [[ "$1" == "openstack" ]]; then - source /var/onap/openstack - deploy_openstack - exit -fi - source /var/onap/functions if [[ $no_proxy && $no_proxy != *$IP_ADDRESS* ]]; then @@ -25,7 +19,7 @@ configure_bind for serv in $@; do source /var/onap/${serv} - configure_service ${serv}_serv.sh + configure_service ${serv} init_${serv} echo "source /var/onap/${serv}" >> ~/.bashrc done |