use of com.netflix.titus.api.jobmanager.model.job.Image in project titus-control-plane by Netflix.
the class JobDescriptorGenerator method oneTaskBatchJobDescriptor.
public static JobDescriptor<BatchJobExt> oneTaskBatchJobDescriptor() {
JobDescriptor<BatchJobExt> jobDescriptor = batchJobDescriptors().getValue();
Image imageWithTag = JobModel.newImage().withName("titusops/alpine").withTag("latest").build();
return JobModel.newJobDescriptor(jobDescriptor).withContainer(JobModel.newContainer(jobDescriptor.getContainer()).withImage(imageWithTag).build()).withDisruptionBudget(DisruptionBudgetGenerator.budget(DisruptionBudgetGenerator.perTaskRelocationLimitPolicy(3), DisruptionBudgetGenerator.hourlyRatePercentage(50), Collections.singletonList(DisruptionBudgetGenerator.officeHourTimeWindow()))).withExtensions(JobModel.newBatchJobExt(jobDescriptor.getExtensions()).withSize(1).withRetryPolicy(JobModel.newImmediateRetryPolicy().withRetries(0).build()).build()).withExtraContainers(jobDescriptor.getExtraContainers()).withPlatformSidecars(jobDescriptor.getPlatformSidecars()).build();
}
use of com.netflix.titus.api.jobmanager.model.job.Image in project titus-control-plane by Netflix.
the class JobDescriptorGenerator method oneTaskServiceJobDescriptor.
public static JobDescriptor<ServiceJobExt> oneTaskServiceJobDescriptor() {
JobDescriptor<ServiceJobExt> jobDescriptor = serviceJobDescriptors().getValue();
Image imageWithTag = JobModel.newImage().withName("titusops/alpine").withTag("latest").build();
return JobModel.newJobDescriptor(jobDescriptor).withContainer(JobModel.newContainer(jobDescriptor.getContainer()).withImage(imageWithTag).build()).withDisruptionBudget(DisruptionBudgetGenerator.budget(DisruptionBudgetGenerator.perTaskRelocationLimitPolicy(3), DisruptionBudgetGenerator.hourlyRatePercentage(50), Collections.singletonList(DisruptionBudgetGenerator.officeHourTimeWindow()))).withExtensions(JobModel.newServiceJobExt(jobDescriptor.getExtensions()).withCapacity(Capacity.newBuilder().withMin(0).withDesired(1).withMax(2).build()).withRetryPolicy(JobModel.newImmediateRetryPolicy().withRetries(0).build()).withMigrationPolicy(JobModel.newSystemDefaultMigrationPolicy().build()).withEnabled(true).withServiceJobProcesses(ServiceJobProcesses.newBuilder().build()).build()).build();
}
use of com.netflix.titus.api.jobmanager.model.job.Image in project titus-control-plane by Netflix.
the class JobAssertionsTest method testImageDigestValidation.
@Test
public void testImageDigestValidation() {
Image image = Image.newBuilder().withName("imageName").withDigest("sha256:abcdef0123456789abcdef0123456789abcdef0123456789").build();
Map<String, String> violations = jobAssertions.validateImage(image);
assertThat(violations).isEmpty();
}
use of com.netflix.titus.api.jobmanager.model.job.Image in project titus-control-plane by Netflix.
the class JobAssertionsTest method testInvalidDigestValidation.
@Test
public void testInvalidDigestValidation() {
Image image = Image.newBuilder().withName("imageName").withDigest("sha256:XYZ").build();
Map<String, String> violations = jobAssertions.validateImage(image);
assertThat(violations).hasSize(1);
}
use of com.netflix.titus.api.jobmanager.model.job.Image in project titus-control-plane by Netflix.
the class JobImageSanitizerTest method testJobWithDigestExists.
@Test
public void testJobWithDigestExists() {
Image image = jobDescriptorWithDigest.getContainer().getImage();
when(registryClient.getImageDigest(image.getName(), image.getDigest())).thenReturn(Mono.just(digest));
StepVerifier.create(sanitizer.sanitize(jobDescriptorWithDigest)).expectNextCount(// nothing to do when digest is valid
0).verifyComplete();
}
Aggregations