use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class ContainerHandlerTest method getVolumeMountWithNameAndMountTest.
@Test
public void getVolumeMountWithNameAndMountTest() {
ContainerHandler handler = createContainerHandler(project);
List<String> mounts = new ArrayList<>();
mounts.add("/path/etc");
images.clear();
images.add(imageConfiguration1);
// volume config with name and single mount
VolumeConfig volumeConfig3 = VolumeConfig.builder().name("third").mounts(mounts).build();
volumes1.clear();
volumes1.add(volumeConfig3);
ResourceConfig config3 = ResourceConfig.builder().volumes(volumes1).build();
containers = handler.getContainers(config3, images);
assertEquals(1, containers.get(0).getVolumeMounts().size());
assertEquals("third", containers.get(0).getVolumeMounts().get(0).getName());
assertEquals("/path/etc", containers.get(0).getVolumeMounts().get(0).getMountPath());
}
use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class ContainerHandlerTest method getVolumeMountWithoutMountTest.
@Test
public void getVolumeMountWithoutMountTest() {
ContainerHandler handler = createContainerHandler(project);
images.clear();
images.add(imageConfiguration1);
// volume config without mount
VolumeConfig volumeConfig1 = VolumeConfig.builder().name("first").build();
volumes1.add(volumeConfig1);
ResourceConfig config1 = ResourceConfig.builder().volumes(volumes1).build();
containers = handler.getContainers(config1, images);
assertTrue(containers.get(0).getVolumeMounts().isEmpty());
}
use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class DeploymentHandlerTest method before.
@Before
public void before() {
// volume config with name and multiple mount
mounts.add("/path/system");
mounts.add("/path/sys");
ports.add("8080");
ports.add("9090");
tags.add("latest");
tags.add("test");
VolumeConfig volumeConfig1 = VolumeConfig.builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
volumes1.add(volumeConfig1);
// container name with alias
final BuildConfiguration buildImageConfiguration = BuildConfiguration.builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compressionString("gzip").build();
ImageConfiguration imageConfiguration = ImageConfiguration.builder().name("test").alias("test-app").build(buildImageConfiguration).registry("docker.io").build();
images.add(imageConfiguration);
deploymentHandler = new DeploymentHandler(new PodTemplateHandler(new ContainerHandler(project.getProperties(), new GroupArtifactVersion("g", "a", "v"), probeHandler)));
}
use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class PodTemplateHandlerTest method podWithVolumeTemplateHandlerTest.
@Test
public void podWithVolumeTemplateHandlerTest() {
// Config with Volume Config and ServiceAccount
// valid type
VolumeConfig volumeConfig1 = VolumeConfig.builder().name("test").mounts(mounts).type("hostPath").path("/test/path").build();
volumes1.clear();
volumes1.add(volumeConfig1);
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").controllerName("testing").serviceAccount("test-account").replicas(5).volumes(volumes1).build();
PodTemplateSpec podTemplateSpec = podTemplateHandler.getPodTemplate(config, null, images);
// Assertion
assertEquals("test-account", podTemplateSpec.getSpec().getServiceAccountName());
assertFalse(podTemplateSpec.getSpec().getVolumes().isEmpty());
assertEquals("test", podTemplateSpec.getSpec().getVolumes().get(0).getName());
assertEquals("/test/path", podTemplateSpec.getSpec().getVolumes().get(0).getHostPath().getPath());
assertNotNull(podTemplateSpec.getSpec().getContainers());
}
use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class PodTemplateHandlerTest method podWithInvalidVolumeTypeTemplateHandlerTest.
@Test
public void podWithInvalidVolumeTypeTemplateHandlerTest() {
// invalid type
VolumeConfig volumeConfig1 = VolumeConfig.builder().name("test").mounts(mounts).type("hoStPath").path("/test/path").build();
volumes1.clear();
volumes1.add(volumeConfig1);
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").controllerName("testing").serviceAccount("test-account").replicas(5).volumes(volumes1).build();
PodTemplateSpec podTemplateSpec = podTemplateHandler.getPodTemplate(config, null, images);
// Assertion
assertEquals("test-account", podTemplateSpec.getSpec().getServiceAccountName());
assertTrue(podTemplateSpec.getSpec().getVolumes().isEmpty());
assertNotNull(podTemplateSpec.getSpec().getContainers());
}
Aggregations