diff options
author | Todd Malsbary <todd.malsbary@intel.com> | 2021-06-25 16:42:58 -0700 |
---|---|---|
committer | Todd Malsbary <todd.malsbary@intel.com> | 2021-06-28 16:03:39 -0700 |
commit | 8a1044af95fe1670a2d0b3d3165f54122bc19d03 (patch) | |
tree | 73130c616f385889fa1740c1d802ee2002a21523 | |
parent | 557f5bcc259ca066edf6850b8cca4060703c9c3f (diff) |
Update python version used in KUD installers to python3
A dependency of kubespray-2.14 now requires python3. Specifically,
ruamel.yaml now fetches ruamel.yaml.clib-0.2.4 whereas it used to
fetch ruamel.yaml.clib-0.2.2. The 0.2.4 requires python 3.5 or
greater.
Issue-ID: MULTICLOUD-1369
Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
Change-Id: Ia362d5adfbe6e08750b493dbceea17df640f26ed
-rwxr-xr-x | kud/hosting_providers/containerized/installer.sh | 29 | ||||
-rwxr-xr-x | kud/hosting_providers/vagrant/installer.sh | 21 |
2 files changed, 22 insertions, 28 deletions
diff --git a/kud/hosting_providers/containerized/installer.sh b/kud/hosting_providers/containerized/installer.sh index 5ac78673..28f1f915 100755 --- a/kud/hosting_providers/containerized/installer.sh +++ b/kud/hosting_providers/containerized/installer.sh @@ -16,16 +16,23 @@ set -ex INSTALLER_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")" function install_prerequisites { -#install package for docker images - echo "Removing ppa for jonathonf/python-3.6" - ls /etc/apt/sources.list.d/ || true - find /etc/apt/sources.list.d -maxdepth 1 -name '*jonathonf*' -delete || true apt-get update - apt-get install -y curl vim wget git \ - software-properties-common python-pip sudo gettext-base + apt-get install -y software-properties-common add-apt-repository -y ppa:longsleep/golang-backports apt-get update - apt-get install -y golang-go rsync + apt-get install -y \ + curl \ + gettext-base \ + git \ + golang-go \ + make \ + python3-pip \ + rsync \ + sshpass \ + sudo \ + unzip \ + vim \ + wget } # _install_ansible() - Install and Configure Ansible program @@ -33,7 +40,7 @@ function _install_ansible { local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml | awk -F ': ' '{print $2}') mkdir -p /etc/ansible/ - pip install --no-cache-dir ansible==$version + pip3 install --no-cache-dir ansible==$version } function install_kubespray { @@ -44,8 +51,6 @@ function install_kubespray { $kud_inventory_folder/group_vars/k8s-cluster.yml | \ awk -F "\"" '{print $2}') local tarball=v$version.tar.gz - # install make to run mitogen target & unzip is mitogen playbook dependency - apt-get install -y sshpass make unzip _install_ansible wget https://github.com/kubernetes-incubator/kubespray/archive/$tarball tar -C $dest_folder -xzf $tarball @@ -54,7 +59,7 @@ function install_kubespray { rm $tarball pushd $dest_folder/kubespray-$version/ - pip install --no-cache-dir -r ./requirements.txt + pip3 install --no-cache-dir -r ./requirements.txt make mitogen popd rm -f $kud_inventory_folder/group_vars/all.yml 2> /dev/null @@ -297,8 +302,6 @@ mkdir -p /opt/csar export CSAR_DIR=/opt/csar function install_pkg { -# Install dependencies - apt-get update install_prerequisites install_kubespray } diff --git a/kud/hosting_providers/vagrant/installer.sh b/kud/hosting_providers/vagrant/installer.sh index 8c8ff7f3..5535c31b 100755 --- a/kud/hosting_providers/vagrant/installer.sh +++ b/kud/hosting_providers/vagrant/installer.sh @@ -40,25 +40,16 @@ function _install_go { sudo sed -i 's|secure_path="\([^"]\+\)"|secure_path="\1:/usr/local/go/bin"|' /etc/sudoers } -# _install_pip() - Install Python Package Manager -function _install_pip { - if $(pip --version &>/dev/null); then - sudo -E pip install --no-cache-dir --upgrade pip - else - sudo apt-get install -y python-dev - curl -sL https://bootstrap.pypa.io/pip/2.7/get-pip.py | sudo python - fi -} - # _install_ansible() - Install and Configure Ansible program function _install_ansible { + sudo apt-get install -y python3-pip + sudo -E pip3 install --no-cache-dir --upgrade pip if $(ansible --version &>/dev/null); then - sudo pip uninstall -y ansible + sudo pip3 uninstall -y ansible fi - _install_pip local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml | awk -F ': ' '{print $2}') sudo mkdir -p /etc/ansible/ - sudo -E pip install --no-cache-dir ansible==$version + sudo -E pip3 install --no-cache-dir ansible==$version } function _set_environment_file { @@ -88,7 +79,7 @@ function install_k8s { rm $tarball pushd $dest_folder/kubespray-$version/ - sudo -E pip install --no-cache-dir -r ./requirements.txt + sudo -E pip3 install --no-cache-dir -r ./requirements.txt make mitogen popd rm -f $kud_inventory_folder/group_vars/all.yml 2> /dev/null @@ -213,7 +204,7 @@ function install_addons { # install_plugin() - Install ONAP Multicloud Kubernetes plugin function install_plugin { echo "Installing multicloud/k8s plugin" - sudo -E pip install --no-cache-dir docker-compose + sudo -E pip3 install --no-cache-dir docker-compose sudo mkdir -p /opt/{kubeconfig,consul/config} sudo cp $HOME/.kube/config /opt/kubeconfig/kud |