Installation scripts for aiml 84/9684/1
authorashishj1729 <jain.ashish@samsung.com>
Thu, 17 Nov 2022 09:39:25 +0000 (15:09 +0530)
committerashishj1729 <jain.ashish@samsung.com>
Thu, 17 Nov 2022 09:41:06 +0000 (15:11 +0530)
Issue-Id: AIMLFW-4

Signed-off-by: ashishj1729 <jain.ashish@samsung.com>
Change-Id: Ibcc71e5db220f9645b9a391ae55ed68af876ba6a

bin/install.sh [new file with mode: 0755]
bin/install_common_templates_to_helm.sh [new file with mode: 0755]
bin/install_databases.sh [new file with mode: 0755]
bin/install_rolebindings.sh [new file with mode: 0755]
bin/install_traininghost.sh [new file with mode: 0755]

diff --git a/bin/install.sh b/bin/install.sh
new file mode 100755 (executable)
index 0000000..c305466
--- /dev/null
@@ -0,0 +1,82 @@
+# ==================================================================================
+#
+#       Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+
+#!/bin/bash
+
+IS_HELM3=$(helm version --short|grep -e "^v3")
+
+while [ -n "$1" ]; do # while loop starts
+
+    case "$1" in
+
+    -f) OVERRIDEYAML=$2
+        shift
+        ;;
+    -c) LIST_OF_COMPONENTS=$2
+        shift
+        ;;
+    -o) KERNEL_OPTIMIZATION=true
+        ;;
+    *) echo "Option $1 not recognized" ;; # In case you typed a different option other than a,b,c
+
+    esac
+
+    shift
+
+done
+
+if [ -z "$OVERRIDEYAML" ];then
+    echo "****************************************************************************************************************"
+    echo "                                                     ERROR                                                      "
+    echo "****************************************************************************************************************"
+    echo "AIMLFW deployment without deployment recipe is currently disabled. Please specify an recipe with the -f option."
+    echo "****************************************************************************************************************"
+    exit 1
+fi
+
+if [ -z $IS_HELM3 ]
+then
+    echo "****************************************************************************************************************"
+    echo "                                                     ERROR                                                      "
+    echo "****************************************************************************************************************"
+    echo "AIMLFW deployment expects helm 3 installed"
+    echo "****************************************************************************************************************"
+    exit 1
+else
+    HAS_COMMON_PACKAGE=$(helm search repo local/aimlfw-common | grep aimlfw-common)
+fi
+
+
+if [ -z "$HAS_COMMON_PACKAGE" ];then
+    echo "****************************************************************************************************************"
+    echo "                                                     ERROR                                                      "
+    echo "****************************************************************************************************************"
+    echo "Can't locate the aimlfw-common helm package in the local repo. Please make sure that it is properly installed."
+    echo "****************************************************************************************************************"
+    exit 1
+fi
+
+COMPONENTS="tm data-extraction kfadapter aiml-dashboard aiml-notebook"
+
+
+
+for component in $COMPONENTS; do
+    sudo helm dep up helm/$component
+    echo "Installing $component"
+    helm install $component helm/$component -f $OVERRIDEYAML
+done
diff --git a/bin/install_common_templates_to_helm.sh b/bin/install_common_templates_to_helm.sh
new file mode 100755 (executable)
index 0000000..c18dbc6
--- /dev/null
@@ -0,0 +1,53 @@
+# ==================================================================================
+#
+#       Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+
+#!/bin/bash
+
+echo "Installing servecm (Chart Manager) and common templates to helm3"
+
+helm plugin install https://github.com/jdolitsky/helm-servecm
+eval $(helm env |grep HELM_REPOSITORY_CACHE) 
+echo ${HELM_REPOSITORY_CACHE}
+
+helm servecm --port=8879 --context-path=/charts --storage local --storage-local-rootdir $HELM_REPOSITORY_CACHE/local/ <<EOF &
+yes
+EOF
+
+CURL_CMD="curl --silent --output /dev/null  http://127.0.0.1:8879/charts"
+`${CURL_CMD}`
+READY=$?
+while [ ${READY} != 0 ]; do
+        echo "servecm not yet running. sleeping for 2 seconds"
+        sleep 2
+        `${CURL_CMD}`
+        READY=$?
+done
+echo "servcm up and running"
+
+eval $(helm env |grep HELM_REPOSITORY_CACHE)
+echo ${HELM_REPOSITORY_CACHE}
+mkdir -p "${HELM_REPOSITORY_CACHE}/local/"
+
+export COMMON_CHART_VERSION=$(cat aimlfw-common/Common-Template/helm/aimlfw-common/Chart.yaml | grep version | awk '{print $2}')
+helm package -d /tmp aimlfw-common/Common-Template/helm/aimlfw-common
+cp /tmp/aimlfw-common-${COMMON_CHART_VERSION}.tgz "${HELM_REPOSITORY_CACHE}/local/"
+helm repo remove local
+helm repo add local http://127.0.0.1:8879/charts
+
+echo "checking that aimlfw-common templates were added"
+helm search repo local/aimlfw-common
diff --git a/bin/install_databases.sh b/bin/install_databases.sh
new file mode 100755 (executable)
index 0000000..3488d5f
--- /dev/null
@@ -0,0 +1,25 @@
+# ==================================================================================
+#
+#       Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+
+helm repo add bitnami https://charts.bitnami.com/bitnami
+helm install tm-db bitnami/postgresql --namespace traininghost
+while [[ $(kubectl get pods tm-db-postgresql-0 -n traininghost -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for training manager db pod" && sleep 1; done
+echo "Installed tm-db"
+helm install cassandra --set dbUser.user="cassandra" --namespace="traininghost"  bitnami/cassandra
+while [[ $(kubectl get pods cassandra-0 -n traininghost -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for cassandra manager db pod" && sleep 1; done
+echo "Installed cassandra-db"
diff --git a/bin/install_rolebindings.sh b/bin/install_rolebindings.sh
new file mode 100755 (executable)
index 0000000..eb834de
--- /dev/null
@@ -0,0 +1,23 @@
+# ==================================================================================
+#
+#       Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#          http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+# ==================================================================================
+
+# For reading secrets in Kubeflow-Pipeline and SDK
+
+kubectl create clusterrole secret_reader --verb get,list --resource secret
+kubectl create  rolebinding secret_pipline_runner_rb -n traininghost --serviceaccount kubeflow:pipeline-runner --clusterrole  secret_reader
+kubectl create rolebinding traininghost_default_secret_rb -n kubeflow --serviceaccount traininghost:default --clusterrole secret_reader
diff --git a/bin/install_traininghost.sh b/bin/install_traininghost.sh
new file mode 100755 (executable)
index 0000000..b33419c
--- /dev/null
@@ -0,0 +1,24 @@
+#Checking whether the user is added in the docker group or not.
+if [[ $(groups | grep docker) ]]; then
+        echo "You are already added to the docker group!"
+else
+    sudo groupadd docker       
+    sudo usermod -aG docker $USER
+    echo "Adding you to the docker group re-login is required."
+    echo "Exiting now try to login again."
+    exit
+fi
+
+tools/kubernetes/install_k8s.sh
+tools/nfs/configure_nfs_server.sh localhost
+tools/helm/install_helm.sh
+tools/nfs/install_nfs_subdir_external_provisioner.sh localhost
+
+sudo bin/install_common_templates_to_helm.sh
+tools/leofs/bin/install_leofs.sh
+tools/kubeflow/bin/install_kubeflow.sh
+kubectl create namespace traininghost
+
+bin/install_rolebindings.sh
+bin/install_databases.sh
+bin/install.sh -f RECIPE_EXAMPLE/example_recipe_oran_g_release.yaml