From cfc04268f0c4d55de7fc60fd4bf608b0f4f81649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A5=BF=E5=A4=A7=E9=94=90?= <1070211640@qq.com> Date: Thu, 20 Jun 2024 11:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9k8s=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=8C=82=E8=BD=BDminio=20P?= =?UTF-8?q?VC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/JupyterServiceImpl.java | 4 +++- .../main/java/com/ruoyi/platform/utils/K8sClientUtil.java | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java index 447cd6c6..d3143098 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java @@ -43,6 +43,8 @@ public class JupyterServiceImpl implements JupyterService { private String masterIp; @Value("${k8s.storageClassName}") private String storageClassName; + @Value("${minio.pvcName}") + private String minioPvcName; private final MinioUtil minioUtil; @@ -98,7 +100,7 @@ public class JupyterServiceImpl implements JupyterService { //TODO 设置镜像可配置,这里先用默认镜像启动pod // 调用修改后的 createPod 方法,传入额外的参数 - Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, image, datasetPath, modelPath); + Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, image, minioPvcName, datasetPath, modelPath); return masterIp + ":" + podPort; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java index febb449e..eaf2460d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java @@ -376,7 +376,7 @@ public class K8sClientUtil { } - public Integer createConfiguredPod(String podName, String namespace, Integer port, String mountPath, V1PersistentVolumeClaim pvc, String image, String datasetPath, String modelPath) { + public Integer createConfiguredPod(String podName, String namespace, Integer port, String mountPath, V1PersistentVolumeClaim pvc, String image, String dataPvcName, String datasetPath, String modelPath) { Map selector = new LinkedHashMap<>(); selector.put("k8s-jupyter", podName); @@ -407,8 +407,8 @@ public class K8sClientUtil { List volumes = new ArrayList<>(); volumes.add(new V1Volume().name("workspace").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvc.getMetadata().getName()))); - volumes.add(new V1Volume().name("dataset").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvc.getMetadata().getName()))); - volumes.add(new V1Volume().name("model").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvc.getMetadata().getName()))); + volumes.add(new V1Volume().name("dataset").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(dataPvcName))); + volumes.add(new V1Volume().name("model").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(dataPvcName))); V1Pod pod = new V1PodBuilder() .withNewMetadata()