diff --git a/helm/leofs/templates/deployment.yaml b/helm/leofs/templates/deployment.yaml index 6f1b901..12aa4d8 100644 --- a/helm/leofs/templates/deployment.yaml +++ b/helm/leofs/templates/deployment.yaml @@ -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 index 0000000..7e39eae --- /dev/null +++ b/helm/leofs/templates/leofs_pvc.yaml @@ -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 diff --git a/tools/leofs/bin/install_leofs.sh b/tools/leofs/bin/install_leofs.sh index 5b5703e..1815efd 100755 --- a/tools/leofs/bin/install_leofs.sh +++ b/tools/leofs/bin/install_leofs.sh @@ -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" diff --git a/tools/leofs/bin/leofs_start.sh b/tools/leofs/bin/leofs_start.sh index 591e8a0..dd80bd0 100755 --- a/tools/leofs/bin/leofs_start.sh +++ b/tools/leofs/bin/leofs_start.sh @@ -16,11 +16,29 @@ # # ================================================================================== -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