echo -e " -b tags/v1.1.0 (a specific tag)"
echo -e " ..."
echo -e " -a <apt proxy url>: use this apt proxy url when downloading apt packages (air-gapped installation)"
- echo -e " -s <stack name> or <namespace> user defined stack name when installed using swarm or namespace when installed using k8s, default is osm"
+ echo -e " -s <namespace> namespace when installed using k8s, default is osm"
echo -e " -H <VCA host> use specific juju host controller IP"
echo -e " -S <VCA secret> use VCA/juju secret key"
echo -e " -P <VCA pubkey> use VCA/juju public key file"
OSM_VCA_CLOUDNAME="lxd-cloud"
[ -n "$OSM_VCA_HOST" ] && OSM_VCA_CLOUDNAME="localhost"
if [ -z "$OSM_VCA_HOST" ]; then
- [ -z "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`sg lxd -c "juju show-controller $OSM_STACK_NAME"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
+ [ -z "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`sg lxd -c "juju show-controller $OSM_NAMESPACE"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
[ -n "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`juju show-controller $CONTROLLER_NAME |grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
[ -z "$OSM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address"
fi
if [ -z "$OSM_VCA_SECRET" ]; then
- [ -z "$CONTROLLER_NAME" ] && OSM_VCA_SECRET=$(parse_juju_password $OSM_STACK_NAME)
+ [ -z "$CONTROLLER_NAME" ] && OSM_VCA_SECRET=$(parse_juju_password $OSM_NAMESPACE)
[ -n "$CONTROLLER_NAME" ] && OSM_VCA_SECRET=$(parse_juju_password $CONTROLLER_NAME)
[ -z "$OSM_VCA_SECRET" ] && FATAL "Cannot obtain juju secret"
fi
[ -z "$OSM_VCA_PUBKEY" ] && FATAL "Cannot obtain juju public key"
fi
if [ -z "$OSM_VCA_CACERT" ]; then
- [ -z "$CONTROLLER_NAME" ] && OSM_VCA_CACERT=$(juju controllers --format json | jq -r --arg controller $OSM_STACK_NAME '.controllers[$controller]["ca-cert"]' | base64 | tr -d \\n)
+ [ -z "$CONTROLLER_NAME" ] && OSM_VCA_CACERT=$(juju controllers --format json | jq -r --arg controller $OSM_NAMESPACE '.controllers[$controller]["ca-cert"]' | base64 | tr -d \\n)
[ -n "$CONTROLLER_NAME" ] && OSM_VCA_CACERT=$(juju controllers --format json | jq -r --arg controller $CONTROLLER_NAME '.controllers[$controller]["ca-cert"]' | base64 | tr -d \\n)
[ -z "$OSM_VCA_CACERT" ] && FATAL "Cannot obtain juju CA certificate"
fi
#creates secrets from env files which will be used by containers
function kube_secrets(){
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- kubectl create ns $OSM_STACK_NAME
- kubectl create secret generic lcm-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/lcm.env
- kubectl create secret generic mon-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/mon.env
- kubectl create secret generic nbi-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/nbi.env
- kubectl create secret generic ro-db-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/ro-db.env
- kubectl create secret generic ro-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/ro.env
- kubectl create secret generic keystone-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/keystone.env
- kubectl create secret generic pol-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/pol.env
+ kubectl create ns $OSM_NAMESPACE
+ kubectl create secret generic lcm-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/lcm.env
+ kubectl create secret generic mon-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/mon.env
+ kubectl create secret generic nbi-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/nbi.env
+ kubectl create secret generic ro-db-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/ro-db.env
+ kubectl create secret generic ro-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/ro.env
+ kubectl create secret generic keystone-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/keystone.env
+ kubectl create secret generic pol-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/pol.env
if [ -n "${INSTALL_NGSA}" ]; then
- kubectl create secret generic ngsa-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/ngsa.env
- kubectl create secret generic webhook-translator-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/webhook-translator.env
+ kubectl create secret generic ngsa-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/ngsa.env
+ kubectl create secret generic webhook-translator-secret -n $OSM_NAMESPACE --from-env-file=$OSM_DOCKER_WORK_DIR/webhook-translator.env
fi
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
#deploys osm pods and services
function deploy_osm_services() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- kubectl apply -n $OSM_STACK_NAME -f $OSM_K8S_WORK_DIR
+ kubectl apply -n $OSM_NAMESPACE -f $OSM_K8S_WORK_DIR
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
#deploy charmed services
function deploy_charmed_services() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
- juju add-model $OSM_STACK_NAME $OSM_VCA_K8S_CLOUDNAME
- juju deploy ch:mongodb-k8s -m $OSM_STACK_NAME
+ juju add-model $OSM_NAMESPACE $OSM_VCA_K8S_CLOUDNAME
+ juju deploy ch:mongodb-k8s -m $OSM_NAMESPACE
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
function deploy_osm_pla_service() {
[ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
# corresponding to deploy_osm_services
- kubectl apply -n $OSM_STACK_NAME -f $OSM_DOCKER_WORK_DIR/osm_pla
+ kubectl apply -n $OSM_NAMESPACE -f $OSM_DOCKER_WORK_DIR/osm_pla
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
find_devops_folder
- # TODO: the use of stacks come from docker-compose. We should probably remove
- [ "${OSM_STACK_NAME}" == "osm" ] || OSM_DOCKER_WORK_DIR="$OSM_WORK_DIR/stack/$OSM_STACK_NAME"
-
track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none
track checks checkingroot_ok
FATAL_TRACK k8scluster "install_kubeadm_cluster.sh failed"
track k8scluster k8scluster_ok
- JUJU_OPTS="-D ${OSM_DEVOPS} -s ${OSM_STACK_NAME} -i ${OSM_DEFAULT_IP} ${DEBUG_INSTALL} ${INSTALL_NOJUJU} ${INSTALL_CACHELXDIMAGES}"
+ JUJU_OPTS="-D ${OSM_DEVOPS} -s ${OSM_NAMESPACE} -i ${OSM_DEFAULT_IP} ${DEBUG_INSTALL} ${INSTALL_NOJUJU} ${INSTALL_CACHELXDIMAGES}"
[ -n "${OSM_VCA_HOST}" ] && JUJU_OPTS="$JUJU_OPTS -H ${OSM_VCA_HOST}"
[ -n "${LXD_CLOUD_FILE}" ] && JUJU_OPTS="$JUJU_OPTS -l ${LXD_CLOUD_FILE}"
[ -n "${LXD_CRED_FILE}" ] && JUJU_OPTS="$JUJU_OPTS -L ${LXD_CRED_FILE}"
track osmclient osmclient_ok
echo -e "Checking OSM health state..."
- $OSM_DEVOPS/installers/osm_health.sh -s ${OSM_STACK_NAME} -k || \
+ $OSM_DEVOPS/installers/osm_health.sh -s ${OSM_NAMESPACE} -k || \
(echo -e "OSM is not healthy, but will probably converge to a healthy state soon." && \
- echo -e "Check OSM status with: kubectl -n ${OSM_STACK_NAME} get all" && \
+ echo -e "Check OSM status with: kubectl -n ${OSM_NAMESPACE} get all" && \
track healthchecks osm_unhealthy didnotconverge)
track healthchecks after_healthcheck_ok
echo "OSM_DOCKER_WORK_DIR=$OSM_DOCKER_WORK_DIR"
echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR"
echo "OSM_K8S_WORK_DIR=$OSM_K8S_WORK_DIR"
- echo "OSM_STACK_NAME=$OSM_STACK_NAME"
+ echo "OSM_NAMESPACE=$OSM_NAMESPACE"
echo "OSM_VCA_HOST=$OSM_VCA_HOST"
echo "OSM_VCA_PUBKEY=$OSM_VCA_PUBKEY"
echo "OSM_VCA_SECRET=$OSM_VCA_SECRET"
OSM_VCA_PUBKEY=
OSM_VCA_CLOUDNAME="localhost"
OSM_VCA_K8S_CLOUDNAME="k8scloud"
-OSM_STACK_NAME=osm
+OSM_NAMESPACE=osm
NO_HOST_PORTS=""
DOCKER_NOBUILD=""
REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
OSM_K8S_WORK_DIR="${OSM_DOCKER_WORK_DIR}/osm_pods"
OSM_HELM_WORK_DIR="${OSM_WORK_DIR}/helm"
OSM_HOST_VOL="/var/lib/osm"
-OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}"
+OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}"
OSM_DOCKER_TAG=latest
DOCKER_USER=opensourcemano
PULL_IMAGES="y"
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
+ 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}"
[ -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_STACK_NAME}"
+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
[ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
EOF
JUJU_BOOTSTRAP_OPTS="--model-default /tmp/.osm/model-config.yaml"
fi
- juju bootstrap -v --debug $OSM_VCA_K8S_CLOUDNAME $OSM_STACK_NAME \
+ juju bootstrap -v --debug $OSM_VCA_K8S_CLOUDNAME $OSM_NAMESPACE \
--config controller-service-type=loadbalancer \
--agent-version=$JUJU_AGENT_VERSION \
${JUJU_BOOTSTRAP_OPTS} \
- || FATAL "Failed to bootstrap controller $OSM_STACK_NAME in cloud $OSM_VCA_K8S_CLOUDNAME"
+ || FATAL "Failed to bootstrap controller $OSM_NAMESPACE in cloud $OSM_VCA_K8S_CLOUDNAME"
[ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
}
client-key: /tmp/.osm/client.key
EOF
lxc config trust add local: /tmp/.osm/client.crt
- juju add-cloud -c $OSM_STACK_NAME $OSM_VCA_CLOUDNAME $LXD_CLOUD --force
- juju add-credential -c $OSM_STACK_NAME $OSM_VCA_CLOUDNAME -f $LXD_CREDENTIALS
+ juju add-cloud -c $OSM_NAMESPACE $OSM_VCA_CLOUDNAME $LXD_CLOUD --force
+ juju add-credential -c $OSM_NAMESPACE $OSM_VCA_CLOUDNAME -f $LXD_CREDENTIALS
sg lxd -c "lxd waitready"
juju controller-config features=[k8s-operators]
if [ -n "${OSM_BEHIND_PROXY}" ] ; then
JUJU_VERSION=2.9
OSM_BEHIND_PROXY=""
OSM_DEVOPS=
-OSM_STACK_NAME=osm
+OSM_NAMESPACE=osm
OSM_VCA_HOST=
OSM_VCA_CLOUDNAME="localhost"
OSM_VCA_K8S_CLOUDNAME="k8scloud"
DEFAULT_IP="${OPTARG}"
;;
s)
- OSM_STACK_NAME="${OPTARG}" && [[ ! "${OPTARG}" =~ $RE_CHECK ]] && echo "Namespace $OPTARG is invalid. Regex used for validation is $RE_CHECK" && exit 0
+ OSM_NAMESPACE="${OPTARG}" && [[ ! "${OPTARG}" =~ $RE_CHECK ]] && echo "Namespace $OPTARG is invalid. Regex used for validation is $RE_CHECK" && exit 0
;;
H)
OSM_VCA_HOST="${OPTARG}"
juju add-credential -c $CONTROLLER_NAME $OSM_VCA_CLOUDNAME -f ~/.osm/lxd-credentials.yaml || juju update-credential lxd-cloud -c $CONTROLLER_NAME -f ~/.osm/lxd-credentials.yaml
fi
fi
- [ -z "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`sg lxd -c "juju show-controller $OSM_STACK_NAME"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
+ [ -z "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`sg lxd -c "juju show-controller $OSM_NAMESPACE"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
[ -n "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`juju show-controller $CONTROLLER_NAME |grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
[ -z "$OSM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address"
fi
# uninstall OSM MONITORING
uninstall_k8s_monitoring
fi
- remove_k8s_namespace $OSM_STACK_NAME
+ remove_k8s_namespace $OSM_NAMESPACE
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
sg docker -c "docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}"
- OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}"
+ OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}"
remove_volumes $OSM_NAMESPACE_VOL
echo "Removing $OSM_DOCKER_WORK_DIR"
sudo rm -rf $OSM_DOCKER_WORK_DIR
- [ -z "$CONTROLLER_NAME" ] && sg lxd -c "juju kill-controller -t 0 -y $OSM_STACK_NAME"
+ [ -z "$CONTROLLER_NAME" ] && sg lxd -c "juju kill-controller -t 0 -y $OSM_NAMESPACE"
remove_crontab_job
OSM_VCA_PUBKEY=
OSM_VCA_CLOUDNAME="localhost"
OSM_VCA_K8S_CLOUDNAME="k8scloud"
-OSM_STACK_NAME=osm
+OSM_NAMESPACE=osm
NO_HOST_PORTS=""
DOCKER_NOBUILD=""
REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg"
OSM_DOCKER_WORK_DIR="/etc/osm/docker"
OSM_K8S_WORK_DIR="${OSM_DOCKER_WORK_DIR}/osm_pods"
OSM_HOST_VOL="/var/lib/osm"
-OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}"
+OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}"
OSM_DOCKER_TAG=latest
DOCKER_USER=opensourcemano
PULL_IMAGES="y"
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
+ 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}"