|
|
@@ -101,7 +101,6 @@ public class JupyterServiceImpl implements JupyterService { |
|
|
|
|
|
|
|
|
// 调用修改后的 createPod 方法,传入额外的参数 |
|
|
// 调用修改后的 createPod 方法,传入额外的参数 |
|
|
Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, image, minioPvcName, datasetPath, modelPath); |
|
|
Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, image, minioPvcName, datasetPath, modelPath); |
|
|
|
|
|
|
|
|
String url = masterIp + ":" + podPort; |
|
|
String url = masterIp + ":" + podPort; |
|
|
redisService.setCacheObject(podName,masterIp + ":" + podPort); |
|
|
redisService.setCacheObject(podName,masterIp + ":" + podPort); |
|
|
devEnvironment.setStatus("Pending"); |
|
|
devEnvironment.setStatus("Pending"); |
|
|
@@ -119,8 +118,9 @@ public class JupyterServiceImpl implements JupyterService { |
|
|
throw new Exception("开发环境配置不存在"); |
|
|
throw new Exception("开发环境配置不存在"); |
|
|
} |
|
|
} |
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
//手动构造pod名称 |
|
|
|
|
|
|
|
|
//构造pod和svc名称 |
|
|
String podName = loginUser.getUsername().toLowerCase() +"-editor-pod" + "-" + id; |
|
|
String podName = loginUser.getUsername().toLowerCase() +"-editor-pod" + "-" + id; |
|
|
|
|
|
String svcName = loginUser.getUsername().toLowerCase() + "-editor-pod" + "-" + id + "-svc"; |
|
|
//得到pod |
|
|
//得到pod |
|
|
V1Pod pod = k8sClientUtil.getNSPodList(namespace, podName); |
|
|
V1Pod pod = k8sClientUtil.getNSPodList(namespace, podName); |
|
|
if(pod == null){ |
|
|
if(pod == null){ |
|
|
@@ -128,10 +128,13 @@ public class JupyterServiceImpl implements JupyterService { |
|
|
} |
|
|
} |
|
|
// 使用 Kubernetes API 删除 Pod |
|
|
// 使用 Kubernetes API 删除 Pod |
|
|
String deleteResult = k8sClientUtil.deletePod(podName, namespace); |
|
|
String deleteResult = k8sClientUtil.deletePod(podName, namespace); |
|
|
|
|
|
// 删除service |
|
|
|
|
|
k8sClientUtil.deleteService(svcName, namespace); |
|
|
|
|
|
|
|
|
devEnvironment.setStatus("Terminated"); |
|
|
devEnvironment.setStatus("Terminated"); |
|
|
this.devEnvironmentService.update(devEnvironment); |
|
|
this.devEnvironmentService.update(devEnvironment); |
|
|
return deleteResult + ",编辑器已停止"; |
|
|
return deleteResult + ",编辑器已停止"; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|