mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(ec2): include r5.large in the instance type catalog (#7146)
* fix(ec2): include r5.large in the instance type catalog Promote the complete retained fork #234 catalog entry and SDK regression on current main. Keep catalog metadata and offerings consistent. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> * test(ec2): use JUnit and Hamcrest for R5 catalog assertions Preserve all 18 metadata and offering assertions while following the src/test assertion conventions requested in review. Signed-off-by: Andre Kurait <AndreKurait@gmail.com> --------- Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
1 parent
42d5793d3b
commit
f77d032818
5 files changed
+129
No files matched your search
@@ -0,0 +1,48 @@
|
||||
package com.floci.test;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import software.amazon.awssdk.services.ec2.Ec2Client;
|
||||
import software.amazon.awssdk.services.ec2.model.InstanceType;
|
||||
import software.amazon.awssdk.services.ec2.model.LocationType;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class Ec2R5CatalogTest {
|
||||
|
||||
@Test
|
||||
void r5LargeMetadataAndAvailabilityZoneOfferingsAgree() {
|
||||
try (Ec2Client ec2 = TestFixtures.ec2Client()) {
|
||||
assertThat(ec2.describeInstanceTypes(r -> r.instanceTypes(InstanceType.R5_LARGE))
|
||||
.instanceTypes()).singleElement().satisfies(type -> {
|
||||
assertThat(type.instanceType()).isEqualTo(InstanceType.R5_LARGE);
|
||||
assertThat(type.vCpuInfo().defaultVCpus()).isEqualTo(2);
|
||||
assertThat(type.memoryInfo().sizeInMiB()).isEqualTo(16384L);
|
||||
assertThat(type.processorInfo().supportedArchitecturesAsStrings())
|
||||
.containsExactly("x86_64");
|
||||
assertThat(type.instanceStorageSupported()).isFalse();
|
||||
assertThat(type.burstablePerformanceSupported()).isFalse();
|
||||
assertThat(type.supportedUsageClassesAsStrings())
|
||||
.containsExactlyInAnyOrder("on-demand", "spot");
|
||||
assertThat(type.networkInfo().encryptionInTransitSupported()).isFalse();
|
||||
assertThat(type.networkInfo().defaultNetworkCardIndex()).isZero();
|
||||
assertThat(type.networkInfo().ipv4AddressesPerInterface()).isEqualTo(10);
|
||||
assertThat(type.networkInfo().networkCards()).singleElement().satisfies(card -> {
|
||||
assertThat(card.networkCardIndex()).isZero();
|
||||
assertThat(card.maximumNetworkInterfaces()).isEqualTo(3);
|
||||
});
|
||||
});
|
||||
|
||||
String zone = ec2.describeAvailabilityZones().availabilityZones().get(0).zoneName();
|
||||
assertThat(ec2.describeInstanceTypeOfferings(r -> r
|
||||
.locationType(LocationType.AVAILABILITY_ZONE)
|
||||
.filters(
|
||||
f -> f.name("instance-type").values("r5.large"),
|
||||
f -> f.name("location").values(zone)))
|
||||
.instanceTypeOfferings()).singleElement().satisfies(offering -> {
|
||||
assertThat(offering.instanceType()).isEqualTo(InstanceType.R5_LARGE);
|
||||
assertThat(offering.locationType()).isEqualTo(LocationType.AVAILABILITY_ZONE);
|
||||
assertThat(offering.location()).isEqualTo(zone);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,11 @@ By default, Docker containers launched for EC2 instances are bounded to the CPU
|
||||
- **Types outside the full catalog**: Docker CPU and memory limits are not applied when the full catalog lacks a type. When opted in, Standard On-Demand admission requires a known default vCPU count, as described below.
|
||||
- **Configuration knob**: To disable container resource limits (for example, running a large instance type on a developer machine with limited resources), set `floci.services.ec2.instance-resource-limits: false` (or environment variable `FLOCI_SERVICES_EC2_INSTANCE_RESOURCE_LIMITS=false`).
|
||||
|
||||
The full catalog includes `r5.large` with 2 vCPUs, 16 GiB of memory, x86_64 processors,
|
||||
EBS-only storage, and one network card supporting 3 interfaces and 10 IPv4 addresses per
|
||||
interface, following the [AWS R5 specifications](https://docs.aws.amazon.com/ec2/latest/instancetypes/mo.html).
|
||||
`DescribeInstanceTypes` and `DescribeInstanceTypeOfferings` use this same entry.
|
||||
|
||||
## Standard On-Demand admission
|
||||
|
||||
Quota admission is opt-in. Set `FLOCI_SERVICES_EC2_ENFORCE_VCPU_QUOTAS=true` to
|
||||
|
||||
@@ -172,6 +172,19 @@ instanceTypes:
|
||||
- networkCardIndex: 0
|
||||
maximumNetworkInterfaces: 3
|
||||
|
||||
- instanceType: r5.large
|
||||
vcpu: 2
|
||||
memoryMib: 16384
|
||||
supportedArchitectures:
|
||||
- x86_64
|
||||
currentGeneration: true
|
||||
encryptionInTransitSupported: false
|
||||
defaultNetworkCardIndex: 0
|
||||
ipv4AddressesPerInterface: 10
|
||||
networkCards:
|
||||
- networkCardIndex: 0
|
||||
maximumNetworkInterfaces: 3
|
||||
|
||||
- instanceType: t4g.micro
|
||||
vcpu: 2
|
||||
memoryMib: 1024
|
||||
|
||||
@@ -41,6 +41,7 @@ class Ec2InstanceTypeCatalogTest {
|
||||
"t3.medium",
|
||||
"t3a.nano",
|
||||
"m5.large",
|
||||
"r5.large",
|
||||
"t4g.micro",
|
||||
"t4g.small",
|
||||
"t4g.medium",
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package io.github.hectorvent.floci.services.ec2;
|
||||
|
||||
import io.github.hectorvent.floci.testing.AwsTestClients;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.ec2.Ec2Client;
|
||||
import software.amazon.awssdk.services.ec2.model.InstanceType;
|
||||
import software.amazon.awssdk.services.ec2.model.InstanceTypeInfo;
|
||||
import software.amazon.awssdk.services.ec2.model.InstanceTypeOffering;
|
||||
import software.amazon.awssdk.services.ec2.model.LocationType;
|
||||
import software.amazon.awssdk.services.ec2.model.NetworkCardInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
|
||||
@QuarkusTest
|
||||
class Ec2R5CatalogIntegrationTest {
|
||||
|
||||
@Test
|
||||
void r5LargeMetadataAndAvailabilityZoneOfferingsAgree() {
|
||||
try (Ec2Client ec2 = AwsTestClients.create(Ec2Client.builder(), "test", Region.US_EAST_1)) {
|
||||
List<InstanceTypeInfo> types = ec2.describeInstanceTypes(r -> r.instanceTypes(InstanceType.R5_LARGE))
|
||||
.instanceTypes();
|
||||
assertThat(types, hasSize(1));
|
||||
InstanceTypeInfo type = types.getFirst();
|
||||
assertEquals(InstanceType.R5_LARGE, type.instanceType());
|
||||
assertEquals(2, type.vCpuInfo().defaultVCpus());
|
||||
assertEquals(16384L, type.memoryInfo().sizeInMiB());
|
||||
assertThat(type.processorInfo().supportedArchitecturesAsStrings(), contains("x86_64"));
|
||||
assertFalse(type.instanceStorageSupported());
|
||||
assertFalse(type.burstablePerformanceSupported());
|
||||
assertThat(type.supportedUsageClassesAsStrings(), containsInAnyOrder("on-demand", "spot"));
|
||||
assertFalse(type.networkInfo().encryptionInTransitSupported());
|
||||
assertEquals(0, type.networkInfo().defaultNetworkCardIndex());
|
||||
assertEquals(10, type.networkInfo().ipv4AddressesPerInterface());
|
||||
assertThat(type.networkInfo().networkCards(), hasSize(1));
|
||||
NetworkCardInfo card = type.networkInfo().networkCards().getFirst();
|
||||
assertEquals(0, card.networkCardIndex());
|
||||
assertEquals(3, card.maximumNetworkInterfaces());
|
||||
|
||||
String zone = ec2.describeAvailabilityZones().availabilityZones().get(0).zoneName();
|
||||
List<InstanceTypeOffering> offerings = ec2.describeInstanceTypeOfferings(r -> r
|
||||
.locationType(LocationType.AVAILABILITY_ZONE)
|
||||
.filters(
|
||||
f -> f.name("instance-type").values("r5.large"),
|
||||
f -> f.name("location").values(zone)))
|
||||
.instanceTypeOfferings();
|
||||
assertThat(offerings, hasSize(1));
|
||||
InstanceTypeOffering offering = offerings.getFirst();
|
||||
assertEquals(InstanceType.R5_LARGE, offering.instanceType());
|
||||
assertEquals(LocationType.AVAILABILITY_ZONE, offering.locationType());
|
||||
assertEquals(zone, offering.location());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user