From 845cd04ccfdbf5a3ebc0bfb32badd63efc9b0f02 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Fri, 12 Jul 2019 14:08:36 +0200 Subject: Replace usages of RotationName with EndpointId --- .../hosted/controller/application/Endpoint.java | 17 ++----------- .../hosted/controller/application/EndpointId.java | 11 +++++++- .../hosted/controller/application/RoutingId.java | 17 ++++++------- .../controller/application/RoutingPolicy.java | 21 ++++++++-------- .../controller/maintenance/RoutingPolicies.java | 17 +++++++++---- .../persistence/RoutingPolicySerializer.java | 29 +++++++++++----------- .../controller/application/EndpointTest.java | 29 +++++++++++----------- .../maintenance/RoutingPoliciesTest.java | 2 +- .../persistence/RoutingPolicySerializerTest.java | 10 ++++---- .../restapi/application/ApplicationApiTest.java | 4 +-- 10 files changed, 78 insertions(+), 79 deletions(-) (limited to 'controller-server') diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java index 5dccd5c8120..4041c955cc4 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Endpoint.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.application; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; -import com.yahoo.config.provision.RotationName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.ZoneId; @@ -216,7 +215,6 @@ public class Endpoint { private ZoneId zone; private ClusterSpec.Id cluster; - private RotationName rotation; private EndpointId endpointId; private Port port; private boolean legacy = false; @@ -228,7 +226,7 @@ public class Endpoint { /** Sets the cluster and zone target of this */ public EndpointBuilder target(ClusterSpec.Id cluster, ZoneId zone) { - if (rotation != null || endpointId != null) { + if (endpointId != null) { throw new IllegalArgumentException("Cannot set multiple target types"); } this.cluster = cluster; @@ -236,18 +234,9 @@ public class Endpoint { return this; } - /** Sets the rotation target of this */ - public EndpointBuilder target(RotationName rotation) { - if ((cluster != null && zone != null) || endpointId != null) { - throw new IllegalArgumentException("Cannot set multiple target types"); - } - this.rotation = rotation; - return this; - } - /** Sets the endpoint ID as defines in deployments.xml */ public EndpointBuilder named(EndpointId endpointId) { - if (rotation != null || cluster != null || zone != null) { + if (cluster != null || zone != null) { throw new IllegalArgumentException("Cannot set multiple target types"); } this.endpointId = endpointId; @@ -277,8 +266,6 @@ public class Endpoint { String name; if (cluster != null && zone != null) { name = cluster.value(); - } else if (rotation != null) { - name = rotation.value(); } else if (endpointId != null) { name = endpointId.id(); } else { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointId.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointId.java index 13c242c7b5f..77b9e84be1e 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointId.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/EndpointId.java @@ -1,5 +1,7 @@ package com.yahoo.vespa.hosted.controller.application; +import org.jetbrains.annotations.NotNull; + import java.util.Objects; /** @@ -8,7 +10,8 @@ import java.util.Objects; * * @author ogronnesby */ -public class EndpointId { +public class EndpointId implements Comparable { + private static final EndpointId DEFAULT = new EndpointId("default"); private final String id; @@ -50,4 +53,10 @@ public class EndpointId { public static EndpointId default_() { return DEFAULT; } public static EndpointId of(String id) { return new EndpointId(id); } + + @Override + public int compareTo(@NotNull EndpointId o) { + return id.compareTo(o.id); + } + } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingId.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingId.java index c9378e27b61..7b0ec3d27ba 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingId.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingId.java @@ -2,31 +2,30 @@ package com.yahoo.vespa.hosted.controller.application; import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.RotationName; import java.util.Objects; /** - * Unique identifier for a global routing table entry (application x rotation name). + * Unique identifier for a global routing table entry (application x endpoint ID). * * @author mpolden */ public class RoutingId { private final ApplicationId application; - private final RotationName rotation; + private final EndpointId endpointId; - public RoutingId(ApplicationId application, RotationName rotation) { + public RoutingId(ApplicationId application, EndpointId endpointId) { this.application = Objects.requireNonNull(application, "application must be non-null"); - this.rotation = Objects.requireNonNull(rotation, "rotation must be non-null"); + this.endpointId = Objects.requireNonNull(endpointId, "endpointId must be non-null"); } public ApplicationId application() { return application; } - public RotationName rotation() { - return rotation; + public EndpointId endpointId() { + return endpointId; } @Override @@ -35,12 +34,12 @@ public class RoutingId { if (o == null || getClass() != o.getClass()) return false; RoutingId that = (RoutingId) o; return application.equals(that.application) && - rotation.equals(that.rotation); + endpointId.equals(that.endpointId); } @Override public int hashCode() { - return Objects.hash(application, rotation); + return Objects.hash(application, endpointId); } } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingPolicy.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingPolicy.java index e0145e6b94c..a86bbaa317e 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingPolicy.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/RoutingPolicy.java @@ -5,7 +5,6 @@ import com.google.common.collect.ImmutableSortedSet; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.HostName; -import com.yahoo.config.provision.RotationName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.Endpoint.Port; @@ -27,17 +26,17 @@ public class RoutingPolicy { private final ZoneId zone; private final HostName canonicalName; private final Optional dnsZone; - private final Set rotations; + private final Set endpoints; /** DO NOT USE. Public for serialization purposes */ public RoutingPolicy(ApplicationId owner, ClusterSpec.Id cluster, ZoneId zone, HostName canonicalName, - Optional dnsZone, Set rotations) { + Optional dnsZone, Set endpoints) { this.owner = Objects.requireNonNull(owner, "owner must be non-null"); this.cluster = Objects.requireNonNull(cluster, "cluster must be non-null"); this.zone = Objects.requireNonNull(zone, "zone must be non-null"); this.canonicalName = Objects.requireNonNull(canonicalName, "canonicalName must be non-null"); this.dnsZone = Objects.requireNonNull(dnsZone, "dnsZone must be non-null"); - this.rotations = ImmutableSortedSet.copyOf(Objects.requireNonNull(rotations, "rotations must be non-null")); + this.endpoints = ImmutableSortedSet.copyOf(Objects.requireNonNull(endpoints, "endpoints must be non-null")); } /** The application owning this */ @@ -65,9 +64,9 @@ public class RoutingPolicy { return dnsZone; } - /** The rotations in this policy */ - public Set rotations() { - return rotations; + /** The endpoints of this policy */ + public Set endpoints() { + return endpoints; } /** Returns the endpoint of this */ @@ -77,7 +76,7 @@ public class RoutingPolicy { /** Returns rotation endpoints of this */ public EndpointList rotationEndpointsIn(SystemName system) { - return EndpointList.of(rotations.stream().map(rotation -> endpointOf(owner, rotation, system))); + return EndpointList.of(endpoints.stream().map(endpointId -> endpointOf(owner, endpointId, system))); } @Override @@ -95,14 +94,14 @@ public class RoutingPolicy { @Override public String toString() { - return String.format("%s [rotations: %s%s], %s owned by %s, in %s", canonicalName, rotations, + return String.format("%s [rotations: %s%s], %s owned by %s, in %s", canonicalName, endpoints, dnsZone.map(z -> ", DNS zone: " + z).orElse(""), cluster, owner.toShortString(), zone.value()); } /** Returns the endpoint of given rotation */ - public static Endpoint endpointOf(ApplicationId application, RotationName rotation, SystemName system) { - return Endpoint.of(application).target(rotation).on(Port.tls()).directRouting().in(system); + public static Endpoint endpointOf(ApplicationId application, EndpointId endpointId, SystemName system) { + return Endpoint.of(application).named(endpointId).on(Port.tls()).directRouting().in(system); } } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPolicies.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPolicies.java index 4a98cb49227..d23ae913889 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPolicies.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPolicies.java @@ -2,6 +2,7 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.RotationName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.curator.Lock; import com.yahoo.vespa.hosted.controller.Controller; @@ -12,6 +13,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.dns.Record; import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordData; import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName; import com.yahoo.vespa.hosted.controller.application.Endpoint; +import com.yahoo.vespa.hosted.controller.application.EndpointId; import com.yahoo.vespa.hosted.controller.application.RoutingId; import com.yahoo.vespa.hosted.controller.application.RoutingPolicy; import com.yahoo.vespa.hosted.controller.dns.NameServiceQueue.Priority; @@ -89,7 +91,7 @@ public class RoutingPolicies { // Create DNS record for each routing ID for (Map.Entry> routeEntry : routingTable.entrySet()) { - Endpoint endpoint = RoutingPolicy.endpointOf(routeEntry.getKey().application(), routeEntry.getKey().rotation(), + Endpoint endpoint = RoutingPolicy.endpointOf(routeEntry.getKey().application(), routeEntry.getKey().endpointId(), controller.system()); Set targets = routeEntry.getValue() .stream() @@ -117,9 +119,14 @@ public class RoutingPolicies { /** Create a policy for given load balancer and register a CNAME for it */ private RoutingPolicy createPolicy(ApplicationId application, ZoneId zone, LoadBalancer loadBalancer) { + // TODO(mpolden): Remove rotations from LoadBalancer. Use endpoints from deployment spec instead + Set endpoints = loadBalancer.rotations().stream() + .map(RotationName::value) + .map(EndpointId::of) + .collect(Collectors.toSet()); RoutingPolicy routingPolicy = new RoutingPolicy(application, loadBalancer.cluster(), zone, loadBalancer.hostname(), loadBalancer.dnsZone(), - loadBalancer.rotations()); + endpoints); RecordName name = RecordName.from(routingPolicy.endpointIn(controller.system()).dnsName()); RecordData data = RecordData.fqdn(loadBalancer.hostname().value()); controller.nameServiceForwarder().createCname(name, data, Priority.normal); @@ -151,7 +158,7 @@ public class RoutingPolicies { var activeRoutingIds = routingIdsFrom(loadBalancers.list); removalCandidates.removeAll(activeRoutingIds); for (var id : removalCandidates) { - Endpoint endpoint = RoutingPolicy.endpointOf(id.application(), id.rotation(), controller.system()); + Endpoint endpoint = RoutingPolicy.endpointOf(id.application(), id.endpointId(), controller.system()); controller.nameServiceForwarder().removeRecords(Record.Type.ALIAS, RecordName.from(endpoint.dnsName()), Priority.normal); } } @@ -161,7 +168,7 @@ public class RoutingPolicies { Set routingIds = new LinkedHashSet<>(); for (var loadBalancer : loadBalancers) { for (var rotation : loadBalancer.rotations()) { - routingIds.add(new RoutingId(loadBalancer.application(), rotation)); + routingIds.add(new RoutingId(loadBalancer.application(), EndpointId.of(rotation.value()))); } } return Collections.unmodifiableSet(routingIds); @@ -171,7 +178,7 @@ public class RoutingPolicies { private static Map> routingTableFrom(Set routingPolicies) { var routingTable = new LinkedHashMap>(); for (var policy : routingPolicies) { - for (var rotation : policy.rotations()) { + for (var rotation : policy.endpoints()) { var id = new RoutingId(policy.owner(), rotation); routingTable.putIfAbsent(id, new ArrayList<>()); routingTable.get(id).add(policy); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializer.java index 9cfce8dc16a..80858e713c2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializer.java @@ -4,11 +4,10 @@ package com.yahoo.vespa.hosted.controller.persistence; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.HostName; -import com.yahoo.config.provision.RotationName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.slime.ArrayTraverser; -import com.yahoo.slime.Cursor; import com.yahoo.slime.Slime; +import com.yahoo.vespa.hosted.controller.application.EndpointId; import com.yahoo.vespa.hosted.controller.application.RoutingPolicy; import java.util.Collections; @@ -39,36 +38,36 @@ public class RoutingPolicySerializer { private static final String rotationsField = "rotations"; public Slime toSlime(Set routingPolicies) { - Slime slime = new Slime(); - Cursor root = slime.setObject(); - Cursor policyArray = root.setArray(routingPoliciesField); + var slime = new Slime(); + var root = slime.setObject(); + var policyArray = root.setArray(routingPoliciesField); routingPolicies.forEach(policy -> { - Cursor policyObject = policyArray.addObject(); + var policyObject = policyArray.addObject(); policyObject.setString(clusterField, policy.cluster().value()); policyObject.setString(zoneField, policy.zone().value()); policyObject.setString(canonicalNameField, policy.canonicalName().value()); policy.dnsZone().ifPresent(dnsZone -> policyObject.setString(dnsZoneField, dnsZone)); - Cursor rotationArray = policyObject.setArray(rotationsField); - policy.rotations().forEach(rotation -> { - rotationArray.addString(rotation.value()); + var rotationArray = policyObject.setArray(rotationsField); + policy.endpoints().forEach(endpointId -> { + rotationArray.addString(endpointId.id()); }); }); return slime; } public Set fromSlime(ApplicationId owner, Slime slime) { - Set policies = new LinkedHashSet<>(); - Cursor root = slime.get(); - Cursor field = root.field(routingPoliciesField); + var policies = new LinkedHashSet(); + var root = slime.get(); + var field = root.field(routingPoliciesField); field.traverse((ArrayTraverser) (i, inspect) -> { - Set rotations = new LinkedHashSet<>(); - inspect.field(rotationsField).traverse((ArrayTraverser) (j, rotation) -> rotations.add(RotationName.from(rotation.asString()))); + var endpointIds = new LinkedHashSet(); + inspect.field(rotationsField).traverse((ArrayTraverser) (j, endpointId) -> endpointIds.add(EndpointId.of(endpointId.asString()))); policies.add(new RoutingPolicy(owner, ClusterSpec.Id.from(inspect.field(clusterField).asString()), ZoneId.from(inspect.field(zoneField).asString()), HostName.from(inspect.field(canonicalNameField).asString()), Serializers.optionalField(inspect.field(dnsZoneField), Function.identity()), - rotations)); + endpointIds)); }); return Collections.unmodifiableSet(policies); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java index f5047a82e2f..bf798d2f004 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/application/EndpointTest.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.application; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; -import com.yahoo.config.provision.RotationName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.application.Endpoint.Port; @@ -23,51 +22,51 @@ public class EndpointTest { @Test public void test_global_endpoints() { - RotationName rotation = RotationName.from("default"); // Always default for non-direct routing + EndpointId endpointId = EndpointId.default_(); Map tests = Map.of( // Legacy endpoint "http://a1.t1.global.vespa.yahooapis.com:4080/", - Endpoint.of(app1).target(rotation).on(Port.plain(4080)).legacy().in(SystemName.main), + Endpoint.of(app1).named(endpointId).on(Port.plain(4080)).legacy().in(SystemName.main), // Legacy endpoint with TLS "https://a1--t1.global.vespa.yahooapis.com:4443/", - Endpoint.of(app1).target(rotation).on(Port.tls(4443)).legacy().in(SystemName.main), + Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).legacy().in(SystemName.main), // Main endpoint "https://a1--t1.global.vespa.oath.cloud:4443/", - Endpoint.of(app1).target(rotation).on(Port.tls(4443)).in(SystemName.main), + Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).in(SystemName.main), // Main endpoint in CD "https://cd--a1--t1.global.vespa.oath.cloud:4443/", - Endpoint.of(app1).target(rotation).on(Port.tls(4443)).in(SystemName.cd), + Endpoint.of(app1).named(endpointId).on(Port.tls(4443)).in(SystemName.cd), // Main endpoint with direct routing and default TLS port "https://a1.t1.global.vespa.oath.cloud/", - Endpoint.of(app1).target(rotation).on(Port.tls()).directRouting().in(SystemName.main), + Endpoint.of(app1).named(endpointId).on(Port.tls()).directRouting().in(SystemName.main), // Main endpoint with custom rotation name "https://r1.a1.t1.global.vespa.oath.cloud/", - Endpoint.of(app1).target(RotationName.from("r1")).on(Port.tls()).directRouting().in(SystemName.main), + Endpoint.of(app1).named(EndpointId.of("r1")).on(Port.tls()).directRouting().in(SystemName.main), // Main endpoint for custom instance in default rotation "https://a2.t2.global.vespa.oath.cloud/", - Endpoint.of(app2).target(rotation).on(Port.tls()).directRouting().in(SystemName.main), + Endpoint.of(app2).named(endpointId).on(Port.tls()).directRouting().in(SystemName.main), // Main endpoint for custom instance with custom rotation name "https://r2.a2.t2.global.vespa.oath.cloud/", - Endpoint.of(app2).target(RotationName.from("r2")).on(Port.tls()).directRouting().in(SystemName.main), + Endpoint.of(app2).named(EndpointId.of("r2")).on(Port.tls()).directRouting().in(SystemName.main), // Main endpoint in public system "https://a1.t1.global.public.vespa.oath.cloud/", - Endpoint.of(app1).target(rotation).on(Port.tls()).directRouting().in(SystemName.Public) + Endpoint.of(app1).named(endpointId).on(Port.tls()).directRouting().in(SystemName.Public) ); tests.forEach((expected, endpoint) -> assertEquals(expected, endpoint.url().toString())); } @Test public void test_global_endpoints_with_endpoint_id() { - final var endpointId = EndpointId.default_(); + var endpointId = EndpointId.default_(); Map tests = Map.of( // Legacy endpoint @@ -111,9 +110,9 @@ public class EndpointTest { @Test public void test_zone_endpoints() { - ClusterSpec.Id cluster = ClusterSpec.Id.from("default"); // Always default for non-direct routing - ZoneId prodZone = ZoneId.from("prod", "us-north-1"); - ZoneId testZone = ZoneId.from("test", "us-north-2"); + var cluster = ClusterSpec.Id.from("default"); // Always default for non-direct routing + var prodZone = ZoneId.from("prod", "us-north-1"); + var testZone = ZoneId.from("test", "us-north-2"); Map tests = Map.of( // Legacy endpoint (always contains environment) diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java index f0344cb8d12..600fca4f45e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/RoutingPoliciesTest.java @@ -105,7 +105,7 @@ public class RoutingPoliciesTest { Set policies = tester.controller().curator().readRoutingPolicies(app1.id()); assertEquals(clustersPerZone * numberOfDeployments, policies.size()); assertTrue("Rotation membership is removed from all policies", - policies.stream().allMatch(policy -> policy.rotations().isEmpty())); + policies.stream().allMatch(policy -> policy.endpoints().isEmpty())); assertEquals("Rotations for " + app2 + " are not removed", 2, records3.get().size()); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java index a0e95bd0393..e99cc302ffe 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RoutingPolicySerializerTest.java @@ -5,8 +5,8 @@ import com.google.common.collect.ImmutableSet; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.HostName; -import com.yahoo.config.provision.RotationName; import com.yahoo.config.provision.zone.ZoneId; +import com.yahoo.vespa.hosted.controller.application.EndpointId; import com.yahoo.vespa.hosted.controller.application.RoutingPolicy; import org.junit.Test; @@ -26,19 +26,19 @@ public class RoutingPolicySerializerTest { @Test public void test_serialization() { var owner = ApplicationId.defaultId(); - var rotations = Set.of(RotationName.from("r1"), RotationName.from("r2")); + var endpoints = Set.of(EndpointId.of("r1"), EndpointId.of("r2")); var policies = ImmutableSet.of(new RoutingPolicy(owner, ClusterSpec.Id.from("my-cluster1"), ZoneId.from("prod", "us-north-1"), HostName.from("long-and-ugly-name"), Optional.of("zone1"), - rotations), + endpoints), new RoutingPolicy(owner, ClusterSpec.Id.from("my-cluster2"), ZoneId.from("prod", "us-north-2"), HostName.from("long-and-ugly-name-2"), Optional.empty(), - rotations)); + endpoints)); var serialized = serializer.fromSlime(owner, serializer.toSlime(policies)); assertEquals(policies.size(), serialized.size()); for (Iterator it1 = policies.iterator(), it2 = serialized.iterator(); it1.hasNext();) { @@ -49,7 +49,7 @@ public class RoutingPolicySerializerTest { assertEquals(expected.zone(), actual.zone()); assertEquals(expected.canonicalName(), actual.canonicalName()); assertEquals(expected.dnsZone(), actual.dnsZone()); - assertEquals(expected.rotations(), actual.rotations()); + assertEquals(expected.endpoints(), actual.endpoints()); } } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java index 577b8491bd2..41d8edbabc0 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java @@ -11,7 +11,6 @@ import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.RotationName; import com.yahoo.config.provision.TenantName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.slime.Cursor; @@ -44,6 +43,7 @@ import com.yahoo.vespa.hosted.controller.application.ClusterUtilization; import com.yahoo.vespa.hosted.controller.application.Deployment; import com.yahoo.vespa.hosted.controller.application.DeploymentJobs; import com.yahoo.vespa.hosted.controller.application.DeploymentMetrics; +import com.yahoo.vespa.hosted.controller.application.EndpointId; import com.yahoo.vespa.hosted.controller.application.JobStatus; import com.yahoo.vespa.hosted.controller.application.RotationStatus; import com.yahoo.vespa.hosted.controller.application.RoutingPolicy; @@ -1380,7 +1380,7 @@ public class ApplicationApiTest extends ControllerContainerTest { ClusterSpec.Id.from("default"), ZoneId.from(Environment.prod, RegionName.from("us-west-1")), HostName.from("lb-0-canonical-name"), - Optional.of("dns-zone-1"), Set.of(RotationName.from("c0"))); + Optional.of("dns-zone-1"), Set.of(EndpointId.of("c0"))); tester.controller().curator().writeRoutingPolicies(app.id(), Set.of(policy)); // GET application -- cgit v1.2.3