Changes to handle aimlfw hosted vm restart 36/12036/2
authorjosephthaliath <jo.thaliath@samsung.com>
Fri, 10 Nov 2023 09:12:52 +0000 (14:42 +0530)
committerjosephthaliath <jo.thaliath@samsung.com>
Mon, 13 Nov 2023 05:00:05 +0000 (10:30 +0530)
Issue-Id: AIMLFW-63

Change-Id: I03d4890a855de1ed86e1fbadf80194180437ef9e
Signed-off-by: josephthaliath <jo.thaliath@samsung.com>
helm/leofs/templates/deployment.yaml
helm/leofs/templates/leofs_pvc.yaml [new file with mode: 0644]
tools/leofs/bin/install_leofs.sh
tools/leofs/bin/leofs_start.sh

index 6f1b901..12aa4d8 100644 (file)
@@ -42,6 +42,10 @@ spec:
       
       securityContext:
         {{- toYaml .Values.podSecurityContext | nindent 8 }}
+      volumes:
+      - name: leofs-pv-storage
+        persistentVolumeClaim:
+          claimName: leofs-pvc 
       containers:
         - name: {{ .Chart.Name }}
           image: "{{ .Values.leofs.image.repository }}:{{ .Values.leofs.image.tag | default .Chart.AppVersion }}"
@@ -58,3 +62,10 @@ spec:
               protocol: TCP
           workingDir: /root/deb
           command: ["/sbin/init"]
+          volumeMounts:
+            - mountPath: "/root/leofs"
+              name: leofs-pv-storage
+          lifecycle:
+            postStart:
+              exec:
+                command: ["bash", "-c", "source /root/deb/leofs_start.sh > /root/leofs/postStart.logs"]
\ No newline at end of file
diff --git a/helm/leofs/templates/leofs_pvc.yaml b/helm/leofs/templates/leofs_pvc.yaml
new file mode 100644 (file)
index 0000000..7e39eae
--- /dev/null
@@ -0,0 +1,12 @@
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: leofs-pvc
+  namespace: {{ include "common.namespace.kubeflow" . }}
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 5Gi
+  storageClassName: nfs-client
index 5b5703e..1815efd 100755 (executable)
@@ -29,4 +29,3 @@ 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"
index 591e8a0..dd80bd0 100755 (executable)
 #
 # ==================================================================================
 
-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
+while ! test -d  /proc/1 ; do
+        echo "PID 1 not started"
+        sleep 1
+done
+
+cd ../leofs
+
+
+if test -f leofs_started; then
+  echo "Leofs already installed"
+else
+    echo "Leofs not started"
+    cp ../deb/leofs_1.4.3-1_ubuntu-18.04_amd64.deb .
+    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
+
+    touch leofs_started
+fi
+
+
 ./usr/local/leofs/1.4.3/leo_manager_0/bin/leo_manager start
 echo "leo_manager_0 started"
 sleep 20