diff options
Diffstat (limited to 'lib/oom')
-rwxr-xr-x | lib/oom | 149 |
1 files changed, 20 insertions, 129 deletions
@@ -2,112 +2,7 @@ source /var/onap/functions -RANCHER_PORT=8880 oom_delay=30 -export RANCHER_URL=http://localhost:$RANCHER_PORT -export RANCHER_ACCESS_KEY='access_key' -export RANCHER_SECRET_KEY='secret_key' - -# _install_docker() - Function that installs Docker version for Rancher -function _install_docker { - if ! $(docker version &>/dev/null); then - curl https://releases.rancher.com/install-docker/1.12.sh | sh - _configure_docker_settings 15 - fi -} - -# _pull_rancher_images() - Function that retrieves Rancher images required for k8s -function _pull_rancher_images { - for image in "net:v0.13.5" "k8s:v1.8.5-rancher3" \ -"lb-service-rancher:v0.7.17" "network-manager:v0.7.18" "metadata:v0.9.5" \ -"kubectld:v0.8.5" "kubernetes-agent:v0.6.6" "dns:v0.15.3" \ -"kubernetes-auth:v0.0.8" "healthcheck:v0.3.3" "etcd:v2.3.7-13" \ -"etc-host-updater:v0.0.3" "net:holder"; do - pull_docker_image rancher/$image & - done -} - -# _pull_k8s_images() - Function that retrieves Google k8s images -function _pull_k8s_images { - for image in "kubernetes-dashboard-amd64:v1.7.1" \ -"k8s-dns-sidecar-amd64:1.14.5" "k8s-dns-kube-dns-amd64:1.14.5" \ -"k8s-dns-dnsmasq-nanny-amd64:1.14.5" "heapster-influxdb-amd64:v1.3.3" \ -"heapster-grafana-amd64:v4.4.3" "heapster-amd64:v1.4.0" "pause-amd64:3.0"; do - pull_docker_image gcr.io/google_containers/$image & - done -} - -# _install_rancher() - Function that installs Rancher CLI and container -function _install_rancher { - local rancher_version=v0.6.5 - local rancher_server_version=v1.6.10 - local rancher_server=rancher/server:$rancher_server_version - - if [ ! -d /opt/rancher/current ]; then - mkdir -p /opt/rancher/current - wget https://github.com/rancher/cli/releases/download/$rancher_version/rancher-linux-amd64-$rancher_version.tar.gz - tar -xzf rancher-linux-amd64-$rancher_version.tar.gz -C /tmp - mv /tmp/rancher-$rancher_version/rancher /opt/rancher/current/ - fi - - _install_docker - pull_docker_image $rancher_server - run_docker_image -d --restart=unless-stopped -p $RANCHER_PORT:8080 $rancher_server - while true; do - if curl --fail -X GET $RANCHER_URL; then - break - fi - echo "waiting for racher" - sleep $oom_delay - done -} - -# _install_kubernetes() - Function that deploys kubernetes via RancherOS host registration -function _install_kubernetes { - local rancher_agent_version=v1.2.7 - local rancher_agent=rancher/agent:$rancher_agent_version - - _install_rancher - - _pull_rancher_images - _pull_k8s_images - pull_docker_image $rancher_agent - wait_docker_pull - - pushd /opt/rancher/current/ - export RANCHER_ENVIRONMENT=`./rancher env create -t kubernetes onap_on_kubernetes` - popd - - install_python_package rancher-agent-registration - export no_proxy=$no_proxy,$IP_ADDRESS - rancher-agent-registration --host-ip $IP_ADDRESS --url http://$IP_ADDRESS:$RANCHER_PORT --environment $RANCHER_ENVIRONMENT --key $RANCHER_ACCESS_KEY --secret $RANCHER_SECRET_KEY -} - -# _install_kubectl() - Function that installs kubectl as client for kubernetes -function _install_kubectl { - if ! $(kubectl version &>/dev/null); then - rm -rf ~/.kube - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl - chmod +x ./kubectl - mv ./kubectl /usr/local/bin/kubectl - mkdir ~/.kube - pushd ~/.kube - python /var/onap/files/kubectl_config_generator.py - popd - fi -} - -# _install_helm() - Function that install Kubernetes Package Manager -function _install_helm { - local helm_version=v2.3.0 - - if ! $(helm version &>/dev/null); then - wget http://storage.googleapis.com/kubernetes-helm/helm-${helm_version}-linux-amd64.tar.gz - tar -zxvf helm-${helm_version}-linux-amd64.tar.gz -C /tmp - mv /tmp/linux-amd64/helm /usr/local/bin/helm - helm init - fi -} # _pull_images_from_yaml() - Function that parses a yaml file and pull their images function _pull_images_from_yaml_file { @@ -165,43 +60,39 @@ function get_oom_images { fi } -# _install_oom() - Function that clones OOM and deploys ONAP +# install_oom() - Function that clones OOM and deploys ONAP function install_oom { + mount_external_partition sda /var/lib/docker/ + install_kubernetes kubespray + install_helm + until kubectl cluster-info; do + echo "waiting for kubernetes host" + sleep $oom_delay + done + 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 + echo "Admin password: $(cat /etc/kubernetes/users/known_users.csv |awk -F ',' '{print $1}')" >> k8s_info.log + if [[ "$clone_repo" != "True" ]]; then clone_repos "oom" fi - pushd ${src_folders[oom]}/kubernetes/oneclick - source setenv.bash - - pushd ${src_folders[oom]}/kubernetes/config - cp onap-parameters-sample.yaml onap-parameters.yaml - ./createConfig.sh -n onap - popd - - for app in consul msb mso message-router sdnc vid robot portal policy appc aai sdc dcaegen2 log cli multicloud clamp vnfsdk uui aaf vfc kube2msb; do - ./createAll.bash -n onap -a $app - done - popd + pushd ${src_folders[oom]}/kubernetes + make repo + make all + helm install local/onap -n beijing -f /var/onap/files/dev.yaml } # init_oom() - Function that deploys ONAP using OOM function init_oom { - mount_external_partition sda /var/lib/docker/ - _install_kubernetes - _install_kubectl - _install_helm if [[ "$clone_repo" == "True" ]]; then clone_repos "oom" fi if [[ "$skip_get_images" == "False" ]]; then get_oom_images - if [[ "$skip_install" == "False" ]]; then - until kubectl cluster-info; do - echo "waiting for kubernetes host" - sleep $oom_delay - done - install_oom - fi + fi + if [[ "$skip_install" == "False" ]]; then + install_oom fi } |