Skip to content

Commit

Permalink
fix: mount cloud storage in the storage mount dir (#559)
Browse files Browse the repository at this point in the history
If the cloud storage target dir is not absolute then we mount relative
to the storage directory.
  • Loading branch information
olevski committed Dec 2, 2024
1 parent 3ee24fe commit 62a2ca4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ jobs:
url: https://renku-ci-ds-${{ github.event.number }}.dev.renku.ch
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.RENKU_DOCKER_USERNAME }}
password: ${{ secrets.RENKU_DOCKER_PASSWORD }}
- name: Find deplyoment url
uses: peter-evans/find-comment@v3
id: deploymentUrlMessage
Expand Down
13 changes: 6 additions & 7 deletions components/renku_data_services/notebooks/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,15 @@ async def _handler(
# TODO: Add types for saved and unsaved resource class
resource_class_id = cast(int, resource_class.id)
else:
resource_class = await self.rp_repo.get_resource_class(user, resource_class_id)
resource_class = await self.rp_repo.get_resource_class(user, body.resource_class_id)
# TODO: Add types for saved and unsaved resource class
resource_class_id = cast(int, resource_class.id)
resource_class_id = body.resource_class_id
quota = resource_class.quota
await self.nb_config.crc_validator.validate_class_storage(user, resource_class_id, body.disk_storage)
work_dir_fallback = PurePosixPath("/home/jovyan")
work_dir = environment.working_directory or image_workdir or work_dir_fallback
storage_mount_fallback = work_dir / "work"
storage_mount = launcher.environment.mount_directory or storage_mount_fallback
# TODO: Wait for pitch on users secrets to implement this
# user_secrets: K8sUserSecrets | None = None
# if body.user_secrets:
Expand Down Expand Up @@ -344,7 +345,7 @@ async def _handler(
quiet=True,
)
if csr.target_path is not None and not PurePosixPath(csr.target_path).is_absolute():
csr.target_path = (work_dir / csr.target_path).as_posix()
csr.target_path = (storage_mount / csr.target_path).as_posix()
dcs[csr_id] = dcs[csr_id].with_override(csr)
git_providers = await self.nb_config.git_provider_helper.get_providers(user=user)
repositories: list[Repository] = []
Expand Down Expand Up @@ -405,7 +406,7 @@ async def _handler(
config=self.nb_config,
repositories=repositories,
git_providers=git_providers,
workspace_mount_path=launcher.environment.mount_directory or storage_mount_fallback,
workspace_mount_path=storage_mount,
work_dir=work_dir,
)
if git_clone is not None:
Expand Down Expand Up @@ -464,9 +465,7 @@ async def _handler(
storage=Storage(
className=self.nb_config.sessions.storage.pvs_storage_class,
size=str(body.disk_storage) + "G",
mountPath=environment.mount_directory.as_posix()
if environment.mount_directory
else storage_mount_fallback.as_posix(),
mountPath=storage_mount.as_posix(),
),
workingDir=work_dir.as_posix(),
runAsUser=environment.uid,
Expand Down

0 comments on commit 62a2ca4

Please sign in to comment.