Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit pod generate #16

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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