Newer
Older
INSTALL_FROM_SOURCE=""
RELEASE="ReleaseTEN"
INSTALL_K8S_MONITOR=""
INSTALL_NGSA="y"
INSTALL_PLA=""
INSTALL_VIMEMU=""
LXD_REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/lxd"
LXD_REPOSITORY_PATH=""
INSTALL_LIGHTWEIGHT="y"
INSTALL_TO_OPENSTACK=""
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"
garciadeblas
committed
INSTALL_ONLY=""
TO_REBUILD=""
INSTALL_NODOCKER=""
INSTALL_NOHOSTCLIENT=""
INSTALL_CACHELXDIMAGES=""
OSM_VCA_HOST=
OSM_VCA_SECRET=
OSM_VCA_CLOUDNAME="localhost"
OSM_NAMESPACE=osm
NO_HOST_PORTS=""
DOCKER_NOBUILD=""
REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/debian"
OSM_DOCKER_WORK_DIR="${OSM_WORK_DIR}/docker"
OSM_K8S_WORK_DIR="${OSM_DOCKER_WORK_DIR}/osm_pods"
OSM_HELM_WORK_DIR="${OSM_WORK_DIR}/helm"
OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}"
DOCKER_USER=opensourcemano
PULL_IMAGES="y"
KIWIGRID_K8S_SIDECAR_TAG="1.15.6"
PROMETHEUS_TAG=v2.28.1
GRAFANA_TAG=8.1.1
PROMETHEUS_NODE_EXPORTER_TAG=0.18.1
PROMETHEUS_CADVISOR_TAG=latest
OSM_DATABASE_COMMONKEY=
ELASTIC_CURATOR_VERSION=5.5.4
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])?$'
garciadeblas
committed
DOCKER_REGISTRY_URL=
DOCKER_PROXY_URL=
MODULE_DOCKER_TAG=
OSM_INSTALLATION_TYPE="Default"
while getopts ":a:b:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; do
case "${o}" in
a)
APT_PROXY_URL=${OPTARG}
;;
b)
COMMIT_ID=${OPTARG}
REPOSITORY="${OPTARG}"
REPO_ARGS+=(-r "$REPOSITORY")
REPOSITORY_KEY="${OPTARG}"
REPO_ARGS+=(-k "$REPOSITORY_KEY")
REPOSITORY_BASE="${OPTARG}"
REPO_ARGS+=(-u "$REPOSITORY_BASE")
R)
RELEASE="${OPTARG}"
REPO_ARGS+=(-R "$RELEASE")
D)
OSM_DEVOPS="${OPTARG}"
;;
garciadeblas
committed
o)
INSTALL_ONLY="y"
[ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue
[ "${OPTARG}" == "ng-sa" ] && INSTALL_NGSA="y" && continue
garciadeblas
committed
;;
O)
INSTALL_TO_OPENSTACK="y"
if [ -n "${OPTARG}" ]; then
OPENSTACK_OPENRC_FILE_OR_CLOUD="${OPTARG}"
else
echo -e "Invalid argument for -O : ' $OPTARG'\n" >&2
usage && exit 1
fi
;;
f)
OPENSTACK_SSH_KEY_FILE="${OPTARG}"
;;
F)
OPENSTACK_USERDATA_FILE="${OPTARG}"
;;
m)
garciadeblas
committed
[ "${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
garciadeblas
committed
[ "${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}" == "PROMETHEUS-CADVISOR" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS-CADVISOR" && 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
;;
H)
OSM_VCA_HOST="${OPTARG}"
;;
S)
OSM_VCA_SECRET="${OPTARG}"
;;
s)
OSM_NAMESPACE="${OPTARG}" && [[ ! "${OPTARG}" =~ $RE_CHECK ]] && echo "Namespace $OPTARG is invalid. Regex used for validation is $RE_CHECK" && exit 0
;;
t)
OSM_DOCKER_TAG="${OPTARG}"
;;
U)
DOCKER_USER="${OPTARG}"
;;
P)
OSM_VCA_PUBKEY=$(cat ${OPTARG})
;;
A)
OSM_VCA_APIPROXY="${OPTARG}"
;;
l)
LXD_CLOUD_FILE="${OPTARG}"
;;
L)
LXD_CRED_FILE="${OPTARG}"
;;
K)
CONTROLLER_NAME="${OPTARG}"
;;
garciadeblas
committed
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
[ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="--debug" && continue
[ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue
[ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue
[ "${OPTARG}" == "update" ] && UPDATE="y" && continue
[ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue
[ "${OPTARG}" == "test" ] && TEST_INSTALLER="y" && continue
[ "${OPTARG}" == "lxdinstall" ] && INSTALL_LXD="y" && continue
[ "${OPTARG}" == "nolxd" ] && INSTALL_NOLXD="y" && continue
[ "${OPTARG}" == "nodocker" ] && INSTALL_NODOCKER="y" && continue
[ "${OPTARG}" == "showopts" ] && SHOWOPTS="y" && continue
[ "${OPTARG}" == "nohostports" ] && NO_HOST_PORTS="y" && continue
[ "${OPTARG}" == "nojuju" ] && INSTALL_NOJUJU="--nojuju" && continue
[ "${OPTARG}" == "nodockerbuild" ] && DOCKER_NOBUILD="y" && continue
[ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue
[ "${OPTARG}" == "pullimages" ] && continue
[ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue
[ "${OPTARG}" == "charmed" ] && CHARMED="y" && OSM_INSTALLATION_TYPE="Charmed" && continue
[ "${OPTARG}" == "k8s" ] && continue
[ "${OPTARG}" == "lxd" ] && continue
[ "${OPTARG}" == "lxd-cred" ] && continue
[ "${OPTARG}" == "overlay" ] && continue
[ "${OPTARG}" == "only-vca" ] && continue
[ "${OPTARG}" == "small-profile" ] && continue
[ "${OPTARG}" == "vca" ] && continue
[ "${OPTARG}" == "tag" ] && continue
[ "${OPTARG}" == "pla" ] && INSTALL_PLA="y" && continue
[ "${OPTARG}" == "old-sa" ] && INSTALL_NGSA="" && continue
[ "${OPTARG}" == "ng-sa" ] && INSTALL_NGSA="y" && continue
[ "${OPTARG}" == "volume" ] && OPENSTACK_ATTACH_VOLUME="true" && continue
[ "${OPTARG}" == "nocachelxdimages" ] && continue
[ "${OPTARG}" == "cachelxdimages" ] && INSTALL_CACHELXDIMAGES="--cachelxdimages" && continue
echo -e "Invalid option: '--$OPTARG'\n" >&2
usage && exit 1
;;
:)
echo "Option -$OPTARG requires an argument" >&2
usage && exit 1
;;
\?)
echo -e "Invalid option: '-$OPTARG'\n" >&2
usage && exit 1
;;
h)
usage && exit 0
;;
y)
ASSUME_YES="y"
;;
*)
usage && exit 1
;;
esac
done
source $OSM_DEVOPS/common/all_funcs
[ -z "${DEBUG_INSTALL}" ] || DEBUG Debug is on
[ -n "$SHOWOPTS" ] && dump_vars && exit 0
garciadeblas
committed
# Uninstall if "--uninstall"
if [ -n "$UNINSTALL" ]; then
if [ -n "$CHARMED" ]; then
${OSM_DEVOPS}/installers/charmed_uninstall.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D $OSM_DEVOPS -t $DOCKER_TAG "$@" || \
FATAL_TRACK charmed_uninstall "charmed_uninstall.sh failed"
${OSM_DEVOPS}/installers/uninstall_osm.sh "$@" || \
FATAL_TRACK community_uninstall "uninstall_osm.sh failed"
fi
echo -e "\nDONE"
exit 0
fi
# Charmed installation
sudo snap install jq || FATAL "Could not install jq (snap package). Make sure that snap works"
export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)"
track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none
${OSM_DEVOPS}/installers/charmed_install.sh --tag $OSM_DOCKER_TAG "$@" || \
FATAL_TRACK charmed_install "charmed_install.sh failed"
wget -q -O- https://osm-download.etsi.org/ftp/osm-13.0-thirteen/README2.txt &> /dev/null
track end installation_type $OSM_INSTALLATION_TYPE
echo -e "\nDONE"
exit 0
fi
# Installation to Openstack
if [ -n "$INSTALL_TO_OPENSTACK" ]; then
install_to_openstack $OPENSTACK_OPENRC_FILE_OR_CLOUD $OPENSTACK_PUBLIC_NET_NAME $OPENSTACK_ATTACH_VOLUME
echo -e "\nDONE"
exit 0
# Community_installer
[ -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"
# if develop, we force master
[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
OSM_K8S_WORK_DIR="$OSM_DOCKER_WORK_DIR/osm_pods" && OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}"
[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring
[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_NGSA" ] && install_osm_ngsa_service
garciadeblas
committed
[ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
#Installation starts here
wget -q -O- https://osm-download.etsi.org/ftp/osm-13.0-thirteen/README.txt &> /dev/null
export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)"
echo -e "\nDONE"