+ if [ -n "${INSTALL_JUJU}" ]; then
+ OSM_HELM_OPTS="-f ${OSM_HELM_WORK_DIR}/osm-values.yaml ${OSM_HELM_OPTS}"
+ fi
+ echo "helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm ${OSM_HELM_OPTS}"
+ helm upgrade --install -n $OSM_NAMESPACE --create-namespace $OSM_NAMESPACE $OSM_DEVOPS/installers/helm/osm ${OSM_HELM_OPTS}
+ # Override existing values.yaml with the final values.yaml used to install OSM
+ helm -n $OSM_NAMESPACE get values $OSM_NAMESPACE | sudo tee -a ${OSM_HELM_WORK_DIR}/osm-values.yaml
+ [ -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_NAMESPACE $OSM_VCA_K8S_CLOUDNAME
+ juju deploy ch:mongodb-k8s -m $OSM_NAMESPACE --channel latest/stable
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
+#deploy mongodb
+function deploy_mongodb() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ MONGO_OPTS="-d ${OSM_HELM_WORK_DIR} -D ${OSM_DEVOPS} -s ${OSM_NAMESPACE} -t ${OSM_DOCKER_TAG} -U ${DOCKER_USER} ${DEBUG_INSTALL}"
+ [ -n "${DOCKER_REGISTRY_URL}" ] && MONGO_OPTS="${MONGO_OPTS} -r ${DOCKER_REGISTRY_URL}"
+ $OSM_DEVOPS/installers/install_mongodb.sh ${MONGO_OPTS} || \
+ FATAL_TRACK install_osm_mongodb_service "install_mongodb.sh failed"
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
+function install_osm_ngsa_service() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ NGSA_OPTS="-i ${OSM_DEFAULT_IP} -d ${OSM_HELM_WORK_DIR} -D ${OSM_DEVOPS} -s ${OSM_NAMESPACE} -t ${OSM_DOCKER_TAG} -U ${DOCKER_USER} ${DEBUG_INSTALL}"
+ [ -n "${DOCKER_REGISTRY_URL}" ] && NGSA_OPTS="${NGSA_OPTS} -r ${DOCKER_REGISTRY_URL}"
+ $OSM_DEVOPS/installers/install_ngsa.sh ${NGSA_OPTS} || \
+ FATAL_TRACK install_osm_ngsa_service "install_ngsa.sh failed"
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
+function add_local_k8scluster() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ # OSM_HOSTNAME=$(kubectl get --namespace osm -o jsonpath="{.spec.rules[0].host}" ingress nbi-ingress)
+ OSM_HOSTNAME="nbi.${OSM_DEFAULT_IP}.nip.io:443"
+ /usr/bin/osm --hostname ${OSM_HOSTNAME} --all-projects vim-create \
+ --name _system-osm-vim \
+ --account_type dummy \
+ --auth_url http://dummy \
+ --user osm --password osm --tenant osm \
+ --description "dummy" \
+ --config '{management_network_name: mgmt}'
+ /usr/bin/osm --hostname ${OSM_HOSTNAME} --all-projects k8scluster-add \
+ --creds ${HOME}/.kube/config \
+ --vim _system-osm-vim \
+ --k8s-nets '{"net1": null}' \
+ --version '1.29' \
+ --description "OSM Internal Cluster" \
+ _system-osm-k8s
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
+function configure_apt_proxy() {
+ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+ OSM_APT_PROXY=$1
+ OSM_APT_PROXY_FILE="/etc/apt/apt.conf.d/osm-apt"
+ echo "Configuring apt proxy in file ${OSM_APT_PROXY_FILE}"
+ if [ ! -f ${OSM_APT_PROXY_FILE} ]; then
+ sudo bash -c "cat <<EOF > ${OSM_APT_PROXY}
+Acquire::http { Proxy \"${OSM_APT_PROXY}\"; }
+EOF"
+ else
+ sudo sed -i "s|Proxy.*|Proxy \"${OSM_APT_PROXY}\"; }|" ${OSM_APT_PROXY_FILE}