From 1602fdc0cc85b8e2a9b6787bcfc750f140eb885c Mon Sep 17 00:00:00 2001 From: Ho Kim Date: Fri, 2 Jun 2023 01:12:05 +0900 Subject: [PATCH] Add shared PVC support for vine desktop --- vine/session/Cargo.toml | 1 + vine/session/src/lib.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/vine/session/Cargo.toml b/vine/session/Cargo.toml index 72bde707..2f1f49dc 100644 --- a/vine/session/Cargo.toml +++ b/vine/session/Cargo.toml @@ -19,6 +19,7 @@ ark-core = { path = "../../ark/core" } dash-provider = { path = "../../dash/provider" } dash-provider-api = { path = "../../dash/provider/api" } vine-api = { path = "../api" } +vine-storage = { path = "../storage" } anyhow = { workspace = true } chrono = { workspace = true } diff --git a/vine/session/src/lib.rs b/vine/session/src/lib.rs index c7315313..52a21c90 100644 --- a/vine/session/src/lib.rs +++ b/vine/session/src/lib.rs @@ -113,6 +113,7 @@ impl SessionManager { .and_then(|()| self.label_namespace(&ctx, Some(ctx.spec.user_name))) .and_then(|()| self.label_user(ctx.spec.node, ctx.spec.user_name, true)) .and_then(|()| self.delete_cleanup(&ctx)) + .and_then(|()| self.create_shared_pvc(&ctx)) .and_then(|()| self.create_template(&ctx)) .await } @@ -141,6 +142,12 @@ impl SessionManager { .map(|_| ()) } + async fn create_shared_pvc(&self, ctx: &SessionContext<'_>) -> Result<()> { + ::vine_storage::get_or_create_shared_pvcs(&self.client.kube, &ctx.metadata.namespace) + .await + .map(|_| ()) + } + async fn create_template(&self, ctx: &SessionContext<'_>) -> Result<()> { self.client .create_raw_named(Self::TEMPLATE_SESSION_FILENAME, ctx)