use of com.netflix.titus.api.jobmanager.model.job.vpc.IpAddressAllocation in project titus-control-plane by Netflix.
the class JobAssertions method validateMatchingEbsAndIpZones.
public static Set<ValidationError> validateMatchingEbsAndIpZones(List<EbsVolume> ebsVolumes, List<SignedIpAddressAllocation> ipSignedAddressAllocations) {
if (ebsVolumes == null || ipSignedAddressAllocations == null) {
return Collections.emptySet();
}
if (ebsVolumes.isEmpty() || ipSignedAddressAllocations.isEmpty()) {
return Collections.emptySet();
}
int numElements = Math.min(ebsVolumes.size(), ipSignedAddressAllocations.size());
for (int i = 0; i < numElements; i++) {
EbsVolume ebsVolume = ebsVolumes.get(i);
IpAddressAllocation ipAddressAllocation = ipSignedAddressAllocations.get(i).getIpAddressAllocation();
if (!ebsVolume.getVolumeAvailabilityZone().equals(ipAddressAllocation.getIpAddressLocation().getAvailabilityZone())) {
return Collections.singleton(new ValidationError("containerResources.ebsVolumes", String.format("EBS volume %s zone %s conflicts with Static IP %s zone %s and index %d", ebsVolume.getVolumeId(), ebsVolume.getVolumeAvailabilityZone(), ipAddressAllocation.getAllocationId(), ipAddressAllocation.getIpAddressLocation().getAvailabilityZone(), i)));
}
}
return Collections.emptySet();
}
Aggregations