Search in sources :

Example 1 with NetworkConfiguration

use of com.netflix.titus.api.jobmanager.model.job.NetworkConfiguration in project titus-control-plane by Netflix.

the class V1SpecPodFactoryTest method testNetworkConfigurationRespectsBeingSet.

@Test
public void testNetworkConfigurationRespectsBeingSet() {
    Job<BatchJobExt> job = JobGenerator.oneBatchJob();
    BatchJobTask task = JobGenerator.oneBatchTask();
    NetworkConfiguration networkConfiguration = new NetworkConfiguration(3);
    job = job.toBuilder().withJobDescriptor(job.getJobDescriptor().toBuilder().withNetworkConfiguration(networkConfiguration).build()).build();
    when(podAffinityFactory.buildV1Affinity(job, task)).thenReturn(Pair.of(new V1Affinity(), new HashMap<>()));
    V1Pod pod = podFactory.buildV1Pod(job, task);
    String networkModeAnnotationValue = pod.getMetadata().getAnnotations().get("network.netflix.com/network-mode");
    assertThat(networkModeAnnotationValue).isEqualTo("Ipv6AndIpv4Fallback");
}
Also used : V1Affinity(io.kubernetes.client.openapi.models.V1Affinity) HashMap(java.util.HashMap) BatchJobExt(com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt) BatchJobTask(com.netflix.titus.api.jobmanager.model.job.BatchJobTask) V1Pod(io.kubernetes.client.openapi.models.V1Pod) NetworkConfiguration(com.netflix.titus.api.jobmanager.model.job.NetworkConfiguration) Test(org.junit.Test)

Aggregations

BatchJobTask (com.netflix.titus.api.jobmanager.model.job.BatchJobTask)1 NetworkConfiguration (com.netflix.titus.api.jobmanager.model.job.NetworkConfiguration)1 BatchJobExt (com.netflix.titus.api.jobmanager.model.job.ext.BatchJobExt)1 V1Affinity (io.kubernetes.client.openapi.models.V1Affinity)1 V1Pod (io.kubernetes.client.openapi.models.V1Pod)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1