修改挂载路径

This commit is contained in:
chenzhihang 2024-09-10 15:53:03 +08:00
parent 006b625571
commit e58d73ae12
2 changed files with 7 additions and 6 deletions

View File

@ -63,7 +63,9 @@ public class MinioServiceImpl implements MinioService {
try (InputStream inputStream = file.getInputStream()){
minioUtil.uploadObject(bucketName, objectName, inputStream);
result.put("fileName", file.getOriginalFilename());
result.put("url", objectName); // objectName根据实际情况定义
int lastIndex = objectName.lastIndexOf('/');
String url = objectName.substring(0, lastIndex);
result.put("url", url); // objectName根据实际情况定义
result.put("fileSize", formattedSize);
} catch (Exception e) {
throw new Exception("上传文件失败: " + e.getMessage(), e);

View File

@ -366,7 +366,7 @@ public class K8sClientUtil {
.endContainer()
.addNewVolume()
.withName("workspace")
.withHostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/tensorboard").type("DirectoryOrCreate"))
.withHostPath(new V1HostPathVolumeSource().path(pvcName).type("DirectoryOrCreate"))
// .withPersistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvcName))
.endVolume()
.withTerminationGracePeriodSeconds(14400L)
@ -452,13 +452,12 @@ public class K8sClientUtil {
// 配置卷和卷挂载
List<V1VolumeMount> volumeMounts = new ArrayList<>();
volumeMounts.add(new V1VolumeMount().name("workspace").mountPath("/opt/notebooks"));
volumeMounts.add(new V1VolumeMount().name("dataset").mountPath("/opt/dataset").readOnly(true));
volumeMounts.add(new V1VolumeMount().name("model").mountPath("/opt/model").readOnly(true));
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<>();
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")));
volumes.add(new V1Volume().name("data").hostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate")));
// 配置卷和卷挂载
// List<V1VolumeMount> volumeMounts = new ArrayList<>();