@Test public void containerEmptyPortsTest() { ContainerHandler handler = createContainerHandler(project); images.clear(); images.add(imageConfiguration1); containers = handler.getContainers(config, images); assertTrue(containers.get(0).getPorts().isEmpty()); }
List<Container> getContainers(ResourceConfig config, List<ImageConfiguration> images) { List<Container> ret = new ArrayList<>(); for (ImageConfiguration imageConfig : images) { if (imageConfig.getBuildConfiguration() != null) { Probe livenessProbe = probeHandler.getProbe(config.getLiveness()); Probe readinessProbe = probeHandler.getProbe(config.getReadiness()); Container container = new ContainerBuilder() .withName(KubernetesResourceUtil.extractContainerName(this.groupArtifactVersion, imageConfig)) .withImage(getImageName(imageConfig)) .withImagePullPolicy(getImagePullPolicy(config)) .withEnv(getEnvVars(config)) .withSecurityContext(createSecurityContext(config)) .withPorts(getContainerPorts(imageConfig)) .withVolumeMounts(getVolumeMounts(config)) .withLivenessProbe(livenessProbe) .withReadinessProbe(readinessProbe) .build(); ret.add(container); } } return ret; }
ContainerHandler { List<Container> getContainers(ResourceConfig config, List<ImageConfiguration> images) { List<Container> ret = new ArrayList<>(); for (ImageConfiguration imageConfig : images) { if (imageConfig.getBuildConfiguration() != null) { Probe livenessProbe = probeHandler.getProbe(config.getLiveness()); Probe readinessProbe = probeHandler.getProbe(config.getReadiness()); Container container = new ContainerBuilder() .withName(KubernetesResourceUtil.extractContainerName(this.groupArtifactVersion, imageConfig)) .withImage(getImageName(imageConfig)) .withImagePullPolicy(getImagePullPolicy(config)) .withEnv(getEnvVars(config)) .withSecurityContext(createSecurityContext(config)) .withPorts(getContainerPorts(imageConfig)) .withVolumeMounts(getVolumeMounts(config)) .withLivenessProbe(livenessProbe) .withReadinessProbe(readinessProbe) .build(); ret.add(container); } } return ret; } }
ContainerHandler { List<Container> getContainers(ResourceConfig config, List<ImageConfiguration> images) { List<Container> ret = new ArrayList<>(); for (ImageConfiguration imageConfig : images) { if (imageConfig.getBuildConfiguration() != null) { Probe livenessProbe = probeHandler.getProbe(config.getLiveness()); Probe readinessProbe = probeHandler.getProbe(config.getReadiness()); Container container = new ContainerBuilder() .withName(KubernetesResourceUtil.extractContainerName(this.groupArtifactVersion, imageConfig)) .withImage(getImageName(imageConfig)) .withImagePullPolicy(getImagePullPolicy(config)) .withEnv(getEnvVars(config)) .withSecurityContext(createSecurityContext(config)) .withPorts(getContainerPorts(imageConfig)) .withVolumeMounts(getVolumeMounts(config)) .withLivenessProbe(livenessProbe) .withReadinessProbe(readinessProbe) .build(); ret.add(container); } } return ret; } ContainerHandler(Properties configurationProperties, GroupArtifactVersion groupArtifactVersion, ProbeHandler probeHandler); }
ContainerHandler { List<Container> getContainers(ResourceConfig config, List<ImageConfiguration> images) { List<Container> ret = new ArrayList<>(); for (ImageConfiguration imageConfig : images) { if (imageConfig.getBuildConfiguration() != null) { Probe livenessProbe = probeHandler.getProbe(config.getLiveness()); Probe readinessProbe = probeHandler.getProbe(config.getReadiness()); Container container = new ContainerBuilder() .withName(KubernetesResourceUtil.extractContainerName(this.groupArtifactVersion, imageConfig)) .withImage(getImageName(imageConfig)) .withImagePullPolicy(getImagePullPolicy(config)) .withEnv(getEnvVars(config)) .withSecurityContext(createSecurityContext(config)) .withPorts(getContainerPorts(imageConfig)) .withVolumeMounts(getVolumeMounts(config)) .withLivenessProbe(livenessProbe) .withReadinessProbe(readinessProbe) .build(); ret.add(container); } } return ret; } ContainerHandler(Properties configurationProperties, GroupArtifactVersion groupArtifactVersion, ProbeHandler probeHandler);  }
ContainerHandler { List<Container> getContainers(ResourceConfig config, List<ImageConfiguration> images) { List<Container> ret = new ArrayList<>(); for (ImageConfiguration imageConfig : images) { if (imageConfig.getBuildConfiguration() != null) { Probe livenessProbe = probeHandler.getProbe(config.getLiveness()); Probe readinessProbe = probeHandler.getProbe(config.getReadiness()); Container container = new ContainerBuilder() .withName(KubernetesResourceUtil.extractContainerName(this.groupArtifactVersion, imageConfig)) .withImage(getImageName(imageConfig)) .withImagePullPolicy(getImagePullPolicy(config)) .withEnv(getEnvVars(config)) .withSecurityContext(createSecurityContext(config)) .withPorts(getContainerPorts(imageConfig)) .withVolumeMounts(getVolumeMounts(config)) .withLivenessProbe(livenessProbe) .withReadinessProbe(readinessProbe) .build(); ret.add(container); } } return ret; } ContainerHandler(Properties configurationProperties, GroupArtifactVersion groupArtifactVersion, ProbeHandler probeHandler);   }