From 8e47d1bae54e02dcb036f034a4085201943bb7c0 Mon Sep 17 00:00:00 2001 From: smahana123 Date: Thu, 17 Nov 2022 17:12:55 +0530 Subject: [PATCH] Installation Script for Leofs. Issue-Id: AIMLFW-4 Signed-off-by: smahana123 Change-Id: Iedd3ddb8f414ad0f502bcbc26721a5a2044ee5b4 --- tools/leofs/bin/install_leofs.sh | 33 +++++++++++++++++++++++++++++ tools/leofs/bin/leofs_start.sh | 43 ++++++++++++++++++++++++++++++++++++++ tools/leofs/bin/uninstall_leofs.sh | 21 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100755 tools/leofs/bin/install_leofs.sh create mode 100755 tools/leofs/bin/leofs_start.sh create mode 100755 tools/leofs/bin/uninstall_leofs.sh diff --git a/tools/leofs/bin/install_leofs.sh b/tools/leofs/bin/install_leofs.sh new file mode 100755 index 0000000..ec05598 --- /dev/null +++ b/tools/leofs/bin/install_leofs.sh @@ -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 index 0000000..591e8a0 --- /dev/null +++ b/tools/leofs/bin/leofs_start.sh @@ -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 index 0000000..f9e92f7 --- /dev/null +++ b/tools/leofs/bin/uninstall_leofs.sh @@ -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 -- 2.16.6