X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functions.sh;h=4265dcad5bbf9b36ca6b0217425201eef0ca9d15;hb=54001ff5aeaa915b219f45cc18b6f8b67c1ed427;hp=305dcb74c418d5118d8d21b02345682c88e20640;hpb=3c0a7dbb638b633855658baed38e3b871a5bcac0;p=kuberef.git diff --git a/functions.sh b/functions.sh index 305dcb7..4265dca 100755 --- a/functions.sh +++ b/functions.sh @@ -1,12 +1,8 @@ #!/bin/bash -# SPDX-license-identifier: Apache-2.0 -############################################################################## -# Copyright (c) Ericsson AB 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 -############################################################################## + +# SPDX-FileCopyrightText: 2021 Ericsson AB and others +# +# SPDX-License-Identifier: Apache-2.0 info() { _print_msg "INFO" "$1" @@ -36,7 +32,6 @@ check_prerequisites() { #------------------------------------------------------------------------------- # Check for DEPLOYMENT type #------------------------------------------------------------------------------- - DEPLOYMENT=${DEPLOYMENT:-full} if ! [[ "$DEPLOYMENT" =~ ^(full|k8s)$ ]]; then error "Unsupported value for DEPLOYMENT ($DEPLOYMENT)" fi @@ -162,6 +157,7 @@ get_vm_ip() { # Copy files needed by Infra engine & BMRA in the jumphost VM copy_files_jump() { vm_ip="$(get_vm_ip)" + docker_config="/opt/kuberef/docker_config" scp -r -o StrictHostKeyChecking=no \ "$CURRENTPATH"/{hw_config/"$VENDOR"/,sw_config/"$INSTALLER"/} \ "$USERNAME@${vm_ip}:$PROJECT_ROOT" @@ -170,6 +166,10 @@ copy_files_jump() { ~/.ssh/id_rsa \ "$USERNAME@${vm_ip}:.ssh/id_rsa" fi + if [ -f "$docker_config" ]; then + scp -r -o StrictHostKeyChecking=no \ + "$docker_config" "$USERNAME@${vm_ip}:$PROJECT_ROOT" + fi } # Host Provisioning @@ -180,11 +180,11 @@ provision_hosts() { if [ ! -d "${PROJECT_ROOT}/engine" ]; then ssh-keygen -t rsa -N "" -f ${PROJECT_ROOT}/.ssh/id_rsa git clone https://gerrit.nordix.org/infra/engine.git - cp $PROJECT_ROOT/$VENDOR/{pdf.yaml,idf.yaml} \ + cd ${PROJECT_ROOT}/engine/engine && git checkout ${ENGINE_COMMIT_ID} + cp ${PROJECT_ROOT}/${VENDOR}/{pdf.yaml,idf.yaml} \ ${PROJECT_ROOT}/engine/engine fi -cd ${PROJECT_ROOT}/engine/engine -./deploy.sh -s ironic -d centos7 \ +${PROJECT_ROOT}/engine/engine/deploy.sh -s ironic -d ${DISTRO} \ -p file:///${PROJECT_ROOT}/engine/engine/pdf.yaml \ -i file:///${PROJECT_ROOT}/engine/engine/idf.yaml EOF @@ -211,7 +211,7 @@ provision_k8s() { ansible_cmd="/bin/bash -c '" if [[ "$DEPLOYMENT" == "k8s" ]]; then ansible-playbook -i "$CURRENTPATH"/sw_config/bmra/inventory.ini "$CURRENTPATH"/playbooks/pre-install.yaml - ansible_cmd+="yum -y remove python-netaddr; pip install --upgrade pip; pip install ansible==2.9.6; ansible-playbook -i /bmra/inventory.ini /bmra/playbooks/k8s/patch_kubespray.yml;" + ansible_cmd+="yum -y remove python-netaddr; pip install --upgrade pip; pip install ansible==2.9.17; ansible-playbook -i /bmra/inventory.ini /bmra/playbooks/k8s/patch_kubespray.yml;" fi ansible_cmd+="ansible-playbook -i /bmra/inventory.ini /bmra/playbooks/${BMRA_PROFILE}.yml'" @@ -227,28 +227,37 @@ if ! command -v docker; then done fi if [ ! -d "${PROJECT_ROOT}/container-experience-kits" ]; then - git clone --recurse-submodules --depth 1 https://github.com/intel/container-experience-kits.git -b v2.1.0 ${PROJECT_ROOT}/container-experience-kits/ + git clone --recurse-submodules --depth 1 https://github.com/intel/container-experience-kits.git -b v21.03 ${PROJECT_ROOT}/container-experience-kits/ cp -r ${PROJECT_ROOT}/container-experience-kits/examples/${BMRA_PROFILE}/group_vars ${PROJECT_ROOT}/container-experience-kits/ -# NOTE The following condition/workaround will be removed once the reported issue https://github.com/intel/container-experience-kits/issues/68 -# is fixed upstream - if [[ "$DEPLOYMENT" == "full" ]]; then - echo "- name: install Python packages - pip: - name: - - pip==9.0.3" >> ${PROJECT_ROOT}/container-experience-kits/roles/bootstrap/install_packages/tasks/rhel.yml - fi fi -cp ${PROJECT_ROOT}/${INSTALLER}/inventory.ini \ +if [ -f "${PROJECT_ROOT}/docker_config" ]; then + cp ${PROJECT_ROOT}/docker_config \ + ${PROJECT_ROOT}/${INSTALLER}/dockerhub_credentials/vars/main.yml + cp -r ${PROJECT_ROOT}/${INSTALLER}/dockerhub_credentials \ + ${PROJECT_ROOT}/container-experience-kits/roles/ + cp ${PROJECT_ROOT}/${INSTALLER}/patched_k8s.yml \ + ${PROJECT_ROOT}/container-experience-kits/playbooks/k8s/k8s.yml +fi +cp ${PROJECT_ROOT}/${INSTALLER}/{inventory.ini,ansible.cfg} \ ${PROJECT_ROOT}/container-experience-kits/ cp ${PROJECT_ROOT}/${INSTALLER}/{all.yml,kube-node.yml} \ ${PROJECT_ROOT}/container-experience-kits/group_vars/ cp ${PROJECT_ROOT}/${INSTALLER}/patched_cmk_build.yml \ ${PROJECT_ROOT}/container-experience-kits/roles/cmk_install/tasks/main.yml +cp ${PROJECT_ROOT}/${INSTALLER}/patched_vfio.yml \ + ${PROJECT_ROOT}/container-experience-kits/roles/sriov_nic_init/tasks/bind_vf_driver.yml +cp ${PROJECT_ROOT}/${INSTALLER}/patched_rhel_packages.yml \ + ${PROJECT_ROOT}/container-experience-kits/roles/bootstrap/install_packages/tasks/rhel.yml +cp ${PROJECT_ROOT}/${INSTALLER}/patched_packages.yml \ + ${PROJECT_ROOT}/container-experience-kits/roles/bootstrap/install_packages/tasks/main.yml +cp ${PROJECT_ROOT}/${INSTALLER}/patched_kubespray_requirements.txt \ + ${PROJECT_ROOT}/container-experience-kits/playbooks/k8s/kubespray/requirements.txt + sudo docker run --rm \ -e ANSIBLE_CONFIG=/bmra/ansible.cfg \ -e PROFILE=${BMRA_PROFILE} \ -v ${PROJECT_ROOT}/container-experience-kits:/bmra \ --v ~/.ssh/:/root/.ssh/ rihabbanday/bmra2.0-install:centos \ +-v ~/.ssh/:/root/.ssh/ rihabbanday/bmra21.03-install:centos \ ${ansible_cmd} EOF }