diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-03-05 10:59:29 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-03-05 11:07:48 +0100 |
commit | 21ffbf56b2d6ef21c55641d5fc41460f8a2e6d47 (patch) | |
tree | 0312af5280b11e8594dce2d879506e4d857df2f3 /controller-server | |
parent | 854ae50b97510c55df0ada623038f5048a50aaaf (diff) |
Remove "endpoints" from test-config responses
Diffstat (limited to 'controller-server')
7 files changed, 26 insertions, 41 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 059e65fc829..6bfbaf24775 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 @@ -11,7 +11,9 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.AthenzDomain; import com.yahoo.config.provision.AthenzService; import com.yahoo.config.provision.ClusterSpec; +import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.NodeResources; +import com.yahoo.config.provision.zone.RoutingMethod; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.log.LogLevel; import com.yahoo.security.KeyAlgorithm; @@ -39,9 +41,11 @@ import com.yahoo.vespa.hosted.controller.api.integration.organization.Deployment import com.yahoo.vespa.hosted.controller.api.integration.organization.Mail; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.Deployment; +import com.yahoo.vespa.hosted.controller.application.Endpoint; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; import com.yahoo.vespa.hosted.controller.certificate.EndpointCertificateException; import com.yahoo.vespa.hosted.controller.maintenance.JobRunner; +import com.yahoo.vespa.hosted.controller.routing.RoutingPolicyId; import com.yahoo.yolean.Exceptions; import javax.security.auth.x500.X500Principal; @@ -440,9 +444,9 @@ public class InternalStepRunner implements StepRunner { if ( ! endpoints.containsKey(zoneId)) return false; - for (var endpoint : endpoints.get(zoneId).keySet()) { - boolean ready = controller.jobController().cloud().ready(endpoint); - if (!ready) { + for (var endpoint : endpoints.get(zoneId)) { + boolean ready = controller.jobController().cloud().ready(endpoint.url()); + if ( ! ready) { logger.log("Failed to get 100 consecutive OKs from " + endpoint); return false; } @@ -478,12 +482,13 @@ public class InternalStepRunner implements StepRunner { return true; } - private void logEndpoints(Map<ZoneId, Map<URI, ClusterSpec.Id>> endpoints, DualLogger logger) { + private void logEndpoints(Map<ZoneId, List<Endpoint>> zoneEndpoints, DualLogger logger) { List<String> messages = new ArrayList<>(); messages.add("Found endpoints:"); - endpoints.forEach((zone, urls) -> { + zoneEndpoints.forEach((zone, endpoints) -> { messages.add("- " + zone); - urls.forEach((url, cluster) -> messages.add(" |-- " + url + " (" + cluster + ")")); + for (Endpoint endpoint : endpoints) + messages.add(" |-- " + endpoint.url() + " (cluster '" + endpoint.name() + "')"); }); logger.log(messages); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java index 945ffa529ba..c35d4f817bc 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializer.java @@ -9,6 +9,7 @@ import com.yahoo.slime.Cursor; import com.yahoo.slime.Slime; import com.yahoo.slime.SlimeUtils; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.Endpoint; import java.io.IOException; import java.io.UncheckedIOException; @@ -32,7 +33,7 @@ public class TestConfigSerializer { public Slime configSlime(ApplicationId id, JobType type, boolean isCI, - Map<ZoneId, Map<URI, ClusterSpec.Id>> deployments, + Map<ZoneId, List<Endpoint>> deployments, Map<ZoneId, List<String>> clusters) { Slime slime = new Slime(); Cursor root = slime.setObject(); @@ -42,19 +43,11 @@ public class TestConfigSerializer { root.setString("system", system.value()); root.setBool("isCI", isCI); - Cursor endpointsObject = root.setObject("endpoints"); // TODO jvenstad: remove. - deployments.forEach((zone, endpoints) -> { - Cursor endpointArray = endpointsObject.setArray(zone.value()); - for (URI endpoint : endpoints.keySet()) - endpointArray.addString(endpoint.toString()); - }); - Cursor zoneEndpointsObject = root.setObject("zoneEndpoints"); deployments.forEach((zone, endpoints) -> { Cursor clusterEndpointsObject = zoneEndpointsObject.setObject(zone.value()); - endpoints.forEach((endpoint, cluster) -> { - clusterEndpointsObject.setString(cluster.value(), endpoint.toString()); - }); + for (Endpoint endpoint : endpoints) + clusterEndpointsObject.setString(endpoint.name(), endpoint.url().toString()); }); if ( ! clusters.isEmpty()) { @@ -73,7 +66,7 @@ public class TestConfigSerializer { public byte[] configJson(ApplicationId id, JobType type, boolean isCI, - Map<ZoneId, Map<URI, ClusterSpec.Id>> deployments, + Map<ZoneId, List<Endpoint>> deployments, Map<ZoneId, List<String>> clusters) { try { return SlimeUtils.toJsonBytes(configSlime(id, type, isCI, deployments, clusters)); 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 2d3af73ec5b..fb0817f8320 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 @@ -315,8 +315,8 @@ public class InternalStepRunnerTest { assertEquals(app.instanceId().serializedForm(), configObject.field("application").asString()); assertEquals(testZone.value(), configObject.field("zone").asString()); assertEquals(system().value(), configObject.field("system").asString()); - assertEquals(1, configObject.field("endpoints").children()); - assertEquals(1, configObject.field("endpoints").field(testZone.value()).entries()); + assertEquals(1, configObject.field("zoneEndpoints").children()); + assertEquals(1, configObject.field("zoneEndpoints").field(testZone.value()).children()); long lastId = tester.jobs().details(id).get().lastId().getAsLong(); tester.cloud().add(new LogEntry(0, Instant.ofEpochMilli(123), info, "Ready!")); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java index 05330d306fe..6a12c4457db 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/TestConfigSerializerTest.java @@ -1,11 +1,14 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.deployment; +import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.slime.SlimeUtils; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; +import com.yahoo.vespa.hosted.controller.application.Endpoint; +import com.yahoo.vespa.hosted.controller.application.EndpointId; import org.junit.Test; import java.io.IOException; @@ -29,8 +32,10 @@ public class TestConfigSerializerTest { byte[] json = new TestConfigSerializer(SystemName.PublicCd).configJson(instanceId, JobType.systemTest, true, - Map.of(zone, Map.of(URI.create("https://server/"), - ClusterSpec.Id.from("ai"))), + Map.of(zone, List.of(Endpoint.of(ApplicationId.defaultId()) + .named(EndpointId.of("ai")) + .on(Endpoint.Port.tls()) + .in(SystemName.main))), Map.of(zone, List.of("facts"))); byte[] expected = Files.readAllBytes(Paths.get("src/test/resources/testConfig.json")); assertEquals(new String(SlimeUtils.toJsonBytes(SlimeUtils.jsonToSlime(expected))), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json index 0632ab7a67b..76454cf5d99 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config-dev.json @@ -3,14 +3,6 @@ "zone": "dev.us-east-1", "system": "main", "isCI": false, - "endpoints": { - "dev.us-east-1": [ - "https://my-user--application1--tenant1.us-east-1.dev.vespa.oath.cloud:4443/" - ], - "prod.us-central-1": [ - "https://application1--tenant1.us-central-1.vespa.oath.cloud:4443/" - ] - }, "zoneEndpoints": { "dev.us-east-1": { "default": "https://my-user--application1--tenant1.us-east-1.dev.vespa.oath.cloud:4443/" diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json index c81ed767239..542c7297bbd 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/test-config.json @@ -3,11 +3,6 @@ "zone": "prod.us-central-1", "system": "main", "isCI": false, - "endpoints": { - "prod.us-central-1": [ - "https://application1--tenant1.us-central-1.vespa.oath.cloud:4443/" - ] - }, "zoneEndpoints": { "prod.us-central-1": { "default": "https://application1--tenant1.us-central-1.vespa.oath.cloud:4443/" diff --git a/controller-server/src/test/resources/testConfig.json b/controller-server/src/test/resources/testConfig.json index 3b01f7f39ca..1c6290762d1 100644 --- a/controller-server/src/test/resources/testConfig.json +++ b/controller-server/src/test/resources/testConfig.json @@ -3,14 +3,9 @@ "zone": "test.aws-us-east-1c", "system": "publiccd", "isCI": true, - "endpoints": { - "test.aws-us-east-1c": [ - "https://server/" - ] - }, "zoneEndpoints": { "test.aws-us-east-1c": { - "ai": "https://server/" + "ai": "https://ai--default--default.global.vespa.oath.cloud/" } }, "clusters": { |