else
echo -e "\nUninstalling OSM"
if [ -n "$KUBERNETES" ]; then
- if [ -n "$K8S_MONITOR" ]; then
+ if [ -n "$INSTALL_K8S_MONITOR" ]; then
# uninstall OSM MONITORING
uninstall_k8s_monitoring
fi
return 0
}
+#Safe unattended install of iptables-persistent
+function check_install_iptables_persistent(){
+ echo -e "\nChecking required packages: iptables-persistent"
+ if dpkg -l iptables-persistent &>/dev/null; then
+ echo -e " Not installed.\nInstalling iptables-persistent requires root privileges"
+ echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
+ echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
+ sudo apt-get -yq install iptables-persistent
+ fi
+}
+
#Configure NAT rules, based on the current IP addresses of containers
function nat(){
- echo -e "\nChecking required packages: iptables-persistent"
- dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \
- sudo apt-get -yq install iptables-persistent
+ check_install_iptables_persistent
+
echo -e "\nConfiguring NAT rules"
echo -e " Required root privileges"
sudo $OSM_DEVOPS/installers/nat_osm
}
function juju_createproxy() {
- echo -e "\nChecking required packages: iptables-persistent"
- dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \
- sudo apt-get -yq install iptables-persistent
+ check_install_iptables_persistent
if ! sudo iptables -t nat -C PREROUTING -p tcp -m tcp -d $DEFAULT_IP --dport 17070 -j DNAT --to-destination $OSM_VCA_HOST; then
sudo iptables -t nat -A PREROUTING -p tcp -m tcp -d $DEFAULT_IP --dport 17070 -j DNAT --to-destination $OSM_VCA_HOST
generate_docker_env_files
if [ -n "$KUBERNETES" ]; then
- if [ -n "$K8S_MONITOR" ]; then
+ if [ -n "$INSTALL_K8S_MONITOR" ]; then
# uninstall OSM MONITORING
uninstall_k8s_monitoring
track uninstall_k8s_monitoring
namespace_vol
deploy_osm_services
track deploy_osm_services_k8s
- if [ -n "$K8S_MONITOR" ]; then
+ if [ -n "$INSTALL_K8S_MONITOR" ]; then
# install OSM MONITORING
install_k8s_monitoring
track install_k8s_monitoring
echo "INSTALL_ONLY=$INSTALL_ONLY"
echo "INSTALL_ELK=$INSTALL_ELK"
#echo "INSTALL_PERFMON=$INSTALL_PERFMON"
+ echo "INSTALL_K8S_MONITOR=$INSTALL_K8S_MONITOR"
echo "TO_REBUILD=$TO_REBUILD"
echo "INSTALL_NOLXD=$INSTALL_NOLXD"
echo "INSTALL_NODOCKER=$INSTALL_NODOCKER"
INSTALL_NODOCKER=""
INSTALL_NOJUJU=""
KUBERNETES=""
-K8S_MONITOR=""
+INSTALL_K8S_MONITOR=""
INSTALL_NOHOSTCLIENT=""
SESSION_ID=`date +%s`
OSM_DEVOPS=
INSTALL_ONLY="y"
[ "${OPTARG}" == "vimemu" ] && INSTALL_VIMEMU="y" && continue
[ "${OPTARG}" == "elk_stack" ] && INSTALL_ELK="y" && continue
+ [ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue
;;
m)
[ "${OPTARG}" == "LW-UI" ] && TO_REBUILD="$TO_REBUILD LW-UI" && continue
[ "${OPTARG}" == "nodockerbuild" ] && DOCKER_NOBUILD="y" && continue
[ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue
[ "${OPTARG}" == "pullimages" ] && continue
- [ "${OPTARG}" == "k8s_monitor" ] && K8S_MONITOR="y" && continue
+ [ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue
echo -e "Invalid option: '--$OPTARG'\n" >&2
usage && exit 1
;;
[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_ELK" ] && deploy_elk
#[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_PERFMON" ] && deploy_perfmon
[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_VIMEMU" ] && install_vimemu
+[ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring
[ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
#Installation starts here