Update deployment guide doc 33/73233/7
authorxudan16 <xudan16@huawei.com>
Tue, 1 Mar 2022 07:21:56 +0000 (15:21 +0800)
committerGeorg Kunz <georg.kunz@ericsson.com>
Tue, 15 Mar 2022 16:23:03 +0000 (16:23 +0000)
After trying to deploy with vms, find some errors and additional
requirements that need to be added into the deployment guide.

Also add some minor updates in function.sh.

Signed-off-by: xudan16 <xudan16@huawei.com>
Change-Id: I91f1d4efb28178c79d6a68f011da2b165633f345
Reviewed-on: https://gerrit.opnfv.org/gerrit/c/kuberef/+/73233
Tested-by: jenkins-ci <jenkins-opnfv-ci@opnfv.org>
Reviewed-by: Rihab Banday <rihab.banday@ericsson.com>
Reviewed-by: Kanagaraj Manickam <kanagaraj.manickam@huawei.com>
Reviewed-by: Michael Pedersen <michaelx.pedersen@intel.com>
Reviewed-by: Georg Kunz <georg.kunz@ericsson.com>
deploy.env
docs/release/installation/deployment-guide.rst
functions.sh

index 59a5f71..9c4292f 100644 (file)
@@ -29,3 +29,6 @@ export VM_NAME=$(yq r $CURRENTPATH/hw_config/$VENDOR/pdf.yaml jumphost.name)
 export USERNAME=${USERNAME:-ubuntu}
 export PROJECT_ROOT="${PROJECT_ROOT:-/home/ubuntu}"
 export ROOT_PASSWORD="root" # This is used for throubleshooting purposes
+
+# Set to true to show more detailed debug level logs
+export DEBUG=false
index c6f4107..283aa9d 100644 (file)
@@ -31,22 +31,32 @@ Additionally, please make note of the following:
    because the deployment will spin up a VM which will then carry out the host and
    Kubernetes installation.
 
-2. Generate SSH keypair.
+2. A non-root user and generate SSH keypair.
 
 3. Add user to the sudo and libvirt group and have passwordless sudo enabled.
 
-4. Install Ansible (tested with 2.9.14), yq (v3.4.1), jq and virtual-env.
+4. Install Python3 (tested with 3.6.9), Ansible (tested with 2.9.14), Docker, yq (v3.4.1), git, jq and virtual-env (16.2 or later).
 
-Installing and configuring the prerequisites will depend on the operating system installed on the jump server. Below are additional details for setting up some of the more popular distributions.
+Installing and configuring the prerequisites will depend on the operating system installed on the jump server.
+Below are additional details for setting up some of the more popular distributions.
 
 **Ubuntu 20.04 LTS**
 
+.. note::
+
+    Please use Ubuntu 18.04 instead when deploying on virtualized infrastructure.
+    Otherwise, you will get an error "E: Package 'libvirt-bin' has no installation candidate".
+    This is because that openstack ironic will install package libvirt-bin which
+    has been split into libvirt-daemon-system and libvirt-clients from Ubuntu 18.10.
+    It works on Ubuntu 20.04 when deploying on baremetal and provider infrastructure because
+    they create a jumphost VM with Ubuntu 18.04 to do the ironic steps in it.
+
 Install packages using Apt
 
-* ``apt-get install qemu-kvm libvirt-daemon-system libvirt-clients genisoimage virt-manager bridge-utils python3-libvirt git jq``
+* ``sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients libvirt-dev genisoimage virt-manager bridge-utils python3-libvirt git jq``
 * Some of the packages might be installed already
-* Start libvirtd if it isn't running using ``service libvirtd start``
-* Add user to libvirt group using ``adduser `id -un` libvirt``
+* Start libvirtd if it isn't running using ``sudo service libvirtd start``
+* Add user to libvirt group using ``sudo adduser `id -un` libvirt``
 * Log out and in on the current user to update the groups
 
 If ``python`` isn't available in the path, consider adding a symlink for Python3
@@ -58,11 +68,19 @@ Install Ansible
 * ``apt-add-repository --yes --update ppa:ansible/ansible``
 * ``apt-get install ansible``
 
+Install Docker
+
+* Follow the official doc `Install Docker Engine <https://docs.docker.com/engine/install/>`_
+
 Install ``yq`` binary from Github
 
 * Find the correct build of version `v3.4.1 <https://github.com/mikefarah/yq/releases/tag/3.4.1>`_
 * Place the binary in ``/usr/bin/yq`` and make it executable ``chmod +x /usr/bin/yq``
 
+Install virtual-env
+
+* ``pip install --upgrade virtualenv``
+
 You might need to update the libvirt (QEMU) configuration if there are problems with user and group
 
 * You can set the user and group to "root" by uncommenting `user` and `group` in ``/etc/libvirt/qemu.conf``
@@ -115,9 +133,10 @@ Deployment on Virtualized Infrastructure
 
 Following are the steps to spin up a minimalistic Kuberef deployment on VMs aimed for development and testing use-cases:
 
+* Get kuberef code from gerrit ``git clone "https://gerrit.opnfv.org/gerrit/kuberef"``.
 * Set ``VENDOR=libvirt-vms``, ``DISTRO=ubuntu1804`` in ``deploy.env``. Additionally, ensure that other environmental variables defined in this file match your setup.
 * The hardware and network configurations for the VMs are defined under ``hw_config/libvirt-vms``. Currently, the configuration for one master and one worker VM is defined, but additional VM's can be added as desired. Additionally, the default values of hardware storage, CPU information, etc. can be adapted as per need.
-* Once ready, initiate the deployment by running ``dev/deploy_on_vms.sh`.
+* Once ready, initiate the deployment by running ``dev/deploy_on_vms.sh``.
 
 After the successful completion of the deployment, you can do ``virsh list`` to list the provisioned VM's and connect to them over SSH using user ``root``. The SSH public key of the user is already added by the installer in the VM's. The IP of the VMs can be found under ``hw_config/libvirt-vms/pdf.yaml``.
 
index 73f3d27..c4690ef 100755 (executable)
@@ -160,6 +160,12 @@ copy_files_jump() {
 
 # Host Provisioning
 provision_hosts_baremetal() {
+    if [ "${DEBUG:-false}" == "true" ]; then
+        DEBUG_FLAG="-v"
+    else
+        DEBUG_FLAG=""
+    fi
+
     # shellcheck disable=SC2087
     ssh -o StrictHostKeyChecking=no -tT "$USERNAME"@"$(get_vm_ip)" << EOF
 # Install and run cloud-infra
@@ -170,24 +176,29 @@ fi
 cp "${PROJECT_ROOT}"/"${VENDOR}"/{pdf.yaml,idf.yaml} \
 "${PROJECT_ROOT}"/engine/engine
 cd "${PROJECT_ROOT}"/engine/engine || return
-./deploy.sh -s ironic -d "${DISTRO}" \
+./deploy.sh -s ironic "${DEBUG_FLAG}" -d "${DISTRO}" \
 -p file:///"${PROJECT_ROOT}"/engine/engine/pdf.yaml \
 -i file:///"${PROJECT_ROOT}"/engine/engine/idf.yaml
 EOF
 }
 
 provision_hosts_vms() {
+    if [ "${DEBUG:-false}" == "true" ]; then
+        DEBUG_FLAG="-v"
+    else
+        DEBUG_FLAG=""
+    fi
+
     # shellcheck disable=SC2087
-# Install and run cloud-infra
-if [ ! -d "$CURRENTPATH/engine" ]; then
-    git clone https://gerrit.nordix.org/infra/engine.git "${CURRENTPATH}"/engine
-fi
-cp "$CURRENTPATH"/hw_config/"$VENDOR"/{pdf.yaml,idf.yaml} \
-"${CURRENTPATH}"/engine/engine
-cd "$CURRENTPATH"/engine/engine || return
-./deploy.sh -s ironic \
--p file:///"${CURRENTPATH}"/engine/engine/pdf.yaml \
--i file:///"${CURRENTPATH}"/engine/engine/idf.yaml
+    # Install and run cloud-infra
+    if [ ! -d "${CURRENTPATH}/engine" ]; then
+        git clone https://gerrit.nordix.org/infra/engine.git "${CURRENTPATH}"/engine
+    fi
+    cp "${CURRENTPATH}"/hw_config/"${VENDOR}"/{pdf.yaml,idf.yaml} "${CURRENTPATH}"/engine/engine
+    cd "${CURRENTPATH}"/engine/engine || return
+    ./deploy.sh -s ironic "${DEBUG_FLAG}" \
+    -p file:///"${CURRENTPATH}"/engine/engine/pdf.yaml \
+    -i file:///"${CURRENTPATH}"/engine/engine/idf.yaml
 }
 
 # Setup networking on provisioned hosts (Adapt setup_network.sh according to your network setup)
@@ -328,7 +339,7 @@ EOF
 # Creates a python virtual environment
 creates_virtualenv() {
     if [  ! -d "$CURRENTPATH/.venv" ]; then
-        virtualenv .venv
+        virtualenv "$CURRENTPATH/.venv"
     fi
     # shellcheck disable=SC1090
     source "$CURRENTPATH/.venv/bin/activate"