use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class PodTemplateHandler method getVolumes.
private List<Volume> getVolumes(ResourceConfig config) {
List<VolumeConfig> volumeConfigs = config.getVolumes();
List<Volume> ret = new ArrayList<>();
if (volumeConfigs != null) {
for (VolumeConfig volumeConfig : volumeConfigs) {
VolumeType type = VolumeType.typeFor(volumeConfig.getType());
if (type != null) {
ret.add(type.fromConfig(volumeConfig));
}
}
}
return ret;
}
use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class ContainerHandler method getVolumeMounts.
private List<VolumeMount> getVolumeMounts(ResourceConfig config) {
List<VolumeConfig> volumeConfigs = config.getVolumes();
List<VolumeMount> ret = new ArrayList<>();
if (volumeConfigs != null) {
for (VolumeConfig volumeConfig : volumeConfigs) {
List<String> mounts = volumeConfig.getMounts();
if (mounts != null) {
for (String mount : mounts) {
ret.add(new VolumeMountBuilder().withName(volumeConfig.getName()).withMountPath(mount).withReadOnly(false).build());
}
}
}
}
return ret;
}
use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class ContainerHandlerTest method getVolumeMountWithoutNameTest.
@Test
public void getVolumeMountWithoutNameTest() {
ContainerHandler handler = createContainerHandler(project);
images.clear();
images.add(imageConfiguration1);
List<String> mounts = new ArrayList<>();
mounts.add("/path/etc");
// volume config without name but with mount
VolumeConfig volumeConfig2 = VolumeConfig.builder().mounts(mounts).build();
volumes1.clear();
volumes1.add(volumeConfig2);
ResourceConfig config2 = ResourceConfig.builder().volumes(volumes1).build();
containers = handler.getContainers(config2, images);
assertEquals(1, containers.get(0).getVolumeMounts().size());
assertNull(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 getVolumeMountWithMultipleMountTest.
@Test
public void getVolumeMountWithMultipleMountTest() {
ContainerHandler handler = createContainerHandler(project);
images.clear();
images.add(imageConfiguration1);
List<String> mounts = new ArrayList<>();
mounts.add("/path/etc");
// volume config with name and multiple mount
mounts.add("/path/system");
mounts.add("/path/sys");
VolumeConfig volumeConfig4 = VolumeConfig.builder().name("test").mounts(mounts).build();
volumes1.clear();
volumes1.add(volumeConfig4);
ResourceConfig config4 = ResourceConfig.builder().volumes(volumes1).build();
containers = handler.getContainers(config4, images);
assertEquals(3, containers.get(0).getVolumeMounts().size());
for (int i = 0; i <= 2; i++) assertEquals("test", containers.get(0).getVolumeMounts().get(i).getName());
}
use of org.eclipse.jkube.kit.config.resource.VolumeConfig in project jkube by eclipse.
the class DaemonSetHandlerTest 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);
daemonSetHandler = new DaemonSetHandler(new PodTemplateHandler(new ContainerHandler(project.getProperties(), new GroupArtifactVersion("g", "a", "v"), probeHandler)));
}
Aggregations