diff --git a/components/renku_data_services/notebooks/api/amalthea_patches/init_containers.py b/components/renku_data_services/notebooks/api/amalthea_patches/init_containers.py index 632a44f30..c61e3491f 100644 --- a/components/renku_data_services/notebooks/api/amalthea_patches/init_containers.py +++ b/components/renku_data_services/notebooks/api/amalthea_patches/init_containers.py @@ -417,7 +417,7 @@ def user_secrets_container( decrypted_volume_mount = ExtraVolumeMount( name="user-secrets-volume", - mountPath=secrets_mount_directory or project_constants.DEFAULT_SESSION_MOUNT_DIR.as_posix(), + mountPath=secrets_mount_directory or project_constants.DEFAULT_SESSION_SECRETS_MOUNT_DIR.as_posix(), readOnly=True, ) diff --git a/components/renku_data_services/project/api.spec.yaml b/components/renku_data_services/project/api.spec.yaml index 6cfd02717..d66e39c6c 100644 --- a/components/renku_data_services/project/api.spec.yaml +++ b/components/renku_data_services/project/api.spec.yaml @@ -780,7 +780,9 @@ components: description: Shows if a project is a template or not type: boolean SecretsMountDirectory: - description: The location where the secrets will be provided inside sessions, if left unset it will default to `/secrets`. + description: | + The location where the secrets will be provided inside sessions, if left unset it will default to `/secrets`. + Relative locations are supported and will be mounted relative to the session environment's mount directory. type: string minLength: 1 default: "/secrets" diff --git a/components/renku_data_services/project/apispec.py b/components/renku_data_services/project/apispec.py index 2f9c6eeb3..3e7a8abe9 100644 --- a/components/renku_data_services/project/apispec.py +++ b/components/renku_data_services/project/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2024-11-27T15:24:03+00:00 +# timestamp: 2024-12-09T08:12:44+00:00 from __future__ import annotations @@ -421,7 +421,7 @@ class Project(BaseAPISpec): ) secrets_mount_directory: str = Field( ..., - description="The location where the secrets will be provided inside sessions, if left unset it will default to `/secrets`.", + description="The location where the secrets will be provided inside sessions, if left unset it will default to `/secrets`.\nRelative locations are supported and will be mounted relative to the session environment's mount directory.\n", example="/secrets", min_length=1, ) @@ -482,7 +482,7 @@ class ProjectPost(BaseAPISpec): ) secrets_mount_directory: Optional[str] = Field( None, - description="The location where the secrets will be provided inside sessions, if left unset it will default to `/secrets`.", + description="The location where the secrets will be provided inside sessions, if left unset it will default to `/secrets`.\nRelative locations are supported and will be mounted relative to the session environment's mount directory.\n", example="/secrets", min_length=1, ) diff --git a/components/renku_data_services/project/constants.py b/components/renku_data_services/project/constants.py index e414dde47..b8601d91c 100644 --- a/components/renku_data_services/project/constants.py +++ b/components/renku_data_services/project/constants.py @@ -1,9 +1,10 @@ """Constant values used for projects.""" from pathlib import PurePosixPath +from typing import Final -DEFAULT_SESSION_MOUNT_DIR_STR = "/secrets" +DEFAULT_SESSION_SECRETS_MOUNT_DIR_STR: Final[str] = "/secrets" """The default location where the secrets will be provided inside sessions, as a string.""" -DEFAULT_SESSION_MOUNT_DIR = PurePosixPath(DEFAULT_SESSION_MOUNT_DIR_STR) +DEFAULT_SESSION_SECRETS_MOUNT_DIR: Final[PurePosixPath] = PurePosixPath(DEFAULT_SESSION_SECRETS_MOUNT_DIR_STR) """The default location where the secrets will be provided inside sessions.""" diff --git a/components/renku_data_services/project/orm.py b/components/renku_data_services/project/orm.py index 3617c7d61..959cf2fd1 100644 --- a/components/renku_data_services/project/orm.py +++ b/components/renku_data_services/project/orm.py @@ -88,7 +88,7 @@ def dump(self, with_documentation: bool = False) -> models.Project: documentation=self.documentation if with_documentation else None, template_id=self.template_id, is_template=self.is_template, - secrets_mount_directory=self.secrets_mount_directory or constants.DEFAULT_SESSION_MOUNT_DIR, + secrets_mount_directory=self.secrets_mount_directory or constants.DEFAULT_SESSION_SECRETS_MOUNT_DIR, ) diff --git a/test/components/renku_data_services/authz/test_authorization.py b/test/components/renku_data_services/authz/test_authorization.py index c52d6bb26..cfcfcede4 100644 --- a/test/components/renku_data_services/authz/test_authorization.py +++ b/test/components/renku_data_services/authz/test_authorization.py @@ -62,7 +62,7 @@ async def test_adding_deleting_project(app_config_instance: Config, bootstrap_ad ), visibility=Visibility.PUBLIC if public_project else Visibility.PRIVATE, created_by=project_owner.id, - secrets_mount_directory=project_constants.DEFAULT_SESSION_MOUNT_DIR, + secrets_mount_directory=project_constants.DEFAULT_SESSION_SECRETS_MOUNT_DIR, ) authz_changes = authz._add_project(project) await authz.client.WriteRelationships(authz_changes.apply)