Skip to content

Commit

Permalink
Merge pull request #29 from st-yclee/main
Browse files Browse the repository at this point in the history
k8s dto 수정
  • Loading branch information
st-yclee authored Sep 13, 2024
2 parents 47c8b6b + 38a3b8b commit 1152bf9
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 56 deletions.
22 changes: 11 additions & 11 deletions src/main/java/kr/co/mcmp/api/manifest/YamlManifestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,40 @@ public class YamlManifestController {
@Operation(summary = "Deployments Yaml 생성")
@PostMapping("/yaml/deployments")
public ResponseEntity<ResponseWrapper<String>> generateYamlDeployments(
@RequestBody K8SDeploymentsDto deployments) {
manifestService.generateYamlDeployments(deployments);
return ResponseEntity.ok(new ResponseWrapper<>("Deployments Yaml Generated Successfully"));
@RequestBody K8SDeploymentDto deployments) {
String yaml = manifestService.generateYamlDeployments(deployments);
return ResponseEntity.ok(new ResponseWrapper<>(yaml));
}

@Operation(summary = "Service Yaml 생성")
@PostMapping("/yaml/service")
public ResponseEntity<ResponseWrapper<String>> generateYamlService(
@RequestBody K8SServiceDto service) {
manifestService.generateYamlService(service);
return ResponseEntity.ok(new ResponseWrapper<>("Service Yaml Generated Successfully"));
String yaml = manifestService.generateYamlService(service);
return ResponseEntity.ok(new ResponseWrapper<>(yaml));
}

@Operation(summary = "ConfigMap Yaml 생성")
@PostMapping("/yaml/configmap")
public ResponseEntity<ResponseWrapper<String>> generateYamlConfigMap(
@RequestBody K8SConfigMapDto configMap) {
manifestService.generateYamlConfigMap(configMap);
return ResponseEntity.ok(new ResponseWrapper<>("ConfigMap Yaml Generated Successfully"));
String yaml = manifestService.generateYamlConfigMap(configMap);
return ResponseEntity.ok(new ResponseWrapper<>(yaml));
}

@Operation(summary = "Pod Yaml 생성")
@PostMapping("/yaml/pod")
public ResponseEntity<ResponseWrapper<String>> generateYamlPod(
@RequestBody K8SPodDto pod) {
manifestService.generateYamlPod(pod);
return ResponseEntity.ok(new ResponseWrapper<>("Pod Yaml Generated Successfully"));
String yaml = manifestService.generateYamlPod(pod);
return ResponseEntity.ok(new ResponseWrapper<>(yaml));
}

@Operation(summary = "Hpa Yaml 생성")
@PostMapping("/yaml/hpa")
public ResponseEntity<ResponseWrapper<String>> generateYamlHpa(
@RequestBody K8SHpaDto hpa) {
manifestService.generateYamlHpa(hpa);
return ResponseEntity.ok(new ResponseWrapper<>("Hpa Yaml Generated Successfully"));
String yaml = manifestService.generateYamlHpa(hpa);
return ResponseEntity.ok(new ResponseWrapper<>(yaml));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class YamlManifestService {
private final ObjectMapper mapper = new ObjectMapper(new YAMLFactory())
.setSerializationInclusion(JsonInclude.Include.NON_NULL);

public String generateYamlDeployments(K8SDeploymentsDto deployments) {
public String generateYamlDeployments(K8SDeploymentDto deployments) {
return generateYaml(deployments);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public class K8SConfigMapDto {

private final String apiVersion = "v1";
private final String kind = "ConfigMap";
private MetadataDto metadata;
private ConfigMapMetadataDto metadata;
private Map<String, String> data = null;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class MetadataDto {
public static class ConfigMapMetadataDto {
private String name;
private String namespace;
private Map<String, String> labels = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class K8SDeploymentsDto {
public class K8SDeploymentDto {

private final String apiVersion = "apps/v1";
private final String kind = "Deployment";
private MetadataDto metadata;
private SpecDto spec;
private DeploymentMetadataDto metadata;
private DeploymentSpecDto spec;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class MetadataDto {
public static class DeploymentMetadataDto {
private String name;
private String namespace;
private Map<String, String> labels = null;
Expand All @@ -33,49 +33,49 @@ public static class MetadataDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class SpecDto {
public static class DeploymentSpecDto {
private Integer replicas;
private SelectorDto selector;
private TemplateDto template;
private DeploymentSelectorDto selector;
private DeploymentTemplateDto template;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class SelectorDto {
public static class DeploymentSelectorDto {
private Map<String, String> matchLabels = null;
}

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class TemplateDto {
private MetadataDto metadata;
private PodSpecDto spec;
public static class DeploymentTemplateDto {
private DeploymentMetadataDto metadata;
private DeploymentPodSpecDto spec;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class PodSpecDto {
private List<ContainerDto> containers = null;
public static class DeploymentPodSpecDto {
private List<DeploymentPodContainerDto> containers = null;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ContainerDto {
public static class DeploymentPodContainerDto {
private String name;
private String image;
private List<EnvDto> env = null;
private List<PortDto> ports = null;
private List<DeploymentPodEnvDto> env = null;
private List<DeploymentPodPortDto> ports = null;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class EnvDto {
public static class DeploymentPodEnvDto {
private String name;
private String value;
}
Expand All @@ -84,7 +84,7 @@ public static class EnvDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class PortDto {
public static class DeploymentPodPortDto {
private Integer containerPort;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/kr/co/mcmp/api/manifest/k8s/K8SHpaDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public class K8SHpaDto {

private final String apiVersion = "autoscaling/v1";
private final String kind = "HorizontalPodAutoscaler";
private MetadataDto metadata;
private SpecDto spec;
private HpaMetadataDto metadata;
private HpaSpecDto spec;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class MetadataDto {
public static class HpaMetadataDto {
private String name;
private String namespace;
private Map<String, String> labels = null;
Expand All @@ -32,8 +32,8 @@ public static class MetadataDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class SpecDto {
private ScaleTargetRefDto scaleTargetRef;
public static class HpaSpecDto {
private HpaScaleTargetRefDto scaleTargetRef;
private Integer minReplicas;
private Integer maxReplicas;
private Integer targetCPUUtilizationPercentage;
Expand All @@ -42,7 +42,7 @@ public static class SpecDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ScaleTargetRefDto {
public static class HpaScaleTargetRefDto {
private String apiVersion;
private String kind;
private String name;
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/kr/co/mcmp/api/manifest/k8s/K8SPodDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public class K8SPodDto {

private final String apiVersion = "v1";
private final String kind = "Pod";
private MetadataDto metadata;
private SpecDto spec;
private PodMetadataDto metadata;
private PodSpecDto spec;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class MetadataDto {
public static class PodMetadataDto {
private String name;
private String namespace;
private Map<String, String> labels = null;
Expand All @@ -33,26 +33,26 @@ public static class MetadataDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class SpecDto {
private List<ContainerDto> containers = null;
public static class PodSpecDto {
private List<PodContainerDto> containers = null;
private String restartPolicy;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ContainerDto {
public static class PodContainerDto {
private String name;
private String image;
private List<EnvDto> env = null;
private List<PortDto> ports = null;
private ResourceDto resources;
private List<PodEnvDto> env = null;
private List<PodPortDto> ports = null;
private PodResourceDto resources;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class EnvDto {
public static class PodEnvDto {
private String name;
private String value;
}
Expand All @@ -61,7 +61,7 @@ public static class EnvDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class PortDto {
public static class PodPortDto {
private String name;
private Integer containerPort;
private Integer hostPort;
Expand All @@ -72,7 +72,7 @@ public static class PortDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ResourceDto {
public static class PodResourceDto {
private Map<String, String> limits = null;
private Map<String, String> requests = null;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/kr/co/mcmp/api/manifest/k8s/K8SServiceDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public class K8SServiceDto {

private final String apiVersion = "v1";
private final String kind = "Service";
private MetadataDto metadata;
private SpecDto spec;
private ServiceMetadataDto metadata;
private ServiceSpecDto spec;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class MetadataDto {
public static class ServiceMetadataDto {
private String name;
private String namespace;
private Map<String, String> labels = null;
Expand All @@ -33,16 +33,16 @@ public static class MetadataDto {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class SpecDto {
public static class ServiceSpecDto {
private Map<String, String> selector = null;
private List<PortsDto> ports = null;
private List<ServicePortsDto> ports = null;
private String type;

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class PortsDto {
public static class ServicePortsDto {
private String protocol;
private Integer port;
private Integer targetPort;
Expand Down

0 comments on commit 1152bf9

Please sign in to comment.