|
|
|
@@ -4,6 +4,8 @@ import com.alibaba.fastjson2.JSON; |
|
|
|
import com.ruoyi.platform.constant.Constant; |
|
|
|
import com.ruoyi.platform.domain.DevEnvironment; |
|
|
|
import com.ruoyi.platform.mapper.ComputingResourceDao; |
|
|
|
import io.fabric8.kubernetes.api.model.SecurityContext; |
|
|
|
import io.fabric8.kubernetes.api.model.SecurityContextBuilder; |
|
|
|
import io.kubernetes.client.Exec; |
|
|
|
import io.kubernetes.client.custom.IntOrString; |
|
|
|
import io.kubernetes.client.custom.Quantity; |
|
|
|
@@ -624,7 +626,10 @@ public class K8sClientUtil { |
|
|
|
|
|
|
|
public V1Pod createPodWithEnv(String podName, String namespace, String proxyUrl, String mountPath, String pvcName, String image) { |
|
|
|
CoreV1Api api = new CoreV1Api(apiClient); |
|
|
|
V1PodList v1PodList = null; |
|
|
|
|
|
|
|
V1SecurityContext v1SecurityContext = new V1SecurityContext(); |
|
|
|
v1SecurityContext.setPrivileged(true); |
|
|
|
|
|
|
|
V1Pod pod = new V1PodBuilder() |
|
|
|
.withNewMetadata() |
|
|
|
.withName(podName) |
|
|
|
@@ -633,6 +638,7 @@ public class K8sClientUtil { |
|
|
|
.addNewContainer() |
|
|
|
.withName(podName) |
|
|
|
.withImage(image) // 替换为您实际要使用的镜像名称 |
|
|
|
.withSecurityContext(v1SecurityContext) |
|
|
|
.withVolumeMounts(new V1VolumeMount().name("workspace").mountPath(mountPath)) |
|
|
|
.withNewSecurityContext().withNewPrivileged(true).endSecurityContext() |
|
|
|
.addNewEnv() |
|
|
|
|