summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2019-09-13 16:02:58 +0200
committerValerij Fredriksen <valerijf@verizonmedia.com>2019-09-13 16:02:58 +0200
commit6ea1a895c249153132a24b00e50785ccdbe78b6e (patch)
tree16d781b48c70c6dd317236b9b5be2d22ebb8d072
parent731d4fe97b56d6a0ad2f37e19c2d97b366072d47 (diff)
Simplify
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java22
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java13
-rw-r--r--controller-server/src/test/resources/test_runner_services.xml-aws64
-rw-r--r--controller-server/src/test/resources/test_runner_services.xml-cd2
4 files changed, 14 insertions, 87 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
index 9619c6f3757..697f8c9ec62 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
@@ -104,6 +104,10 @@ import static java.util.logging.Level.WARNING;
public class InternalStepRunner implements StepRunner {
private static final Logger logger = Logger.getLogger(InternalStepRunner.class.getName());
+ private static final NodeResources DEFAULT_TESTER_RESOURCES = new NodeResources(0.5, 4, 50, 0.3);
+ // Must match exactly the advertised resources of an AWS instance type. Also consider that the container
+ // will have ~1.8 GB less memory than equivalent resources in AWS (VESPA-16259).
+ private static final NodeResources DEFAULT_TESTER_RESOURCES_AWS = new NodeResources(2, 8, 50, 0.3);
static final Duration endpointTimeout = Duration.ofMinutes(15);
static final Duration installationTimeout = Duration.ofMinutes(150);
@@ -636,14 +640,15 @@ public class InternalStepRunner implements StepRunner {
DeploymentSpec spec = controller.applications().require(id.application()).deploymentSpec();
ZoneId zone = id.type().zone(controller.system());
- boolean useAdvertisedResources = zone.region().value().contains("aws-");
boolean useTesterCertificate = controller.system().isPublic() && id.type().isTest();
byte[] servicesXml = servicesXml(controller.zoneRegistry().accessControlDomain(),
! controller.system().isPublic(),
- useAdvertisedResources,
useTesterCertificate,
- testerFlavorFor(id, spec));
+ testerFlavorFor(id, spec)
+ .map(NodeResources::fromLegacyName)
+ .orElse(zone.region().value().contains("aws-") ?
+ DEFAULT_TESTER_RESOURCES_AWS : DEFAULT_TESTER_RESOURCES));
byte[] testPackage = controller.applications().applicationStore().get(id.tester(), version);
byte[] deploymentXml = deploymentXml(spec.athenzDomain(), spec.athenzService(zone.environment(), zone.region()));
@@ -691,18 +696,13 @@ public class InternalStepRunner implements StepRunner {
}
/** Returns the generated services.xml content for the tester application. */
- static byte[] servicesXml(AthenzDomain domain, boolean useAthenzCredentials, boolean useAdvertisedResources,
- boolean useTesterCertificate, Optional<String> testerFlavor) {
- NodeResources resources = testerFlavor.map(NodeResources::fromLegacyName)
- .orElseGet(() -> new NodeResources(0.5, useAdvertisedResources ? 8 : 4, 50, 0.3));
+ static byte[] servicesXml(AthenzDomain domain, boolean useAthenzCredentials, boolean useTesterCertificate,
+ NodeResources resources) {
int jdiscMemoryGb = 2; // 2Gb memory for tester application (excessive?).
int jdiscMemoryPct = (int) Math.ceil(100 * jdiscMemoryGb / resources.memoryGb());
// Of the remaining memory, split 50/50 between Surefire running the tests and the rest
- // Nodes in AWS have less memory than they claim, see VESPA-16259 (~1.1 Gb to host level processes and ~700 Mb
- // is the difference between advertised vs. actual instance memory in AWS).
- double availableMemoryGb = resources.memoryGb() - (useAdvertisedResources ? 1.8 : 0);
- int testMemoryMb = (int) (1024 * (availableMemoryGb - jdiscMemoryGb) / 2);
+ int testMemoryMb = (int) (1024 * (resources.memoryGb() - jdiscMemoryGb) / 2);
String resourceString = String.format(Locale.ENGLISH,
"<resources vcpu=\"%.2f\" memory=\"%.2f\" disk=\"%.2f\"/>", resources.vcpu(), resources.memoryGb(), resources.diskGb());
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
index edf1948a256..fb850b1b321 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunnerTest.java
@@ -6,6 +6,7 @@ import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.provision.AthenzDomain;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.HostName;
+import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.slime.ArrayTraverser;
@@ -439,17 +440,7 @@ public class InternalStepRunnerTest {
assertFile("test_runner_services.xml-cd", new String(InternalStepRunner.servicesXml(AthenzDomain.from("vespa.vespa.cd"),
true,
false,
- false,
- Optional.of("d-2-12-75"))));
- }
-
- @Test
- public void generates_correct_services_xml_in_aws() {
- assertFile("test_runner_services.xml-aws", new String(InternalStepRunner.servicesXml(AthenzDomain.from("vespa.vespa.cd"),
- true,
- true,
- false,
- Optional.empty())));
+ new NodeResources(2, 12, 75, 1))));
}
private void assertFile(String resourceName, String actualContent) {
diff --git a/controller-server/src/test/resources/test_runner_services.xml-aws b/controller-server/src/test/resources/test_runner_services.xml-aws
deleted file mode 100644
index ded306d69ce..00000000000
--- a/controller-server/src/test/resources/test_runner_services.xml-aws
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<services xmlns:deploy='vespa' version='1.0'>
- <container version='1.0' id='tester'>
-
- <component id="com.yahoo.vespa.hosted.testrunner.TestRunner" bundle="vespa-testrunner-components">
- <config name="com.yahoo.vespa.hosted.testrunner.test-runner">
- <artifactsPath>artifacts</artifactsPath>
- <surefireMemoryMb>2150</surefireMemoryMb>
- <useAthenzCredentials>true</useAthenzCredentials>
- <useTesterCertificate>false</useTesterCertificate>
- </config>
- </component>
-
- <handler id="com.yahoo.vespa.hosted.testrunner.TestRunnerHandler" bundle="vespa-testrunner-components">
- <binding>http://*/tester/v1/*</binding>
- </handler>
-
- <http>
- <!-- Make sure 4080 is the first port. This will be used by the config server. -->
- <server id='default' port='4080'/>
- <server id='testertls4443' port='4443'>
- <config name="jdisc.http.connector">
- <tlsClientAuthEnforcer>
- <enable>true</enable>
- <pathWhitelist>
- <item>/status.html</item>
- <item>/state/v1/config</item>
- </pathWhitelist>
- </tlsClientAuthEnforcer>
- </config>
- <ssl>
- <private-key-file>/var/lib/sia/keys/vespa.vespa.tenant.key.pem</private-key-file>
- <certificate-file>/var/lib/sia/certs/vespa.vespa.tenant.cert.pem</certificate-file>
- <client-authentication>want</client-authentication>
- </ssl>
- </server>
- <filtering>
- <access-control domain='vespa.vespa.cd'>
- <exclude>
- <binding>http://*/tester/v1/*</binding>
- </exclude>
- </access-control>
- <request-chain id="testrunner-api">
- <filter id='authz-filter' class='com.yahoo.jdisc.http.filter.security.athenz.AthenzAuthorizationFilter' bundle="jdisc-security-filters">
- <config name="jdisc.http.filter.security.athenz.athenz-authorization-filter">
- <credentialsToVerify>TOKEN_ONLY</credentialsToVerify>
- <roleTokenHeaderName>Yahoo-Role-Auth</roleTokenHeaderName>
- </config>
- <component id="com.yahoo.jdisc.http.filter.security.athenz.StaticRequestResourceMapper" bundle="jdisc-security-filters">
- <config name="jdisc.http.filter.security.athenz.static-request-resource-mapper">
- <resourceName>vespa.vespa.cd:tester-application</resourceName>
- <action>deploy</action>
- </config>
- </component>
- </filter>
- </request-chain>
- </filtering>
- </http>
-
- <nodes count="1" allocated-memory="25%">
- <resources vcpu="0.50" memory="8.00" disk="50.00"/>
- </nodes>
- </container>
-</services>
diff --git a/controller-server/src/test/resources/test_runner_services.xml-cd b/controller-server/src/test/resources/test_runner_services.xml-cd
index 1e89225be0c..3f35cd1d03b 100644
--- a/controller-server/src/test/resources/test_runner_services.xml-cd
+++ b/controller-server/src/test/resources/test_runner_services.xml-cd
@@ -58,7 +58,7 @@
</http>
<nodes count="1" allocated-memory="17%">
- <resources vcpu="2.30" memory="12.00" disk="75.00"/>
+ <resources vcpu="2.00" memory="12.00" disk="75.00"/>
</nodes>
</container>
</services>