Skip to content

Commit

Permalink
环境模板
Browse files Browse the repository at this point in the history
  • Loading branch information
cgw committed Nov 26, 2022
1 parent eef5a68 commit 439dde6
Show file tree
Hide file tree
Showing 19 changed files with 1,640 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public enum GlobalConfigItemTypeEnum {
IMAGEREPO(3, "imageRepo"),
MAVEN(4, "maven"),
TRACE_TEMPLATE(5, "traceTemplate"),
ENV_TEMPLATE(6, "envTemplate"),
;

private Integer code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public enum MessageCodeEnum {
APP_ENV_TAG_IS_EMPTY("200000", "环境标识不能为空"),
APP_ENV_TAG_INEXISTENCE("200000", "环境标识已经存在"),
APP_ENV_INEXISTENCE("200000", "环境不存在"),
TRACE_TEMPLATE_ID_IS_EMPTY("200000", "链路追踪模板编号不能为空"),
TEMPLATE_ID_IS_EMPTY("200000", "编号不能为空"),
APP_ENV_TRACE_STATUS_IS_EMPTY("200000", "链路追踪状态不能为空"),
APP_ENV_TRACE_IMAGE_IS_EMPTY("200000", "链路追踪镜像不能为空"),
TRACE_TEMPLATE_IS_EMPTY("200000", "链路模板不存在"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GlolabConfigPageParam extends PageParam {
private static final long serialVersionUID = 1L;

/**
* 配置项类型,1:ldap,2:代码仓库,3:镜像仓库,4:maven,5:链路追踪模板,6:环境资源模板
* 配置项类型,1:ldap,2:代码仓库,3:镜像仓库,4:maven,5:链路追踪模板,6:环境模板
*/
private Integer itemType;

Expand Down
319 changes: 319 additions & 0 deletions dhorse-api/src/main/java/org/dhorse/api/vo/GlobalConfigAgg.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.dhorse.api.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -18,6 +19,8 @@ public class GlobalConfigAgg implements Serializable {

private Map<String, TraceTemplate> traceTemplates = new HashMap<>();

private EnvTemplate envTemplate;

public Maven getMaven() {
return maven;
}
Expand Down Expand Up @@ -58,6 +61,14 @@ public void setTraceTemplate(String id, TraceTemplate traceTemplate) {
this.traceTemplates.put(id, traceTemplate);
}

public EnvTemplate getEnvTemplate() {
return envTemplate;
}

public void setEnvTemplate(EnvTemplate envTemplate) {
this.envTemplate = envTemplate;
}

public static abstract class BaseGlobalConfig implements Serializable {

private static final long serialVersionUID = 1L;
Expand All @@ -66,6 +77,16 @@ public static abstract class BaseGlobalConfig implements Serializable {

private Integer itemType;

/**
* 创建时间
*/
private Date creationTime;

/**
* 修改时间
*/
private Date updateTime;

public String getId() {
return id;
}
Expand All @@ -82,6 +103,22 @@ public void setItemType(Integer itemType) {
this.itemType = itemType;
}

public Date getCreationTime() {
return creationTime;
}

public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}

public Date getUpdateTime() {
return updateTime;
}

public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}

}

public static class ImageRepo extends BaseGlobalConfig {
Expand Down Expand Up @@ -296,6 +333,288 @@ public void setMavenRepoUrl(String mavenRepoUrl) {
}
}

/**
* 环境模板模型
*/
public static class EnvTemplate extends BaseGlobalConfig {

private static final long serialVersionUID = 1L;

/**
* 集群编号
*/
private String clusterId;

/**
* 部署命名空间名称
*/
private String namespaceName;

/**
* 模板名称,如:开发环境模板、测试环境模板、生产环境模板等
*/
private String templateName;

/**
* 环境名称,如:开发、测试、预发、生产等
*/
private String envName;

/**
* 环境标识,如:dev、qa、pl、ol等
*/
private String tag;

/**
* 部署序号(值越小越往前)
*/
private Integer deploymentOrder;

/**
* 最小副本数
*/
private Integer minReplicas;

/**
* 最大副本数
*/
private Integer maxReplicas;

/**
* 每个副本的cpu核心数
*/
private Integer replicaCpu;

/**
* 每个副本的内存大小,单位m
*/
private Integer replicaMemory;

/**
* 自动扩容,cpu使用率
*/
private Integer autoScalingCpu;

/**
* 自动扩容,内存使用率
*/
private Integer autoScalingMemory;

/**
* 是否需要部署审批,0:否,1:是
*/
private Integer requiredDeployApproval;

/**
* 是否需要合并代码,0:否,1:是
*/
private Integer requiredMerge;

/**
* 链路追踪状态
*/
private Integer traceStatus;

/**
* 链路追踪模板编号
*/
private String traceTemplateId;

/**
* 链路追踪模板名称
*/
private String traceTemplateName;

/**
* 服务端口
*/
private Integer servicePort;

/**
* 健康检查路径,端口后的uri,如:/health
*/
private String healthPath;

/**
* jvm参数
*/
private String jvmArgs;

/**
* 模板描述
*/
private String description;

public String getTag() {
return tag;
}

public void setTag(String tag) {
this.tag = tag;
}

public String getClusterId() {
return clusterId;
}

public void setClusterId(String clusterId) {
this.clusterId = clusterId;
}

public String getTemplateName() {
return templateName;
}

public void setTemplateName(String templateName) {
this.templateName = templateName;
}

public String getEnvName() {
return envName;
}

public void setEnvName(String envName) {
this.envName = envName;
}

public void setDeploymentOrder(Integer deploymentOrder) {
this.deploymentOrder = deploymentOrder;
}

public Integer getDeploymentOrder() {
return deploymentOrder;
}

public Integer getMinReplicas() {
return minReplicas;
}

public void setMinReplicas(Integer minReplicas) {
this.minReplicas = minReplicas;
}

public Integer getMaxReplicas() {
return maxReplicas;
}

public void setMaxReplicas(Integer maxReplicas) {
this.maxReplicas = maxReplicas;
}

public Integer getAutoScalingCpu() {
return autoScalingCpu;
}

public void setAutoScalingCpu(Integer autoScalingCpu) {
this.autoScalingCpu = autoScalingCpu;
}

public Integer getAutoScalingMemory() {
return autoScalingMemory;
}

public void setAutoScalingMemory(Integer autoScalingMemory) {
this.autoScalingMemory = autoScalingMemory;
}

public Integer getReplicaCpu() {
return replicaCpu;
}

public void setReplicaCpu(Integer replicaCpu) {
this.replicaCpu = replicaCpu;
}

public Integer getReplicaMemory() {
return replicaMemory;
}

public void setReplicaMemory(Integer replicaMemory) {
this.replicaMemory = replicaMemory;
}

public Integer getRequiredDeployApproval() {
return requiredDeployApproval;
}

public void setRequiredDeployApproval(Integer requiredDeployApproval) {
this.requiredDeployApproval = requiredDeployApproval;
}

public Integer getRequiredMerge() {
return requiredMerge;
}

public void setRequiredMerge(Integer requiredMerge) {
this.requiredMerge = requiredMerge;
}

public Integer getTraceStatus() {
return traceStatus;
}

public void setTraceStatus(Integer traceStatus) {
this.traceStatus = traceStatus;
}

public String getTraceTemplateId() {
return traceTemplateId;
}

public void setTraceTemplateId(String traceTemplateId) {
this.traceTemplateId = traceTemplateId;
}

public String getTraceTemplateName() {
return traceTemplateName;
}

public void setTraceTemplateName(String traceTemplateName) {
this.traceTemplateName = traceTemplateName;
}

public String getNamespaceName() {
return namespaceName;
}

public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}

public Integer getServicePort() {
return servicePort;
}

public void setServicePort(Integer servicePort) {
this.servicePort = servicePort;
}

public String getHealthPath() {
return healthPath;
}

public void setHealthPath(String healthPath) {
this.healthPath = healthPath;
}

public String getJvmArgs() {
return jvmArgs;
}

public void setJvmArgs(String jvmArgs) {
this.jvmArgs = jvmArgs;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

}

public static class TraceTemplate extends BaseGlobalConfig {

private static final long serialVersionUID = 1L;
Expand Down
Loading

0 comments on commit 439dde6

Please sign in to comment.