mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-01 19:38:09 +08:00
fix 镜像创建容器支持配置 hostname、集群服务支持配置 hostname
This commit is contained in:
parent
0203796d5b
commit
2280935400
@ -5,6 +5,7 @@
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 仓库支持导入导出
|
||||
2. 【server】新增 镜像创建容器支持配置 hostname、集群服务支持配置 hostname(感谢@心光)
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
|
@ -55,4 +55,4 @@ ADD,SCRIPT_EXECUTE_LOG,nodeName,String,50,,节点名称,false
|
||||
ADD,SCRIPT_INFO,workspaceName,String,50,,工作空间名称,false
|
||||
ADD,PROJECT_INFO,workspaceName,String,50,,工作空间名称,false
|
||||
ADD,SCRIPT_EXECUTE_LOG,workspaceName,String,50,,工作空间名称,false
|
||||
ALTER,REPOSITORY,password,String,255,,登录密码,true
|
||||
ALTER,REPOSITORY,password,String,255,,登录密码,false
|
||||
|
|
@ -273,7 +273,8 @@ public class DefaultDockerPluginImpl implements IDockerConfigPlugin {
|
||||
return labelMap;
|
||||
})
|
||||
.ifPresent(containerCmd::withLabels);
|
||||
|
||||
String hostname = (String) parameter.get("hostname");
|
||||
Opt.ofBlankAble(hostname).ifPresent(containerCmd::withHostName);
|
||||
HostConfig hostConfig = HostConfig.newHostConfig();
|
||||
Opt.ofBlankAble(runtime).ifPresent(hostConfig::withRuntime);
|
||||
List<ExposedPort> exposedPortList = new ArrayList<>();
|
||||
|
@ -25,6 +25,7 @@ package org.dromara.jpom;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.io.unit.DataSize;
|
||||
import cn.hutool.core.lang.Opt;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@ -325,7 +326,8 @@ public class DefaultDockerSwarmPluginImpl implements IDefaultPlugin {
|
||||
private ContainerSpec buildContainerSpec(Map<String, Object> parameter, ContainerSpec oldContainerSpec) {
|
||||
String image = (String) parameter.get("image");
|
||||
ContainerSpec containerSpec = ObjectUtil.defaultIfNull(oldContainerSpec, new ContainerSpec());
|
||||
//new ContainerSpec();
|
||||
String hostname = (String) parameter.get("hostname");
|
||||
Opt.ofBlankAble(hostname).ifPresent(containerSpec::withHostname);
|
||||
containerSpec.withImage(image);
|
||||
//
|
||||
Collection<Map<String, String>> args = (Collection) parameter.get("args");
|
||||
|
@ -229,6 +229,9 @@
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="hostname" prop="hostname">
|
||||
<a-input v-model="temp.hostname" placeholder="主机名 hostname" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="网络">
|
||||
<a-auto-complete v-model="temp.networkMode" placeholder="网络模式:bridge、container:<name|id>、host、container、none" option-label-prop="value">
|
||||
<template slot="dataSource">
|
||||
@ -555,6 +558,7 @@ export default {
|
||||
restartPolicy: this.temp.restartPolicy,
|
||||
labels: this.temp.labels,
|
||||
runtime: this.temp.runtime,
|
||||
hostname: this.temp.hostname,
|
||||
storageOpt: {},
|
||||
};
|
||||
temp.volumes = (this.temp.volumes || [])
|
||||
|
@ -81,6 +81,9 @@
|
||||
<a-form-model-item label="镜像名称" prop="image">
|
||||
<a-input v-model="temp.image" placeholder="镜像名称" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="hostname" prop="hostname">
|
||||
<a-input v-model="temp.hostname" placeholder="主机名 hostname" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="更多配置" prop="">
|
||||
<a-tabs>
|
||||
<a-tab-pane key="port" tab="端口">
|
||||
@ -533,6 +536,7 @@ export default {
|
||||
this.temp = {
|
||||
serviceId: record.id,
|
||||
name: spec.name,
|
||||
hostname: spec.taskTemplate?.containerSpec?.hostname,
|
||||
mode: spec.mode?.mode,
|
||||
replicas: spec.mode?.replicated?.replicas,
|
||||
image: image,
|
||||
|
Loading…
Reference in New Issue
Block a user