Skip to content

Commit

Permalink
Merge pull request #28038 from vespa-engine/freva/x86_for_tester_enclave
Browse files Browse the repository at this point in the history
Use x86_64 for tester nodes in enclave
  • Loading branch information
jonmv authored Aug 14, 2023
2 parents e9840e4 + ddc6ee8 commit 25a4b1f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public TestPackage(Supplier<InputStream> inZip, boolean isPublicSystem, CloudNam
keyPair = null;
this.certificate = null;
}
boolean isEnclave = isPublicSystem &&
!spec.cloudAccount(cloud, id.application().instance(), id.type().zone()).isUnspecified();
this.applicationPackageStream = new ApplicationPackageStream(inZip, () -> name -> name.endsWith(".xml"), () -> new Replacer() {

// Initially skips all declared entries, ensuring they're generated and appended after all input entries.
Expand Down Expand Up @@ -127,7 +129,7 @@ public InputStream modify(String name, InputStream in) {
__ -> new ByteArrayInputStream(servicesXml( ! isPublicSystem,
certificateValidFrom != null,
hasLegacyTests,
testerResourcesFor(id.type().zone(), spec.requireInstance(id.application().instance())),
testerResourcesFor(id.type().zone(), spec.requireInstance(id.application().instance()), isEnclave),
testerApp)));

entries.put(deploymentFile,
Expand Down Expand Up @@ -225,14 +227,15 @@ else if (expectedSuites.contains(staging) && ! suites.contains(staging))
return new TestSummary(problems, suites);
}

static NodeResources testerResourcesFor(ZoneId zone, DeploymentInstanceSpec spec) {
static NodeResources testerResourcesFor(ZoneId zone, DeploymentInstanceSpec spec, boolean isEnclave) {
NodeResources nodeResources = spec.steps().stream()
.filter(step -> step.concerns(zone.environment()))
.findFirst()
.flatMap(step -> step.zones().get(0).testerFlavor())
.map(NodeResources::fromLegacyName)
.orElse(zone.region().value().matches("^(aws|gcp)-.*") ? DEFAULT_TESTER_RESOURCES_CLOUD
: DEFAULT_TESTER_RESOURCES);
if (isEnclave) nodeResources = nodeResources.with(NodeResources.Architecture.x86_64);
return nodeResources.with(NodeResources.DiskSpeed.any);
}

Expand All @@ -245,8 +248,8 @@ static byte[] servicesXml(boolean systemUsesAthenz, boolean useTesterCertificate
// Of the remaining memory, split 50/50 between Surefire running the tests and the rest
int testMemoryMb = (int) (1024 * (resources.memoryGb() - jdiscMemoryGb) / 2);

String resourceString = Text.format("<resources vcpu=\"%.2f\" memory=\"%.2fGb\" disk=\"%.2fGb\" disk-speed=\"%s\" storage-type=\"%s\"/>",
resources.vcpu(), resources.memoryGb(), resources.diskGb(), resources.diskSpeed().name(), resources.storageType().name());
String resourceString = Text.format("<resources vcpu=\"%.2f\" memory=\"%.2fGb\" disk=\"%.2fGb\" disk-speed=\"%s\" storage-type=\"%s\" architecture=\"%s\"/>",
resources.vcpu(), resources.memoryGb(), resources.diskGb(), resources.diskSpeed().name(), resources.storageType().name(), resources.architecture().name());

String runtimeProviderClass = config.runtimeProviderClass();
String tenantCdBundle = config.tenantCdBundle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ void generates_correct_tester_flavor() {
</deployment>
""");

NodeResources firstResources = TestPackage.testerResourcesFor(ZoneId.from("prod", "gcp-us-west-1"), spec.requireInstance("first"));
assertEquals(TestPackage.DEFAULT_TESTER_RESOURCES_CLOUD, firstResources);
NodeResources firstResources = TestPackage.testerResourcesFor(ZoneId.from("prod", "gcp-us-west-1"), spec.requireInstance("first"), true);
assertEquals(TestPackage.DEFAULT_TESTER_RESOURCES_CLOUD.with(NodeResources.Architecture.x86_64), firstResources);

NodeResources secondResources = TestPackage.testerResourcesFor(ZoneId.from("prod", "us-west-1"), spec.requireInstance("second"));
NodeResources secondResources = TestPackage.testerResourcesFor(ZoneId.from("prod", "us-west-1"), spec.requireInstance("second"), false);
assertEquals(6, secondResources.vcpu(), 1e-9);
assertEquals(16, secondResources.memoryGb(), 1e-9);
assertEquals(100, secondResources.diskGb(), 1e-9);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</component>

<nodes count="1">
<resources vcpu="2.00" memory="12.00Gb" disk="75.00Gb" disk-speed="fast" storage-type="local"/>
<resources vcpu="2.00" memory="12.00Gb" disk="75.00Gb" disk-speed="fast" storage-type="local" architecture="any"/>
</nodes>
</container>
</services>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<nodes count="1">
<jvm allocated-memory="17%"/>
<resources vcpu="2.00" memory="12.00Gb" disk="75.00Gb" disk-speed="fast" storage-type="local"/>
<resources vcpu="2.00" memory="12.00Gb" disk="75.00Gb" disk-speed="fast" storage-type="local" architecture="any"/>
</nodes>
</container>
</services>

0 comments on commit 25a4b1f

Please sign in to comment.