|
47 | 47 | from renku_data_services.notebooks.api.schemas.cloud_storage import RCloneStorage |
48 | 48 | from renku_data_services.notebooks.config import GitProviderHelperProto, NotebooksConfig |
49 | 49 | from renku_data_services.notebooks.crs import ( |
| 50 | + AmaltheaMetadata, |
50 | 51 | AmaltheaSessionSpec, |
51 | 52 | AmaltheaSessionV1Alpha1, |
52 | 53 | AmaltheaSessionV1Alpha1MetadataPatch, |
|
82 | 83 | SizeStr, |
83 | 84 | State, |
84 | 85 | Storage, |
| 86 | + Template, |
85 | 87 | TlsSecret, |
86 | 88 | ) |
87 | 89 | from renku_data_services.notebooks.image_check import ImageCheckRepository |
@@ -865,7 +867,8 @@ async def start_session( |
865 | 867 | annotations: dict[str, str] = { |
866 | 868 | "renku.io/project_id": str(launcher.project_id), |
867 | 869 | "renku.io/launcher_id": str(launcher_id), |
868 | | - "renku.io/resource_class_id": str(resource_class_id), |
| 870 | + "renku.io/resource_class_id": str(resource_class.id), |
| 871 | + "renku.io/resource_pool_id": str(resource_pool.id), |
869 | 872 | } |
870 | 873 |
|
871 | 874 | # Authentication |
@@ -943,6 +946,8 @@ async def start_session( |
943 | 946 | launcher_env_variables = get_launcher_env_variables(launcher, launch_request) |
944 | 947 | env.extend(launcher_env_variables) |
945 | 948 |
|
| 949 | + labels = {"renku.io/safe-username": user.id} |
| 950 | + |
946 | 951 | session = AmaltheaSessionV1Alpha1( |
947 | 952 | metadata=Metadata(name=server_name, annotations=annotations), |
948 | 953 | spec=AmaltheaSessionSpec( |
@@ -991,6 +996,7 @@ async def start_session( |
991 | 996 | tolerations=tolerations_from_resource_class(resource_class, nb_config.sessions.tolerations_model), |
992 | 997 | affinity=node_affinity_from_resource_class(resource_class, nb_config.sessions.affinity_model), |
993 | 998 | serviceAccountName=service_account_name, |
| 999 | + template=Template(metadata=AmaltheaMetadata(annotations=annotations, labels=labels)), |
994 | 1000 | ), |
995 | 1001 | ) |
996 | 1002 | secrets_to_create = session_extras.secrets or [] |
|
0 commit comments