|
|
@@ -12,6 +12,7 @@ import com.ruoyi.platform.utils.MinioUtil; |
|
|
import com.ruoyi.platform.utils.MlflowUtil; |
|
|
import com.ruoyi.platform.utils.MlflowUtil; |
|
|
import com.ruoyi.system.api.model.LoginUser; |
|
|
import com.ruoyi.system.api.model.LoginUser; |
|
|
import io.kubernetes.client.openapi.models.V1PersistentVolumeClaim; |
|
|
import io.kubernetes.client.openapi.models.V1PersistentVolumeClaim; |
|
|
|
|
|
import io.kubernetes.client.openapi.models.V1Pod; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@@ -103,15 +104,14 @@ public class JupyterServiceImpl implements JupyterService { |
|
|
|
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
String podName = loginUser.getUsername().toLowerCase() + "-editor-pod"; |
|
|
String podName = loginUser.getUsername().toLowerCase() + "-editor-pod"; |
|
|
|
|
|
|
|
|
|
|
|
//得到pod |
|
|
|
|
|
V1Pod pod = k8sClientUtil.getNSPodList(namespace, podName); |
|
|
|
|
|
if(pod == null){ |
|
|
|
|
|
return "pod不存在!"; |
|
|
|
|
|
} |
|
|
// 使用 Kubernetes API 删除 Pod |
|
|
// 使用 Kubernetes API 删除 Pod |
|
|
String deleteResult = k8sClientUtil.deletePod(podName, namespace); |
|
|
String deleteResult = k8sClientUtil.deletePod(podName, namespace); |
|
|
|
|
|
|
|
|
// 检查 Pod 是否存在 |
|
|
|
|
|
boolean exists = k8sClientUtil.checkPodExists(podName, namespace); |
|
|
|
|
|
if (exists) { |
|
|
|
|
|
throw new Exception("Pod " + podName + " 删除失败"); |
|
|
|
|
|
} |
|
|
|
|
|
return deleteResult + ",编辑器已停止"; |
|
|
return deleteResult + ",编辑器已停止"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|