Newer
Older
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_STACK_NAME="${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}" == "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
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-12.0-twelve/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 "$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"
# if develop, we force master
[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
check_packages "git wget curl tar snapd"
if [ -z "$OSM_DEVOPS" ]; then
if [ -n "$TEST_INSTALLER" ]; then
echo -e "\nUsing local devops repo for OSM installation"
OSM_DEVOPS="$(dirname $(realpath $(dirname $0)))"
else
echo -e "\nCreating temporary dir for OSM installation"
OSM_DEVOPS="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
trap 'rm -rf "$OSM_DEVOPS"' EXIT
git clone https://osm.etsi.org/gerrit/osm/devops.git $OSM_DEVOPS
if [ -z "$COMMIT_ID" ]; then
echo -e "\nGuessing the current stable release"
LATEST_STABLE_DEVOPS=`git -C $OSM_DEVOPS tag -l v[0-9].* | sort -V | tail -n1`
[ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
else
echo -e "\nDEVOPS Using commit $COMMIT_ID"
fi
git -C $OSM_DEVOPS checkout $COMMIT_ID
fi
fi
[ "${OSM_STACK_NAME}" == "osm" ] || OSM_DOCKER_WORK_DIR="$OSM_WORK_DIR/stack/$OSM_STACK_NAME"
OSM_K8S_WORK_DIR="$OSM_DOCKER_WORK_DIR/osm_pods" && OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}"
[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring
garciadeblas
committed
[ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
#Installation starts here
wget -q -O- https://osm-download.etsi.org/ftp/osm-12.0-twelve/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"