From ecc911a9b09c1bc22ccf64bcba16edae6f0cb566 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 9 Sep 2024 16:11:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96pod=E6=8C=82=E8=BD=BD?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/JupyterServiceImpl.java | 5 +++-- .../main/java/com/ruoyi/platform/utils/K8sClientUtil.java | 6 +++--- 2 files changed, 6 insertions(+), 5 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 e6380f3a..cefcead2 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 @@ -100,12 +100,13 @@ public class JupyterServiceImpl implements JupyterService { String podName = loginUser.getUsername().toLowerCase() + "-editor-pod" + "-" + id; String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc"; //新建编辑器的pvc - V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName); +// V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName); //TODO 设置镜像可配置,这里先用默认镜像启动pod // 调用修改后的 createPod 方法,传入额外的参数 - Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, devEnvironment, minioPvcName, datasetPath, modelPath); +// Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, devEnvironment, minioPvcName, datasetPath, modelPath); + Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, null, devEnvironment, minioPvcName, datasetPath, modelPath); String url = masterIp + ":" + podPort; redisService.setCacheObject(podName, masterIp + ":" + podPort); devEnvironment.setStatus("Pending"); 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 1c6c5aed..48f4e287 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 @@ -455,9 +455,9 @@ public class K8sClientUtil { volumeMounts.add(new V1VolumeMount().name("model").mountPath("/opt/model").readOnly(true)); List volumes = new ArrayList<>(); - volumes.add(new V1Volume().name("workspace").hostPath(new V1HostPathVolumeSource().path(hostPath + "/notebooks").type("DirectoryOrCreate"))); - volumes.add(new V1Volume().name("dataset").hostPath(new V1HostPathVolumeSource().path(hostPath + "/dataset").type("DirectoryOrCreate"))); - volumes.add(new V1Volume().name("model").hostPath(new V1HostPathVolumeSource().path(hostPath + "/model").type("DirectoryOrCreate"))); + volumes.add(new V1Volume().name("workspace").hostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/notebooks").type("DirectoryOrCreate"))); + volumes.add(new V1Volume().name("dataset").hostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/dataset").type("DirectoryOrCreate"))); + volumes.add(new V1Volume().name("model").hostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/model").type("DirectoryOrCreate"))); // 配置卷和卷挂载 // List volumeMounts = new ArrayList<>(); From 6c81e5611c95c9f06baf61b62890707937ef33df Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 10 Sep 2024 09:07:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9nacos=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-auth/src/main/resources/bootstrap.yml | 2 ++ ruoyi-gateway/src/main/resources/bootstrap.yml | 2 ++ .../management-platform/src/main/resources/bootstrap.yml | 4 +++- ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml | 2 ++ ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml | 2 ++ ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml | 2 ++ ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml | 2 ++ ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml | 2 ++ 8 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ruoyi-auth/src/main/resources/bootstrap.yml b/ruoyi-auth/src/main/resources/bootstrap.yml index a6607611..f9d7d8b4 100644 --- a/ruoyi-auth/src/main/resources/bootstrap.yml +++ b/ruoyi-auth/src/main/resources/bootstrap.yml @@ -19,7 +19,9 @@ spring: password: nacos retry: enabled: true + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式 diff --git a/ruoyi-gateway/src/main/resources/bootstrap.yml b/ruoyi-gateway/src/main/resources/bootstrap.yml index cce74447..cc27cf1d 100644 --- a/ruoyi-gateway/src/main/resources/bootstrap.yml +++ b/ruoyi-gateway/src/main/resources/bootstrap.yml @@ -19,7 +19,9 @@ spring: password: nacos retry: enabled: true + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式 diff --git a/ruoyi-modules/management-platform/src/main/resources/bootstrap.yml b/ruoyi-modules/management-platform/src/main/resources/bootstrap.yml index 11095bb1..b4ff8af9 100644 --- a/ruoyi-modules/management-platform/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/management-platform/src/main/resources/bootstrap.yml @@ -19,7 +19,9 @@ spring: password: nacos retry: enabled: true + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式 @@ -31,4 +33,4 @@ spring: refresh: true - data-id: management-platform-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} group: DEFAULT_GROUP - refresh: true \ No newline at end of file + refresh: true diff --git a/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml index 30ee8b10..871b3634 100644 --- a/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-file/src/main/resources/bootstrap.yml @@ -13,6 +13,7 @@ spring: cloud: nacos: discovery: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 服务注册地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 username: nacos @@ -20,6 +21,7 @@ spring: retry: enabled: true config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式 diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml index b2f67919..686603c9 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/bootstrap.yml @@ -13,6 +13,7 @@ spring: cloud: nacos: discovery: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 服务注册地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 username: nacos @@ -20,6 +21,7 @@ spring: retry: enabled: true config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式 diff --git a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml index 8c79d3ad..688708c8 100644 --- a/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-job/src/main/resources/bootstrap.yml @@ -13,6 +13,7 @@ spring: cloud: nacos: discovery: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 服务注册地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 username: nacos @@ -20,6 +21,7 @@ spring: retry: enabled: true config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式 diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml index c7ddcd4e..cb0fce35 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/bootstrap.yml @@ -13,6 +13,7 @@ spring: cloud: nacos: discovery: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 服务注册地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 username: nacos @@ -20,6 +21,7 @@ spring: retry: enabled: true config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式 diff --git a/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml b/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml index c2876a08..75450678 100644 --- a/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml +++ b/ruoyi-visual/ruoyi-monitor/src/main/resources/bootstrap.yml @@ -13,6 +13,7 @@ spring: cloud: nacos: discovery: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 服务注册地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 username: nacos @@ -20,6 +21,7 @@ spring: retry: enabled: true config: + namespace: 6caf5d79-c4ce-4e3b-a357-141b74e52a01 # 配置中心地址 server-addr: nacos-ci4s.ci4s-test.svc:8848 # 配置文件格式