Installation Script for Leofs. 92/9692/1
authorsmahana123 <s.mahana@samsung.com>
Thu, 17 Nov 2022 11:42:55 +0000 (17:12 +0530)
committersmahana123 <s.mahana@samsung.com>
Thu, 17 Nov 2022 11:42:55 +0000 (17:12 +0530)
Issue-Id: AIMLFW-4

Signed-off-by: smahana123 <s.mahana@samsung.com>
Change-Id: Iedd3ddb8f414ad0f502bcbc26721a5a2044ee5b4

tools/leofs/bin/install_leofs.sh [new file with mode: 0755]
tools/leofs/bin/leofs_start.sh [new file with mode: 0755]
tools/leofs/bin/uninstall_leofs.sh [new file with mode: 0755]

diff --git a/tools/leofs/bin/install_leofs.sh b/tools/leofs/bin/install_leofs.sh
new file mode 100755 (executable)
index 0000000..ec05598
--- /dev/null
@@ -0,0 +1,33 @@
+# ==================================================================================
+#
+#       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.
+#
+# ==================================================================================
+
+kubectl create namespace kubeflow
+sleep 10
+head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8 | kubectl create secret generic leofs-secret -n kubeflow --from-file=password=/dev/stdin
+
+#TODO: Docker build below to be removed
+docker build -f tools/leofs/Dockerfile.leofs -t leofs .
+
+sudo helm dep up helm/leofs
+helm install leofs helm/leofs -f RECIPE_EXAMPLE/example_recipe_oran_g_release.yaml
+sleep 10
+NAMESPACE=kubeflow
+COMPONENT=leofs
+POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=$COMPONENT -n $NAMESPACE -o jsonpath="{.items[0].metadata.name}")
+while [[ $(kubectl get pods $POD_NAME -n kubeflow -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for leofs pod" && sleep 1; done
+kubectl exec -it $POD_NAME -n kubeflow -- bash -c "source /root/deb/leofs_start.sh"
diff --git a/tools/leofs/bin/leofs_start.sh b/tools/leofs/bin/leofs_start.sh
new file mode 100755 (executable)
index 0000000..591e8a0
--- /dev/null
@@ -0,0 +1,43 @@
+# ==================================================================================
+#
+#       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.
+#
+# ==================================================================================
+
+dpkg-deb -xv leofs_1.4.3-1_ubuntu-18.04_amd64.deb . 
+sed -i 's/RUNNER_USER=/RUNNER_USER=root/g' ./usr/local/leofs/1.4.3/leo_manager_0/etc/leo_manager.environment
+sed -i 's/RUNNER_USER=/RUNNER_USER=root/g' ./usr/local/leofs/1.4.3/leo_manager_1/etc/leo_manager.environment
+sed -i 's/RUNNER_USER=/RUNNER_USER=root/g' ./usr/local/leofs/1.4.3/leo_storage/etc/leo_storage.environment
+sed -i 's/RUNNER_USER=/RUNNER_USER=root/g' ./usr/local/leofs/1.4.3/leo_gateway/etc/leo_gateway.environment
+./usr/local/leofs/1.4.3/leo_manager_0/bin/leo_manager start
+echo "leo_manager_0 started"
+sleep 20
+./usr/local/leofs/1.4.3/leo_manager_1/bin/leo_manager start
+echo "leo_manager_1 started"
+sleep 20
+./usr/local/leofs/1.4.3/leo_storage/bin/leo_storage start
+echo "leo_storage started"
+sleep 20
+./usr/local/leofs/1.4.3/leo_gateway/bin/leo_gateway start
+echo "leo_gateway started"
+sleep 20
+./usr/local/leofs/1.4.3/leofs-adm status
+./usr/local/leofs/1.4.3/leofs-adm start
+echo "leofs-adm started"
+echo $LEOFS_PASSWORD
+./usr/local/leofs/1.4.3/leofs-adm import-user leofs leofs $LEOFS_PASSWORD
+sleep 20
+./usr/local/leofs/1.4.3/leofs-adm add-endpoint leofs.kubeflow
+./usr/local/leofs/1.4.3/leofs-adm add-bucket mlpipeline leofs
diff --git a/tools/leofs/bin/uninstall_leofs.sh b/tools/leofs/bin/uninstall_leofs.sh
new file mode 100755 (executable)
index 0000000..f9e92f7
--- /dev/null
@@ -0,0 +1,21 @@
+# ==================================================================================
+#
+#       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 uninstall leofs helm/leofs
+# kubectl delete secret leofs-secret -n kubeflow
+# kubectl delete namespace kubeflow