use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class JobHandlerTest method daemonTemplateHandlerWithInvalidNameTest.
@Test
public void daemonTemplateHandlerWithInvalidNameTest() {
// with invalid controller name
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").controllerName("TesTing").serviceAccount("test-account").volumes(volumes1).build();
assertThrows(IllegalArgumentException.class, () -> jobHandler.get(config, images));
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class PodTemplateHandlerTest method podWithoutEmptyTypeTemplateHandlerTest.
@Test
public void podWithoutEmptyTypeTemplateHandlerTest() {
// empty type
VolumeConfig volumeConfig1 = VolumeConfig.builder().name("test").mounts(mounts).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());
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class PodTemplateHandlerTest method podWithEmotyVolumeTemplateHandlerTest.
@Test
public void podWithEmotyVolumeTemplateHandlerTest() {
// Pod with empty Volume Config and wihtout ServiceAccount
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").controllerName("testing").replicas(5).volumes(volumes1).build();
PodTemplateSpec podTemplateSpec = podTemplateHandler.getPodTemplate(config, null, images);
// Assertion
assertNull(podTemplateSpec.getSpec().getServiceAccountName());
assertTrue(podTemplateSpec.getSpec().getVolumes().isEmpty());
assertNotNull(podTemplateSpec.getSpec().getContainers());
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class IngressEnricher method create.
@Override
public void create(PlatformMode platformMode, final KubernetesListBuilder listBuilder) {
ResourceConfig resourceConfig = getConfiguration().getResource();
Boolean shouldCreateIngress = getValueFromConfig(CREATE_EXTERNAL_URLS, false);
if (shouldCreateIngress.equals(Boolean.FALSE)) {
return;
}
if (platformMode == PlatformMode.kubernetes) {
listBuilder.accept(new TypedVisitor<ServiceBuilder>() {
@Override
public void visit(ServiceBuilder serviceBuilder) {
HasMetadata generatedIngress = generateIngressWithConfiguredApiVersion(serviceBuilder, listBuilder, resourceConfig);
if (generatedIngress != null) {
listBuilder.addToItems(generatedIngress);
}
}
});
}
}
use of org.eclipse.jkube.kit.config.resource.ResourceConfig in project jkube by eclipse.
the class ReplicaSetHandlerTest method replicaSetHandlerWithInvalidNameTest.
@Test(expected = IllegalArgumentException.class)
public void replicaSetHandlerWithInvalidNameTest() {
// with invalid controller name
ResourceConfig config = ResourceConfig.builder().imagePullPolicy("IfNotPresent").controllerName("TesTing").serviceAccount("test-account").replicas(5).volumes(volumes1).build();
replicaSetHandler.get(config, images);
}
Aggregations