Browse Source

优化开发环境功能

dev-complex-computation
chenzhihang 1 year ago
parent
commit
8189e2e059
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java

+ 10
- 3
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java View File

@@ -459,12 +459,19 @@ public class K8sClientUtil {
// 配置卷和卷挂载 // 配置卷和卷挂载
List<V1VolumeMount> volumeMounts = new ArrayList<>(); List<V1VolumeMount> volumeMounts = new ArrayList<>();
volumeMounts.add(new V1VolumeMount().name("workspace").mountPath("/opt/notebooks")); volumeMounts.add(new V1VolumeMount().name("workspace").mountPath("/opt/notebooks"));
volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/dataset").subPath(datasetPath).readOnly(true));
volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/model").subPath(modelPath).readOnly(true));


List<V1Volume> volumes = new ArrayList<>(); List<V1Volume> volumes = new ArrayList<>();
volumes.add(new V1Volume().name("workspace").hostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/notebooks").type("DirectoryOrCreate"))); volumes.add(new V1Volume().name("workspace").hostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/notebooks").type("DirectoryOrCreate")));
volumes.add(new V1Volume().name("data").hostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate")));

if (StringUtils.isNotEmpty(datasetPath)) {
volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/dataset").subPath(datasetPath).readOnly(true));
}
if (StringUtils.isNotEmpty(modelPath)) {
volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/model").subPath(modelPath).readOnly(true));
}
if (StringUtils.isNotEmpty(datasetPath) || StringUtils.isNotEmpty(modelPath)) {
volumes.add(new V1Volume().name("data").hostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate")));
}


// 配置卷和卷挂载 // 配置卷和卷挂载
// List<V1VolumeMount> volumeMounts = new ArrayList<>(); // List<V1VolumeMount> volumeMounts = new ArrayList<>();


Loading…
Cancel
Save