Skip to content

Commit

Permalink
Merge pull request #16 from pbcccBeatBoard/main
Browse files Browse the repository at this point in the history
edit pod generate
  • Loading branch information
pbcccbeatboard-strato authored Sep 3, 2024
2 parents 30f1f9e + 7494124 commit 096ce5b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/main/java/kr/co/mcmp/manifest/K8SDeployYamlGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,24 @@ private V1Pod getPod(K8SPodDTO podDto) {

private V1PodSpec getPodSpec(K8SPodDTO podDto){
V1PodSpec podSpec = new V1PodSpec();
List<V1Container> containerList = podDto.getContainers();
List<V1Container> containerList = new ArrayList<>(); //podDto.getContainers();
for(K8SPodDTO.Container cont: podDto.getContainers()){
V1Container container = new V1Container();
container.setName(cont.getContainerName());
container.setImage(cont.getContainerImage());
List<V1ContainerPort> portList = new ArrayList<>();
for(K8SPodDTO.Port pt: cont.getPorts()) {
V1ContainerPort port = new V1ContainerPort();
port.setProtocol(pt.getProtocol());
port.setProtocol(pt.getName());
port.setContainerPort(pt.getContainerPort());
portList.add(port);
}
//V1ResourceRequirements resourceReq = new V1ResourceRequirements();
//resourceReq.setLimits();
container.setPorts(portList);
containerList.add(container);
}
podSpec.setContainers(containerList);
podSpec.setRestartPolicy(podDto.getRestartPolicy());
return podSpec;
Expand Down
35 changes: 34 additions & 1 deletion src/main/java/kr/co/mcmp/manifest/K8SPodDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,40 @@ public class K8SPodDTO {

public String podName;
public String namespace;
public List<V1Container> containers;
//public List<V1Container> containers;

public List<Container> containers;

@Getter
@Setter
public class Container{
public String containerImage;
public String containerName;
public List<Port> ports;
//public Resource resource;

}

@Getter
@Setter
public class Port{
public int containerPort;
public int hostPort;
public String name;
public String protocol;
}

@Getter
@Setter
public class Resource{
public String limitCpu;
public String LimitMemory;
public String reqCpu;
public String reqMemory;
}



public Map<String, String> labels;
public String restartPolicy;

Expand Down

0 comments on commit 096ce5b

Please sign in to comment.