echo -e "usage: $0 [OPTIONS]"
echo -e "Install OSM from binaries or source code (by default, from binaries)"
echo -e " OPTIONS"
+ echo -e " -h / --help: print this help"
+ echo -e " -y: do not prompt for confirmation, assumes yes"
echo -e " -r <repo>: use specified repository name for osm packages"
echo -e " -R <release>: use specified release for osm binaries (deb packages, lxd images, ...)"
echo -e " -u <repo base>: use specified repository url for osm packages"
echo -e " --vimemu: additionally deploy the VIM emulator as a docker container"
echo -e " --elk_stack: additionally deploy an ELK docker stack for event logging"
echo -e " --pla: install the PLA module for placement support"
- echo -e " -m <MODULE>: install OSM but only rebuild the specified docker images (LW-UI, NBI, LCM, RO, MON, POL, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, PLA, NONE)"
+ echo -e " -m <MODULE>: install OSM but only rebuild or pull the specified docker images (LW-UI, NG-UI, NBI, LCM, RO, MON, POL, PLA, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)"
echo -e " -o <ADDON>: ONLY (un)installs one of the addons (vimemu, elk_stack, k8s_monitor)"
- echo -e " -O <openrc file/cloud name>: Install OSM to an OpenStack infrastructure. <openrc file/cloud name> is required. If a <cloud name> is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/"
+ echo -e " -O <openrc file path/cloud name>: Install OSM to an OpenStack infrastructure. <openrc file/cloud name> is required. If a <cloud name> is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/"
echo -e " -N <openstack public network name/ID>: Public network name required to setup OSM to OpenStack"
+ echo -e " -f <path to SSH public key>: Public SSH key to use to deploy OSM to OpenStack"
+ echo -e " -F <path to cloud-init file>: Cloud-Init userdata file to deploy OSM to OpenStack"
echo -e " -D <devops path> use local devops installation path"
echo -e " -w <work dir> Location to store runtime installation"
echo -e " -t <docker tag> specify osm docker tag (default is latest)"
echo -e " -l: LXD cloud yaml file"
echo -e " -L: LXD credentials yaml file"
echo -e " -K: Specifies the name of the controller to use - The controller must be already bootstrapped"
+ echo -e " -d <docker registry URL> use docker registry URL instead of dockerhub"
+ echo -e " -p <docker proxy URL> set docker proxy URL as part of docker CE configuration"
+ echo -e " -T <docker tag> specify docker tag for the modules specified with option -m"
echo -e " --nolxd: do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)"
echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)"
echo -e " --nojuju: do not juju, assumes already installed"
# echo -e " --reconfigure: reconfigure the modules (DO NOT change NAT rules)"
# echo -e " --update: update to the latest stable release or to the latest commit if using a specific branch"
echo -e " --showopts: print chosen options and exit (only for debugging)"
- echo -e " -y: do not prompt for confirmation, assumes yes"
- echo -e " -h / --help: print this help"
echo -e " --charmed: Deploy and operate OSM with Charms on k8s"
echo -e " [--bundle <bundle path>]: Specify with which bundle to deploy OSM with charms (--charmed option)"
echo -e " [--k8s <kubeconfig path>]: Specify with which kubernetes to deploy OSM with charms (--charmed option)"
remove_stack osm_elk
fi
echo "Now osm docker images and volumes will be deleted"
+ # TODO: clean-up of images should take into account if other tags were used for specific modules
newgrp docker << EONG
- docker image rm ${DOCKER_USER}/ro:${OSM_DOCKER_TAG}
- docker image rm ${DOCKER_USER}/lcm:${OSM_DOCKER_TAG}
- docker image rm ${DOCKER_USER}/keystone:${OSM_DOCKER_TAG}
- docker image rm ${DOCKER_USER}/nbi:${OSM_DOCKER_TAG}
- docker image rm ${DOCKER_USER}/mon:${OSM_DOCKER_TAG}
- docker image rm ${DOCKER_USER}/pol:${OSM_DOCKER_TAG}
- docker image rm ${DOCKER_USER}/pla:${OSM_DOCKER_TAG}
- docker image rm ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}
+for module in ro lcm keystone nbi mon pol pla osmclient; do
+ docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module}:${OSM_DOCKER_TAG}
+done
EONG
if [ -n "$NGUI" ]; then
- sg docker -c "docker image rm ${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}"
+ sg docker -c "docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}"
else
- sg docker -c "docker image rm ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}"
+ sg docker -c "docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}"
fi
if [ -n "$KUBERNETES" ]; then
[ -z "$CONTROLLER_NAME" ] && sg lxd -c "juju kill-controller -t 0 -y $OSM_STACK_NAME"
fi
remove_crontab_job
+
+ # Cleanup Openstack installer venv
+ if [ -d "$OPENSTACK_PYTHON_VENV" ]; then
+ rm -r $OPENSTACK_PYTHON_VENV
+ fi
+
[ -z "$INSTALL_NOHOSTCLIENT" ] && uninstall_osmclient
echo "Some docker images will be kept in case they are used by other docker stacks"
echo "To remove them, just run 'docker image prune' in a terminal"
# Install LXD snap
sudo apt-get remove --purge -y liblxc1 lxc-common lxcfs lxd lxd-client
sudo snap install lxd
- sudo apt-get install zfsutils-linux -y
# Configure LXD
sudo usermod -a -G lxd `whoami`
sleep 2
sudo service docker restart
echo "... restarted Docker service"
+ if [ -n "${DOCKER_PROXY_URL}" ]; then
+ echo "Configuring docker proxy ..."
+ if [ -f /etc/docker/daemon.json ]; then
+ if grep -q registry-mirrors /etc/docker/daemon.json; then
+ sudo sed -Ei 's/("registry-mirrors".*\[)(.*)\]/\1\2, \"'"${DOCKER_PROXY_URL}"'\"\]/' /etc/docker/daemon.json
+ else
+ sudo sed -i 's/{/{\n "registry-mirrors": [\"'"${DOCKER_PROXY_URL}"'\"]",/' /etc/docker/daemon.json
+ fi
+ else
+ sudo cat << EOF > /etc/docker/daemon.json
+{
+ "registry-mirrors": ["${DOCKER_PROXY_URL}"]
+}
+EOF
+ fi
+ sudo systemctl daemon-reload
+ sudo service docker restart
+ echo "... restarted Docker service again"
+ fi
sg docker -c "docker version" || FATAL "Docker installation failed"
echo "... Docker CE installation done"
return 0
fi
}
+function docker_login() {
+ echo "Docker login"
+ sg docker -c "docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASSWORD}"
+}
+
function generate_docker_images() {
echo "Pulling and generating docker images"
- _build_from=$COMMIT_ID
- [ -z "$_build_from" ] && _build_from="master"
+ [ -n "${DOCKER_REGISTRY_URL}" ] && docker_login
- echo "OSM Docker images generated from $_build_from"
-
- BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY")
- BUILD_ARGS+=(--build-arg RELEASE="$RELEASE")
- BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY")
- BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE")
+ echo "Pulling docker images"
if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q KAFKA ; then
sg docker -c "docker pull wurstmeister/zookeeper" || FATAL "cannot get zookeeper docker image"
fi
if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/mon:${OSM_DOCKER_TAG}" || FATAL "cannot pull MON docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MON ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/MON
- git -C ${LWTEMPDIR}/MON checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/MON -f ${LWTEMPDIR}/MON/docker/Dockerfile -t ${DOCKER_USER}/mon --no-cache" || FATAL "cannot build MON docker image"
- fi
-
- if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/pol:${OSM_DOCKER_TAG}" || FATAL "cannot pull POL docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q POL ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/POL
- git -C ${LWTEMPDIR}/POL checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/POL -f ${LWTEMPDIR}/POL/docker/Dockerfile -t ${DOCKER_USER}/pol --no-cache" || FATAL "cannot build POL docker image"
- fi
-
- if [ -n "$PULL_IMAGES" -a -n "$INSTALL_PLA" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/pla:${OSM_DOCKER_TAG}" || FATAL "cannot pull PLA docker image"
- elif [ -z "$TO_REBUILD" -a -n "$INSTALL_PLA" ] || echo $TO_REBUILD | grep -q PLA ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/PLA
- git -C ${LWTEMPDIR}/PLA checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/PLA -f ${LWTEMPDIR}/PLA/docker/Dockerfile -t ${DOCKER_USER}/pla --no-cache" || FATAL "cannot build PLA docker image"
- fi
-
- if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/nbi:${OSM_DOCKER_TAG}" || FATAL "cannot pull NBI docker image"
- sg docker -c "docker pull ${DOCKER_USER}/keystone:${OSM_DOCKER_TAG}" || FATAL "cannot pull KEYSTONE docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NBI ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NBI
- git -C ${LWTEMPDIR}/NBI checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/NBI -f ${LWTEMPDIR}/NBI/Dockerfile.local -t ${DOCKER_USER}/nbi --no-cache" || FATAL "cannot build NBI docker image"
- sg docker -c "docker build ${LWTEMPDIR}/NBI/keystone -f ${LWTEMPDIR}/NBI/keystone/Dockerfile -t ${DOCKER_USER}/keystone --no-cache" || FATAL "cannot build KEYSTONE docker image"
- fi
-
- if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/ro:${OSM_DOCKER_TAG}" || FATAL "cannot pull RO docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q RO ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/RO
- git -C ${LWTEMPDIR}/RO checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/RO -f ${LWTEMPDIR}/RO/Dockerfile-local -t ${DOCKER_USER}/ro --no-cache" || FATAL "cannot build RO docker image"
- fi
-
- if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/lcm:${OSM_DOCKER_TAG}" || FATAL "cannot pull LCM RO docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LCM ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LCM
- git -C ${LWTEMPDIR}/LCM checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/LCM -f ${LWTEMPDIR}/LCM/Dockerfile.local -t ${DOCKER_USER}/lcm --no-cache" || FATAL "cannot build LCM docker image"
- fi
-
- if [ -n "$NGUI" ]; then
- if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull ng-ui docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NG-UI ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NG-UI
- git -C ${LWTEMPDIR}/NG-UI checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/NG-UI -f ${LWTEMPDIR}/NG-UI/docker/Dockerfile -t ${DOCKER_USER}/ng-ui --no-cache" || FATAL "cannot build NG-UI docker image"
- fi
+ echo "Pulling OSM docker images"
+ for module in MON POL NBI KEYSTONE RO LCM NG-UI LW-UI PLA osmclient; do
+ module_lower=${module,,}
+ if [ $module == "LW-UI" ]; then
+ if [ -n "$NGUI" ]; then
+ continue
+ else
+ module_lower="light-ui"
+ fi
+ fi
+ if [ $module == "NG-UI" -a ! -n "$NGUI" ]; then
+ continue
+ fi
+ if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then
+ continue
+ fi
+ module_tag="${OSM_DOCKER_TAG}"
+ if [ -n "${MODULE_DOCKER_TAG}" ] && echo $TO_REBUILD | grep -q $module ; then
+ module_tag="${MODULE_DOCKER_TAG}"
+ fi
+ echo "Pulling ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag} docker image"
+ sg docker -c "docker pull ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag}" || FATAL "cannot pull $module docker image"
+ done
else
- if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull light-ui docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
- git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
- git -C ${LWTEMPDIR}/LW-UI checkout ${COMMIT_ID}
- sg docker -c "docker build ${LWTEMPDIR}/LW-UI -f ${LWTEMPDIR}/LW-UI/docker/Dockerfile -t ${DOCKER_USER}/light-ui --no-cache" || FATAL "cannot build LW-UI docker image"
+ _build_from=$COMMIT_ID
+ [ -z "$_build_from" ] && _build_from="latest"
+ echo "OSM Docker images generated from $_build_from"
+
+ for module in MON POL NBI KEYSTONE RO LCM NG-UI LW-UI PLA; do
+ if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q ${module} ; then
+ module_lower=${module,,}
+ if [ $module == "LW-UI" ]; then
+ if [ -n "$NGUI" ]; then
+ continue
+ else
+ module_lower="light-ui"
+ fi
+ fi
+ if [ $module == "NG-UI" -a ! -n "$NGUI" ]; then
+ continue
+ fi
+ if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then
+ continue
+ fi
+ git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/$module
+ git -C ${LWTEMPDIR}/${module} checkout ${COMMIT_ID}
+ sg docker -c "docker build ${LWTEMPDIR}/${module} -f ${LWTEMPDIR}/${module}/docker/Dockerfile -t ${DOCKER_USER}/${module_lower} --no-cache" || FATAL "cannot build ${module} docker image"
+ fi
+ done
+ if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q osmclient; then
+ BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY")
+ BUILD_ARGS+=(--build-arg RELEASE="$RELEASE")
+ BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY")
+ BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE")
+ sg docker -c "docker build -t ${DOCKER_USER}/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ."
fi
- fi
-
- if [ -n "$PULL_IMAGES" ]; then
- sg docker -c "docker pull ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}" || FATAL "cannot pull osmclient docker image"
- elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-osmclient; then
- sg docker -c "docker build -t ${DOCKER_USER}/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ."
- fi
-
- if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q PROMETHEUS ; then
- sg docker -c "docker pull google/cadvisor:${PROMETHEUS_CADVISOR_TAG}" || FATAL "cannot get prometheus cadvisor docker image"
+ echo "Finished generation of docker images"
fi
- echo "Finished generation of docker images"
+ echo "Finished pulling and generating docker images"
}
function cmp_overwrite() {
fi
if ! grep -Fq "OSMLCM_VCA_CACERT" $OSM_DOCKER_WORK_DIR/lcm.env; then
- echo "OSMLCM_VCA_CACERT=${OSM_VCA_CACERT}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/lcm.env
+ echo "OSMLCM_VCA_CACERT=${OSM_VCA_CACERT}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/lcm.env
else
- $WORKDIR_SUDO sed -i "s|OSMLCM_VCA_CACERT.*|OSMLCM_VCA_CACERT=${OSM_VCA_CACERT}|g" $OSM_DOCKER_WORK_DIR/lcm.env
+ $WORKDIR_SUDO sed -i "s|OSMLCM_VCA_CACERT.*|OSMLCM_VCA_CACERT=${OSM_VCA_CACERT}|g" $OSM_DOCKER_WORK_DIR/lcm.env
fi
if [ -n "$OSM_VCA_APIPROXY" ]; then
fi
if ! grep -Fq "OSMMON_VCA_CACERT" $OSM_DOCKER_WORK_DIR/mon.env; then
- echo "OSMMON_VCA_CACERT=${OSM_VCA_CACERT}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/mon.env
+ echo "OSMMON_VCA_CACERT=${OSM_VCA_CACERT}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/mon.env
else
- $WORKDIR_SUDO sed -i "s|OSMMON_VCA_CACERT.*|OSMMON_VCA_CACERT=${OSM_VCA_CACERT}|g" $OSM_DOCKER_WORK_DIR/mon.env
+ $WORKDIR_SUDO sed -i "s|OSMMON_VCA_CACERT.*|OSMMON_VCA_CACERT=${OSM_VCA_CACERT}|g" $OSM_DOCKER_WORK_DIR/mon.env
fi
}
function generate_osmclient_script () {
- echo "docker run -ti --network net${OSM_STACK_NAME} ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm
+ echo "docker run -ti --network net${OSM_STACK_NAME} ${DOCKER_REGISTRY_URL}${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}" | $WORKDIR_SUDO tee $OSM_DOCKER_WORK_DIR/osm
$WORKDIR_SUDO chmod +x "$OSM_DOCKER_WORK_DIR/osm"
echo "osmclient sidecar container can be found at: $OSM_DOCKER_WORK_DIR/osm"
}
}
function parse_yaml() {
- osm_services="nbi lcm ro pol mon light-ui ng-ui keystone"
TAG=$1
- for osm in $osm_services; do
- $WORKDIR_SUDO sed -i "s/opensourcemano\/$osm:.*/$DOCKER_USER\/$osm:$TAG/g" $OSM_K8S_WORK_DIR/$osm.yaml
+ shift
+ services=$@
+ for module in $services; do
+ if [ "$module" == "pla" ]; then
+ if [ -n "$INSTALL_PLA" ]; then
+ echo "Updating K8s manifest file from opensourcemano\/${module}:.* to ${DOCKER_REGISTRY_URL}${DOCKER_USER}\/${module}:${TAG}"
+ $WORKDIR_SUDO sed -i "s#opensourcemano/pla:.*#${DOCKER_REGISTRY_URL}${DOCKER_USER}/pla:${OSM_DOCKER_TAG}#g" ${OSM_DOCKER_WORK_DIR}/osm_pla/pla.yaml
+ fi
+ else
+ echo "Updating K8s manifest file from opensourcemano\/${module}:.* to ${DOCKER_REGISTRY_URL}${DOCKER_USER}\/${module}:${TAG}"
+ $WORKDIR_SUDO sed -i "s#opensourcemano/${module}:.*#${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module}:${TAG}#g" ${OSM_K8S_WORK_DIR}/${module}.yaml
+ fi
done
- $WORKDIR_SUDO sed -i "s/opensourcemano\/pla:.*/$DOCKER_USER\/\/pla:$OSM_DOCKER_TAG/g" $OSM_DOCKER_WORK_DIR/osm_pla/pla.yaml
+}
+
+function update_manifest_files() {
+ if [ -n "$NGUI" ]; then
+ osm_services="nbi lcm ro pol mon ng-ui keystone pla"
+ else
+ osm_services="nbi lcm ro pol mon light-ui keystone pla"
+ fi
+ list_of_services=""
+ for module in $osm_services; do
+ module_upper="${module^^}"
+ if [ "$module_upper" == "LIGHT-UI" ]; then
+ module_upper="LW-UI"
+ fi
+ if ! echo $TO_REBUILD | grep -q $module_upper ; then
+ list_of_services="$list_of_services $module"
+ fi
+ done
+ list_of_services_to_rebuild=$(echo ${TO_REBUILD,,} |sed "s/lw-ui/light-ui/g")
+ if [ ! "$OSM_DOCKER_TAG" == "9" ]; then
+ parse_yaml $OSM_DOCKER_TAG $list_of_services
+ fi
+ if [ -n "$MODULE_DOCKER_TAG" ]; then
+ parse_yaml $MODULE_DOCKER_TAG $list_of_services_to_rebuild
+ fi
}
function namespace_vol() {
if [ -n "$KUBERNETES" ]; then
deploy_charmed_services
kube_secrets
- [ ! $OSM_DOCKER_TAG == "8" ] && parse_yaml $OSM_DOCKER_TAG
+ update_manifest_files
namespace_vol
deploy_osm_services
if [ -n "$INSTALL_PLA"]; then
[ -n "$KUBERNETES" ] && add_local_k8scluster
track add_local_k8scluster
- wget -q -O- https://osm-download.etsi.org/ftp/osm-8.0-eight/README2.txt &> /dev/null
+ wget -q -O- https://osm-download.etsi.org/ftp/osm-9.0-nine/README2.txt &> /dev/null
track end
return 0
}
$WORKDIR_SUDO apt install -y python3-pip
$WORKDIR_SUDO -H LC_ALL=C python3 -m pip install -U pip
+ # Create a venv to avoid conflicts with the host installation
+ python3 -m venv $OPENSTACK_PYTHON_VENV
+
+ source $OPENSTACK_PYTHON_VENV/bin/activate
+
# Install Ansible, OpenStack client and SDK
- $WORKDIR_SUDO -H LC_ALL=C python3 -m pip install -U python-openstackclient "openstacksdk<1" "ansible>=2.9,<3"
+ python -m pip install -U wheel
+ python -m pip install -U python-openstackclient "openstacksdk>=0.12.0,<1" "ansible>=2.10,<2.11"
+
+ # Install the Openstack cloud module (ansible>=2.10)
+ ansible-galaxy collection install openstack.cloud
export ANSIBLE_CONFIG="$OSM_DEVOPS/installers/openstack/ansible.cfg"
OSM_INSTALLER_ARGS="${REPO_ARGS[@]}"
+ ANSIBLE_VARS="external_network_name=$2 setup_volume=$3 server_name=$OPENSTACK_VM_NAME"
+
+ if [ -n "$OPENSTACK_SSH_KEY_FILE" ]; then
+ ANSIBLE_VARS+=" key_file=$OPENSTACK_SSH_KEY_FILE"
+ fi
+
+ if [ -n "$OPENSTACK_USERDATA_FILE" ]; then
+ ANSIBLE_VARS+=" userdata_file=$OPENSTACK_USERDATA_FILE"
+ fi
+
# Execute the Ansible playbook based on openrc or clouds.yaml
if [ -e "$1" ]; then
. $1
- ansible-playbook -e external_network_name=$2 -e installer_args="\"$OSM_INSTALLER_ARGS\"" \
- -e setup_volume=$3 $OSM_DEVOPS/installers/openstack/site.yml
+ ansible-playbook -e installer_args="\"$OSM_INSTALLER_ARGS\"" -e "$ANSIBLE_VARS" \
+ $OSM_DEVOPS/installers/openstack/site.yml
else
- ansible-playbook -e external_network_name=$2 -e installer_args="\"$OSM_INSTALLER_ARGS\"" \
- -e setup_volume=$3 -e cloud_name=$1 $OSM_DEVOPS/installers/openstack/site.yml
+ ansible-playbook -e installer_args="\"$OSM_INSTALLER_ARGS\"" -e "$ANSIBLE_VARS" \
+ -e cloud_name=$1 $OSM_DEVOPS/installers/openstack/site.yml
fi
+ # Exit from venv
+ deactivate
+
return 0
}
echo "OPENSTACK_PUBLIC_NET_NAME=$OPENSTACK_PUBLIC_NET_NAME"
echo "OPENSTACK_OPENRC_FILE_OR_CLOUD=$OPENSTACK_OPENRC_FILE_OR_CLOUD"
echo "OPENSTACK_ATTACH_VOLUME=$OPENSTACK_ATTACH_VOLUME"
+ echo "OPENSTACK_SSH_KEY_FILE"="$OPENSTACK_SSH_KEY_FILE"
+ echo "OPENSTACK_USERDATA_FILE"="$OPENSTACK_USERDATA_FILE"
+ echo "OPENSTACK_VM_NAME"="$OPENSTACK_VM_NAME"
echo "INSTALL_K8S_MONITOR=$INSTALL_K8S_MONITOR"
echo "TO_REBUILD=$TO_REBUILD"
echo "INSTALL_NOLXD=$INSTALL_NOLXD"
echo "PULL_IMAGES=$PULL_IMAGES"
echo "KUBERNETES=$KUBERNETES"
echo "NGUI=$NGUI"
+ echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL"
+ echo "DOCKER_PROXY_URL=$DOCKER_PROXY_URL"
echo "SHOWOPTS=$SHOWOPTS"
echo "Install from specific refspec (-b): $COMMIT_ID"
}
wget -q -O /dev/null $url
}
+function parse_docker_registry_url() {
+ DOCKER_REGISTRY_USER=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[1]}')
+ DOCKER_REGISTRY_PASSWORD=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); split(a[1],b,":"); print b[2]}')
+ DOCKER_REGISTRY_URL=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); print a[2]}')
+}
+
JUJU_AGENT_VERSION=2.8.6
UNINSTALL=""
DEVELOP=""
COMMIT_ID=""
ASSUME_YES=""
INSTALL_FROM_SOURCE=""
-RELEASE="ReleaseEIGHT"
+RELEASE="ReleaseNINE"
REPOSITORY="stable"
INSTALL_VIMEMU=""
INSTALL_PLA=""
OPENSTACK_OPENRC_FILE_OR_CLOUD=""
OPENSTACK_PUBLIC_NET_NAME=""
OPENSTACK_ATTACH_VOLUME="false"
+OPENSTACK_SSH_KEY_FILE=""
+OPENSTACK_USERDATA_FILE=""
+OPENSTACK_VM_NAME="server-osm"
+OPENSTACK_PYTHON_VENV="$HOME/.virtual-envs/osm"
INSTALL_ONLY=""
INSTALL_ELK=""
TO_REBUILD=""
INSTALL_NOLXD=""
INSTALL_NODOCKER=""
INSTALL_NOJUJU=""
-KUBERNETES=""
+KUBERNETES="y"
NGUI="y"
INSTALL_K8S_MONITOR=""
INSTALL_NOHOSTCLIENT=""
POD_NETWORK_CIDR=10.244.0.0/16
K8S_MANIFEST_DIR="/etc/kubernetes/manifests"
RE_CHECK='^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'
+DOCKER_REGISTRY_URL=
+DOCKER_PROXY_URL=
+MODULE_DOCKER_TAG=
-while getopts ":b:r:c:n:k:u:R:D:o:O:m:N:H:S:s:w:t:U:P:A:l:L:K:-: hy" o; do
+while getopts ":b:r:c:n:k:u:R:D:o:O:m:N:H:S:s:w:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; do
case "${o}" in
b)
COMMIT_ID=${OPTARG}
REPO_ARGS+=(-r "$REPOSITORY")
;;
c)
- [ "${OPTARG}" == "swarm" ] && continue
+ [ "${OPTARG}" == "swarm" ] && KUBERNETES="" && REPO_ARGS+=(-c "${OPTARG}") && continue
[ "${OPTARG}" == "k8s" ] && KUBERNETES="y" && continue
echo -e "Invalid argument for -i : ' $OPTARG'\n" >&2
usage && exit 1
;;
n)
- [ "${OPTARG}" == "lwui" ] && NGUI="" && continue
+ [ "${OPTARG}" == "lwui" ] && NGUI="" && REPO_ARGS+=(-n "${OPTARG}") && continue
[ "${OPTARG}" == "ngui" ] && continue
echo -e "Invalid argument for -n : ' $OPTARG'\n" >&2
usage && exit 1
usage && exit 1
fi
;;
+ f)
+ OPENSTACK_SSH_KEY_FILE="${OPTARG}"
+ ;;
+ F)
+ OPENSTACK_USERDATA_FILE="${OPTARG}"
+ ;;
N)
OPENSTACK_PUBLIC_NET_NAME="${OPTARG}"
;;
m)
[ "${OPTARG}" == "LW-UI" ] && TO_REBUILD="$TO_REBUILD LW-UI" && continue
+ [ "${OPTARG}" == "NG-UI" ] && TO_REBUILD="$TO_REBUILD NG-UI" && continue
[ "${OPTARG}" == "NBI" ] && TO_REBUILD="$TO_REBUILD NBI" && continue
[ "${OPTARG}" == "LCM" ] && TO_REBUILD="$TO_REBUILD LCM" && continue
[ "${OPTARG}" == "RO" ] && TO_REBUILD="$TO_REBUILD RO" && continue
[ "${OPTARG}" == "MON" ] && TO_REBUILD="$TO_REBUILD MON" && continue
[ "${OPTARG}" == "POL" ] && TO_REBUILD="$TO_REBUILD POL" && continue
+ [ "${OPTARG}" == "PLA" ] && TO_REBUILD="$TO_REBUILD PLA" && continue
+ [ "${OPTARG}" == "osmclient" ] && TO_REBUILD="$TO_REBUILD osmclient" && continue
[ "${OPTARG}" == "KAFKA" ] && TO_REBUILD="$TO_REBUILD KAFKA" && continue
[ "${OPTARG}" == "MONGO" ] && TO_REBUILD="$TO_REBUILD MONGO" && continue
[ "${OPTARG}" == "PROMETHEUS" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS" && continue
[ "${OPTARG}" == "KEYSTONE-DB" ] && TO_REBUILD="$TO_REBUILD KEYSTONE-DB" && continue
[ "${OPTARG}" == "GRAFANA" ] && TO_REBUILD="$TO_REBUILD GRAFANA" && continue
[ "${OPTARG}" == "NONE" ] && TO_REBUILD="$TO_REBUILD NONE" && continue
- [ "${OPTARG}" == "PLA" ] && TO_REBUILD="$TO_REBUILD PLA" && continue
;;
H)
OSM_VCA_HOST="${OPTARG}"
K)
CONTROLLER_NAME="${OPTARG}"
;;
+ d)
+ DOCKER_REGISTRY_URL="${OPTARG}"
+ ;;
+ p)
+ DOCKER_PROXY_URL="${OPTARG}"
+ ;;
+ T)
+ MODULE_DOCKER_TAG="${OPTARG}"
+ ;;
-)
[ "${OPTARG}" == "help" ] && usage && exit 0
[ "${OPTARG}" == "source" ] && INSTALL_FROM_SOURCE="y" && PULL_IMAGES="" && continue
esac
done
+[ -n "$DOCKER_REGISTRY_URL" ] && parse_docker_registry_url
[ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" != " NONE" ] && echo $TO_REBUILD | grep -q NONE && FATAL "Incompatible option: -m NONE cannot be used with other -m options"
[ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" == " PLA" ] && [ -z "$INSTALL_PLA" ] && FATAL "Incompatible option: -m PLA cannot be used without --pla option"
[ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
#Installation starts here
-wget -q -O- https://osm-download.etsi.org/ftp/osm-8.0-eight/README.txt &> /dev/null
+wget -q -O- https://osm-download.etsi.org/ftp/osm-9.0-nine/README.txt &> /dev/null
track start
[ -n "$INSTALL_LIGHTWEIGHT" ] && install_lightweight && echo -e "\nDONE" && exit 0
#Install vim-emu (optional)
[ -n "$INSTALL_VIMEMU" ] && install_docker_ce && install_vimemu
-wget -q -O- https://osm-download.etsi.org/ftp/osm-8.0-eight/README2.txt &> /dev/null
+wget -q -O- https://osm-download.etsi.org/ftp/osm-9.0-nine/README2.txt &> /dev/null
track end
echo -e "\nDONE"