From b72ae3e2bb0de77d809cf6e8652abf1500ef9424 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jarom=C3=ADr=20Hradil?= <jaromir.hradil@cesnet.cz>
Date: Fri, 20 Sep 2024 18:02:29 +0200
Subject: [PATCH] Adding ownCloud backend remote mount path + fixing
 resource-extension commentary

---
 cesnet-central/deployments/fullhub.yaml | 18 +++++++++++++-----
 common/deployments/hub-production.yaml  | 18 +++++++++++++-----
 common/deployments/hub-staging.yaml     | 18 +++++++++++++-----
 testing/deployments/hub.yaml            | 12 ++++++++++--
 4 files changed, 49 insertions(+), 17 deletions(-)

diff --git a/cesnet-central/deployments/fullhub.yaml b/cesnet-central/deployments/fullhub.yaml
index f731bca..ffe9eee 100644
--- a/cesnet-central/deployments/fullhub.yaml
+++ b/cesnet-central/deployments/fullhub.yaml
@@ -136,9 +136,9 @@ singleuser:
       #
       #LabApp.custom_css=True allows to use custom CSS for EOSC style
       #
-      #ResourceUseDisplay.mem_warning_threshold=0.75 sets memory warning at 75%
-      #threshold for resource-usage extension which is also used by EGI
-      #notebooks-resource-warning extension 
+      #ResourceUseDisplay.mem_warning_threshold=0.25 sets for resource-usage
+      #extension to warn about used memory when only 25% of memory is available
+      #which is also used by EGI notebooks-resource-warning extension 
       stringData: |-
         #! /bin/sh
         #
@@ -250,9 +250,15 @@ hub:
                   return
 
               if type == "home":
+                  #Jupyter side
                   subpath = ""
+                  #ownCloud backend side
+                  remote_path = "/notebooks_service"
               else:
-                 subpath = "/" + type.capitalize()
+                  #Jupyter side
+                  subpath = "/" + type.capitalize()
+                  #ownCloud backend side
+                  remote_path = "/"
               env = [
                   {"name": "WEBDAV_URL", "value": owncloud_url},
                   {"name": "WEBDAV_VENDOR", "value": "owncloud"},
@@ -262,6 +268,8 @@ hub:
                   {"name": "MOUNT_PATH", "value": "/owncloud" + subpath},
                   # default mode is "full"
                   {"name": "VFS_CACHE_MODE", "value": "full"},
+                  # remote path to mount on ownCloud backend
+                  {"name": "REMOTE_PATH", "value": remote_path}
               ]
               if type != "home":
                   env.append({"name": "MOUNT_WAIT_POINT", "value": "webdav-fs: /owncloud fuse.rclone"})
@@ -272,7 +280,7 @@ hub:
               spawner.extra_containers.append(
                   {
                       "name": "owncloud-" + type,
-                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0a62679",
+                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0f42313",
                       "args": ["bearer_token_command=cat " + self.token_path],
                       "env": env,
                       "resources": self.sidecar_resources,
diff --git a/common/deployments/hub-production.yaml b/common/deployments/hub-production.yaml
index fd78cad..cda893f 100644
--- a/common/deployments/hub-production.yaml
+++ b/common/deployments/hub-production.yaml
@@ -118,9 +118,9 @@ singleuser:
       #
       #LabApp.custom_css=True allows to use custom CSS for EOSC style
       #
-      #ResourceUseDisplay.mem_warning_threshold=0.75 sets memory warning at 75%
-      #threshold for resource-usage extension which is also used by EGI
-      #notebooks-resource-warning extension 
+      #ResourceUseDisplay.mem_warning_threshold=0.25 sets for resource-usage
+      #extension to warn about used memory when only 25% of memory is available
+      #which is also used by EGI notebooks-resource-warning extension 
       stringData: |-
         #! /bin/sh
         #
@@ -233,9 +233,15 @@ hub:
                   return
 
               if type == "home":
+                  #Jupyter side
                   subpath = ""
+                  #ownCloud backend side
+                  remote_path = "/notebooks_service"
               else:
-                 subpath = "/" + type.capitalize()
+                  #Jupyter side
+                  subpath = "/" + type.capitalize()
+                  #ownCloud backend side
+                  remote_path = "/"
               env = [
                   {"name": "WEBDAV_URL", "value": owncloud_url},
                   {"name": "WEBDAV_VENDOR", "value": "owncloud"},
@@ -245,6 +251,8 @@ hub:
                   {"name": "MOUNT_PATH", "value": "/owncloud" + subpath},
                   # default mode is "full"
                   {"name": "VFS_CACHE_MODE", "value": "full"},
+                  # remote path to mount on ownCloud backend
+                  {"name": "REMOTE_PATH", "value": remote_path}
               ]
               if type != "home":
                   env.append({"name": "MOUNT_WAIT_POINT", "value": "webdav-fs: /owncloud fuse.rclone"})
@@ -255,7 +263,7 @@ hub:
               spawner.extra_containers.append(
                   {
                       "name": "owncloud-" + type,
-                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0a62679",
+                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0f42313",
                       "args": ["bearer_token_command=cat " + self.token_path],
                       "env": env,
                       "resources": self.sidecar_resources,
diff --git a/common/deployments/hub-staging.yaml b/common/deployments/hub-staging.yaml
index 502fa30..ad8c2c1 100644
--- a/common/deployments/hub-staging.yaml
+++ b/common/deployments/hub-staging.yaml
@@ -118,9 +118,9 @@ singleuser:
       #
       #LabApp.custom_css=True allows to use custom CSS for EOSC style
       #
-      #ResourceUseDisplay.mem_warning_threshold=0.75 sets memory warning at 75%
-      #threshold for resource-usage extension which is also used by EGI
-      #notebooks-resource-warning extension 
+      #ResourceUseDisplay.mem_warning_threshold=0.25 sets for resource-usage
+      #extension to warn about used memory when only 25% of memory is available
+      #which is also used by EGI notebooks-resource-warning extension 
       stringData: |-
         #! /bin/sh
         #
@@ -231,9 +231,15 @@ hub:
                   return
 
               if type == "home":
+                  #Jupyter side
                   subpath = ""
+                  #ownCloud backend side
+                  remote_path = "/notebooks_service"
               else:
-                 subpath = "/" + type.capitalize()
+                  #Jupyter side
+                  subpath = "/" + type.capitalize()
+                  #ownCloud backend side
+                  remote_path = "/"
               env = [
                   {"name": "WEBDAV_URL", "value": owncloud_url},
                   {"name": "WEBDAV_VENDOR", "value": "owncloud"},
@@ -243,6 +249,8 @@ hub:
                   {"name": "MOUNT_PATH", "value": "/owncloud" + subpath},
                   # default mode is "full"
                   {"name": "VFS_CACHE_MODE", "value": "full"},
+                  # remote path to mount on ownCloud backend
+                  {"name": "REMOTE_PATH", "value": remote_path}
               ]
               if type != "home":
                   env.append({"name": "MOUNT_WAIT_POINT", "value": "webdav-fs: /owncloud fuse.rclone"})
@@ -253,7 +261,7 @@ hub:
               spawner.extra_containers.append(
                   {
                       "name": "owncloud-" + type,
-                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0a62679",
+                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0f42313",
                       "args": ["bearer_token_command=cat " + self.token_path],
                       "env": env,
                       "resources": self.sidecar_resources,
diff --git a/testing/deployments/hub.yaml b/testing/deployments/hub.yaml
index 1276c86..2a10106 100644
--- a/testing/deployments/hub.yaml
+++ b/testing/deployments/hub.yaml
@@ -233,9 +233,15 @@ hub:
                   return
 
               if type == "home":
+                  #Jupyter side
                   subpath = ""
+                  #ownCloud backend side
+                  remote_path = "/notebooks_service"
               else:
-                 subpath = "/" + type.capitalize()
+                  #Jupyter side
+                  subpath = "/" + type.capitalize()
+                  #ownCloud backend side
+                  remote_path = "/"
               env = [
                   {"name": "WEBDAV_URL", "value": owncloud_url},
                   {"name": "WEBDAV_VENDOR", "value": "owncloud"},
@@ -245,6 +251,8 @@ hub:
                   {"name": "MOUNT_PATH", "value": "/owncloud" + subpath},
                   # default mode is "full"
                   {"name": "VFS_CACHE_MODE", "value": "full"},
+                  # remote path to mount on ownCloud backend
+                  {"name": "REMOTE_PATH", "value": remote_path}
               ]
               if type != "home":
                   env.append({"name": "MOUNT_WAIT_POINT", "value": "webdav-fs: /owncloud fuse.rclone"})
@@ -255,7 +263,7 @@ hub:
               spawner.extra_containers.append(
                   {
                       "name": "owncloud-" + type,
-                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0a62679",
+                      "image": "eginotebooks/webdav-rclone-sidecar:sha-0f42313",
                       "args": ["bearer_token_command=cat " + self.token_path],
                       "env": env,
                       "resources": self.sidecar_resources,
-- 
GitLab