This patch introduces a new structure of the it/dep repo.
[it/dep.git] / ric-platform / 50-RIC-Platform / bin / install
similarity index 54%
rename from localize.sh
rename to ric-platform/50-RIC-Platform/bin/install
index 41b783a..87040d7 100755 (executable)
 #   limitations under the License.                                             #
 ################################################################################
 
-source ./runric_env.sh
-if [ -z $__RICENV_SET__ ]; then
-  echo "Edit your ric_env.sh for local infrastyructure values first"
-  exit
+
+OVERRIDEYAML=$1
+
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+
+source $DIR/../etc/ric.conf
+
+if [ -z "$RICPLT_RELEASE_NAME" ];then
+   RELEASE_NAME=$helm_release_name
+else
+   RELEASE_NAME=$RICPLT_RELEASE_NAME
+fi
+if [ -z "$RICPLT_NAMESPACE" ];then
+   NAMESPACE=$namespace
+else
+   NAMESPACE=$RICPLT_NAMESPACE
 fi
 
-echo "Copy files to generated fir"
-DIRS='kubernetes ricplt xapps'
-rm -rf ./generated
-mkdir -p generated
-for d in $DIRS; do
-  cp -rf $d ./generated/
-done
 
-echo "env substitude vars in .yaml and .sh files"
-FILELIST=$(find .  \( -name "*.sh" -o -name "*.yaml" \))
-for f in $FILELIST; do
-  echo "$f to ./generated/$f":
-  envsubst '${__RUNRICENV_GERRIT_HOST__}
-${__RUNRICENV_GERRIT_IP__}
-${__RUNRICENV_DOCKER_HOST__}
-${__RUNRICENV_DOCKER_IP__}
-${__RUNRICENV_DOCKER_PORT__}
-${__RUNRICENV_DOCKER_USER__}
-${__RUNRICENV_DOCKER_PASS__}
-${__RUNRICENV_HELMREPO_HOST__}
-${__RUNRICENV_HELMREPO_PORT__}
-${__RUNRICENV_HELMREPO_IP__}
-${__RUNRICENV_HELMREPO_USER__}
-${__RUNRICENV_HELMREPO_PASS__} '< $f > "./generated/$f";
-done
+RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term"
+
+echo "Deploying RIC Platform components [$RICPLT_COMPONENTS]"
+echo "Platform Namespace: $NAMESPACE"
+echo "Helm Release Name: $RELEASE_NAME"
+
 
+COMMON_CHART_VERSION=$(cat $DIR/../charts/common/Chart.yaml | grep version | awk '{print $2}')
 
+helm package -d /tmp $DIR/../charts/common
+
+
+for component in $RICPLT_COMPONENTS; do
+  echo "Preparing chart for comonent $component"
+  cp /tmp/common-$COMMON_CHART_VERSION.tgz $DIR/../charts/$component/charts/
+  if [ -z $OVERRIDEYAML ]; then
+  helm install --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-$component" $DIR/../charts/$component
+  else
+  helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-$component" $DIR/../charts/$component
+  fi
+done