summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2022-04-08 14:23:21 +0200
committerjonmv <venstad@gmail.com>2022-04-08 14:23:21 +0200
commit11e6c9aa2b5c7ca1660770d5cd366075210fa058 (patch)
treea2425637d9bdc11e0049665cd5fff705671447de
parent20b5d3800417660cb8ea35886366af973d252417 (diff)
Use DomainName for routing names, and fix invalid unit test names
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java6
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java7
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java3
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java16
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java3
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java7
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-nodes.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-east-1-log-first-part.json2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json12
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json24
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json24
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java8
-rw-r--r--vespajlib/src/main/java/ai/vespa/http/DomainName.java6
-rw-r--r--vespajlib/src/main/java/ai/vespa/validation/StringWrapper.java2
-rw-r--r--vespajlib/src/main/java/com/yahoo/net/HostName.java9
20 files changed, 82 insertions, 69 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
index 8d752208bd5..e429731ba52 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java
@@ -1,10 +1,12 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.deployment;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
+import java.net.InetAddress;
import java.net.URI;
import java.util.List;
import java.util.Optional;
@@ -32,10 +34,10 @@ public interface TesterCloud {
boolean testerReady(DeploymentId deploymentId);
/** Returns the IP address of the given host name, if any. */
- Optional<String> resolveHostName(HostName hostname);
+ Optional<InetAddress> resolveHostName(DomainName hostname);
/** Returns the host name of the given CNAME, if any. */
- Optional<HostName> resolveCname(HostName hostName);
+ Optional<DomainName> resolveCname(DomainName hostName);
/** Returns the test report as JSON if available */
Optional<TestReport> getTestReport(DeploymentId deploymentId);
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java
index 766410179c1..81d55c50d69 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/AliasTarget.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import java.util.Objects;
@@ -12,11 +13,11 @@ import java.util.Objects;
*/
public abstract class AliasTarget {
- private final HostName name;
+ private final DomainName name;
private final String dnsZone;
private final String id;
- public AliasTarget(HostName name, String dnsZone, String id) {
+ public AliasTarget(DomainName name, String dnsZone, String id) {
this.name = Objects.requireNonNull(name, "name must be non-null");
this.dnsZone = Objects.requireNonNull(dnsZone, "dnsZone must be non-null");
this.id = Objects.requireNonNull(id, "id must be non-null");
@@ -28,7 +29,7 @@ public abstract class AliasTarget {
}
/** DNS name this points to */
- public final HostName name() {
+ public final DomainName name() {
return name;
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java
index bcb85857868..c898796f4ea 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/LatencyAliasTarget.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.config.provision.zone.ZoneId;
@@ -15,7 +16,7 @@ public class LatencyAliasTarget extends AliasTarget {
private final ZoneId zone;
- public LatencyAliasTarget(HostName name, String dnsZone, ZoneId zone) {
+ public LatencyAliasTarget(DomainName name, String dnsZone, ZoneId zone) {
super(name, dnsZone, zone.value());
this.zone = Objects.requireNonNull(zone);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java
index cae733427ec..c26c17cfc11 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/WeightedAliasTarget.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.dns;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.config.provision.zone.ZoneId;
@@ -18,7 +19,7 @@ public class WeightedAliasTarget extends AliasTarget {
private final long weight;
- public WeightedAliasTarget(HostName name, String dnsZone, ZoneId zone, long weight) {
+ public WeightedAliasTarget(DomainName name, String dnsZone, ZoneId zone, long weight) {
super(name, dnsZone, zone.value());
this.weight = weight;
if (weight < 0) throw new IllegalArgumentException("Weight cannot be negative");
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
index 673086b779c..5496b6022fd 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.stubs;
+import ai.vespa.http.DomainName;
import com.yahoo.net.HostName;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
@@ -10,7 +11,9 @@ import com.yahoo.vespa.hosted.controller.api.integration.dns.NameService;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
+import java.net.InetAddress;
import java.net.URI;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -57,15 +60,20 @@ public class MockTesterCloud implements TesterCloud {
}
@Override
- public Optional<String> resolveHostName(HostName hostname) {
- return Optional.of("1.2.3.4");
+ public Optional<InetAddress> resolveHostName(DomainName hostname) {
+ try {
+ return Optional.of(InetAddress.getByAddress(new byte[]{ 1, 2, 3, 4 }));
+ }
+ catch (UnknownHostException e) {
+ throw new IllegalStateException("should not happen");
+ }
}
@Override
- public Optional<HostName> resolveCname(HostName hostName) {
+ public Optional<DomainName> resolveCname(DomainName hostName) {
return nameService.findRecords(Record.Type.CNAME, RecordName.from(hostName.value())).stream()
.findFirst()
- .map(record -> HostName.of(record.data().asString().substring(0, record.data().asString().length() - 1)));
+ .map(record -> DomainName.of(record.data().asString().substring(0, record.data().asString().length() - 1)));
}
@Override
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 84ad574bf16..c6ba65c4886 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
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.deployment;
+import ai.vespa.http.DomainName;
import com.yahoo.component.Version;
import com.yahoo.config.application.api.DeploymentInstanceSpec;
import com.yahoo.config.application.api.DeploymentSpec;
@@ -511,7 +512,7 @@ public class InternalStepRunner implements StepRunner {
return false;
}
for (var endpoint : endpoints.get(zone)) {
- HostName endpointName = HostName.of(endpoint.dnsName());
+ DomainName endpointName = DomainName.of(endpoint.dnsName());
var ipAddress = controller.jobController().cloud().resolveHostName(endpointName);
if (ipAddress.isEmpty()) {
logger.log(INFO, "DNS lookup yielded no IP address for '" + endpointName + "'.");
@@ -532,7 +533,7 @@ public class InternalStepRunner implements StepRunner {
var loadBalancerAddress = controller.jobController().cloud().resolveHostName(policy.canonicalName());
if ( ! loadBalancerAddress.equals(ipAddress)) {
logger.log(INFO, "IP address of CNAME '" + endpointName + "' (" + ipAddress.get() + ") and load balancer '" +
- policy.canonicalName() + "' (" + loadBalancerAddress.orElse("empty") + ") are not equal");
+ policy.canonicalName() + "' (" + loadBalancerAddress.orElse(null) + ") are not equal");
return false;
}
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
index 2a678ad682a..5baba150b05 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.routing;
+import ai.vespa.http.DomainName;
import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.zone.RoutingMethod;
@@ -215,7 +216,7 @@ public class RoutingPolicies {
}
var weightedTarget = new WeightedAliasTarget(policy.canonicalName(), policy.dnsZone().get(),
policy.id().zone(), weight);
- endpoints.computeIfAbsent(regionEndpoint, (k) -> new RegionEndpoint(new LatencyAliasTarget(HostName.of(regionEndpoint.dnsName()),
+ endpoints.computeIfAbsent(regionEndpoint, (k) -> new RegionEndpoint(new LatencyAliasTarget(DomainName.of(regionEndpoint.dnsName()),
policy.dnsZone().get(),
policy.id().zone())))
.zoneTargets()
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
index db67951c3fa..59ecc349ed6 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.routing;
+import ai.vespa.http.DomainName;
import com.google.common.collect.ImmutableSortedSet;
import com.yahoo.net.HostName;
import com.yahoo.config.provision.SystemName;
@@ -27,14 +28,14 @@ import java.util.Set;
public class RoutingPolicy {
private final RoutingPolicyId id;
- private final HostName canonicalName;
+ private final DomainName canonicalName;
private final Optional<String> dnsZone;
private final Set<EndpointId> instanceEndpoints;
private final Set<EndpointId> applicationEndpoints;
private final Status status;
/** DO NOT USE. Public for serialization purposes */
- public RoutingPolicy(RoutingPolicyId id, HostName canonicalName, Optional<String> dnsZone,
+ public RoutingPolicy(RoutingPolicyId id, DomainName canonicalName, Optional<String> dnsZone,
Set<EndpointId> instanceEndpoints, Set<EndpointId> applicationEndpoints, Status status) {
this.id = Objects.requireNonNull(id, "id must be non-null");
this.canonicalName = Objects.requireNonNull(canonicalName, "canonicalName must be non-null");
@@ -50,7 +51,7 @@ public class RoutingPolicy {
}
/** The canonical name for the load balancer this applies to (rhs of a CNAME or ALIAS record) */
- public HostName canonicalName() {
+ public DomainName canonicalName() {
return canonicalName;
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
index d35bfb6fe1b..6758d360b52 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
@@ -940,7 +940,7 @@ public class ControllerTest {
// The weighted record for zone 2's region
new Record(Record.Type.ALIAS,
RecordName.from("application.tenant.us-east-3-w.vespa.oath.cloud"),
- new WeightedAliasTarget(HostName.of("lb-0--tenant:application:default--prod.us-east-3"),
+ new WeightedAliasTarget(HostName.of("lb-0--tenant.application.default--prod.us-east-3"),
"dns-zone-1", ZoneId.from("prod.us-east-3"), 1).pack()),
// The 'east' global endpoint, pointing to the weighted record for zone 2's region
@@ -952,7 +952,7 @@ public class ControllerTest {
// The zone-scoped endpoint pointing to zone 2 with exclusive routing
new Record(Record.Type.CNAME,
RecordName.from("application.tenant.us-east-3.vespa.oath.cloud"),
- RecordData.from("lb-0--tenant:application:default--prod.us-east-3.")));
+ RecordData.from("lb-0--tenant.application.default--prod.us-east-3.")));
assertEquals(expectedRecords, List.copyOf(tester.controllerTester().nameService().records()));
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
index 12425dec8ca..76201f27ed1 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java
@@ -159,7 +159,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
}
public HostName hostFor(ApplicationId application, ZoneId zone) {
- return HostName.of("host-" + application.serializedForm() + "-" + zone.value());
+ return HostName.of("host-" + application.toFullString() + "-" + zone.value());
}
public void bootstrap(List<ZoneId> zones, SystemApplication... applications) {
@@ -402,7 +402,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer
putLoadBalancers(id.zoneId(), List.of(new LoadBalancer(UUID.randomUUID().toString(),
id.applicationId(),
cluster,
- Optional.of(HostName.of("lb-0--" + id.applicationId().serializedForm() + "--" + id.zoneId().toString())),
+ Optional.of(HostName.of("lb-0--" + id.applicationId().toFullString() + "--" + id.zoneId().toString())),
LoadBalancer.State.active,
Optional.of("dns-zone-1"))));
}
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 67b201bdc9d..52da2fadf0c 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
@@ -634,13 +634,13 @@ public class ApplicationApiTest extends ControllerContainerTest {
"{\"enabled\":true,\"clusters\":[{\"name\":\"cluster\",\"pending\":[{\"type\":\"type\",\"requiredGeneration\":100}],\"ready\":[{\"type\":\"type\",\"readyAtMillis\":345,\"startedAtMillis\":456,\"endedAtMillis\":567,\"state\":\"failed\",\"message\":\"(#`д´)ノ\",\"progress\":0.1,\"speed\":1.0}]}]}");
// POST to request a service dump
- tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/node/host-tenant1:application1:instance1-prod.us-central-1/service-dump", POST)
+ tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/node/host-tenant1.application1.instance1-prod.us-central-1/service-dump", POST)
.userIdentity(HOSTED_VESPA_OPERATOR)
.data("{\"configId\":\"default/container.1\",\"artifacts\":[\"jvm-dump\"],\"dumpOptions\":{\"duration\":30}}"),
"{\"message\":\"Request created\"}");
// GET to get status of service dump
- tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/node/host-tenant1:application1:instance1-prod.us-central-1/service-dump", GET)
+ tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/node/host-tenant1.application1.instance1-prod.us-central-1/service-dump", GET)
.userIdentity(HOSTED_VESPA_OPERATOR),
"{\"createdMillis\":" + tester.controller().clock().millis() + ",\"configId\":\"default/container.1\"" +
",\"artifacts\":[\"jvm-dump\"],\"dumpOptions\":{\"duration\":30}}");
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-nodes.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-nodes.json
index 422c8c122fa..88a92bf7810 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-nodes.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/application-nodes.json
@@ -1,7 +1,7 @@
{
"nodes": [
{
- "hostname": "host-tenant1:application1:instance1-prod.us-central-1",
+ "hostname": "host-tenant1.application1.instance1-prod.us-central-1",
"state": "active",
"orchestration": "unorchestrated",
"version": "6.1",
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-east-1-log-first-part.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-east-1-log-first-part.json
index 3ef993c6589..bfaa4d5c813 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-east-1-log-first-part.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/dev-us-east-1-log-first-part.json
@@ -28,7 +28,7 @@
{
"at": 0,
"type": "info",
- "message": "host-tenant:application:default-dev.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-dev.us-east-1: unorchestrated"
},
{
"at": 0,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json
index 6b1d48f4a08..7c1f7223e9e 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/staging-test-log.json
@@ -18,7 +18,7 @@
{
"at": 14503000,
"type": "info",
- "message": "host-tenant:application:default-t-staging.us-east-3: unorchestrated"
+ "message": "host-tenant.application.default-t-staging.us-east-3: unorchestrated"
},
{
"at": 14503000,
@@ -33,7 +33,7 @@
{
"at": 14503000,
"type": "info",
- "message": "host-tenant:application:default-t-staging.us-east-3: unorchestrated"
+ "message": "host-tenant.application.default-t-staging.us-east-3: unorchestrated"
},
{
"at": 14503000,
@@ -48,7 +48,7 @@
{
"at": 14503000,
"type": "info",
- "message": "host-tenant:application:default-t-staging.us-east-3: unorchestrated"
+ "message": "host-tenant.application.default-t-staging.us-east-3: unorchestrated"
},
{
"at": 14503000,
@@ -63,7 +63,7 @@
{
"at": 14503000,
"type": "info",
- "message": "host-tenant:application:default-t-staging.us-east-3: unorchestrated"
+ "message": "host-tenant.application.default-t-staging.us-east-3: unorchestrated"
},
{
"at": 14503000,
@@ -102,7 +102,7 @@
{
"at": 14503000,
"type": "info",
- "message": "host-tenant:application:default-staging.us-east-3: unorchestrated"
+ "message": "host-tenant.application.default-staging.us-east-3: unorchestrated"
},
{
"at": 14503000,
@@ -127,7 +127,7 @@
{
"at": 14503000,
"type": "debug",
- "message": "host-tenant:application:default-staging.us-east-3: unorchestrated"
+ "message": "host-tenant.application.default-staging.us-east-3: unorchestrated"
},
{
"at": 14503000,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json
index 377b8c6ed69..e830f96bbba 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-details.json
@@ -23,7 +23,7 @@
{
"at": "(ignore)",
"type": "info",
- "message": "host-tenant1:application1:instance1-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-t-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -38,7 +38,7 @@
{
"at": "(ignore)",
"type": "info",
- "message": "host-tenant1:application1:instance1-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-t-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -53,7 +53,7 @@
{
"at": "(ignore)",
"type": "info",
- "message": "host-tenant1:application1:instance1-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-t-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -68,7 +68,7 @@
{
"at": "(ignore)",
"type": "info",
- "message": "host-tenant1:application1:instance1-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-t-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -83,7 +83,7 @@
{
"at": "(ignore)",
"type": "info",
- "message": "host-tenant1:application1:instance1-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-t-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -122,7 +122,7 @@
{
"at": "(ignore)",
"type": "info",
- "message": "host-tenant1:application1:instance1-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -147,7 +147,7 @@
{
"at": "(ignore)",
"type": "debug",
- "message": "host-tenant1:application1:instance1-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -172,7 +172,7 @@
{
"at": "(ignore)",
"type": "debug",
- "message": "host-tenant1:application1:instance1-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -197,7 +197,7 @@
{
"at": "(ignore)",
"type": "debug",
- "message": "host-tenant1:application1:instance1-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -222,7 +222,7 @@
{
"at": "(ignore)",
"type": "debug",
- "message": "host-tenant1:application1:instance1-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -247,7 +247,7 @@
{
"at": "(ignore)",
"type": "debug",
- "message": "host-tenant1:application1:instance1-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
@@ -272,7 +272,7 @@
{
"at": "(ignore)",
"type": "debug",
- "message": "host-tenant1:application1:instance1-test.us-east-1: unorchestrated"
+ "message": "host-tenant1.application1.instance1-test.us-east-1: unorchestrated"
},
{
"at": "(ignore)",
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json
index f675825c3b6..bfb5d8e6cbc 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/responses/system-test-log.json
@@ -18,7 +18,7 @@
{
"at": 0,
"type": "info",
- "message": "host-tenant:application:default-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-t-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -33,7 +33,7 @@
{
"at": 0,
"type": "info",
- "message": "host-tenant:application:default-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-t-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -48,7 +48,7 @@
{
"at": 0,
"type": "info",
- "message": "host-tenant:application:default-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-t-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -63,7 +63,7 @@
{
"at": 0,
"type": "info",
- "message": "host-tenant:application:default-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-t-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -78,7 +78,7 @@
{
"at": 0,
"type": "info",
- "message": "host-tenant:application:default-t-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-t-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -117,7 +117,7 @@
{
"at": 0,
"type": "info",
- "message": "host-tenant:application:default-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -142,7 +142,7 @@
{
"at": 0,
"type": "debug",
- "message": "host-tenant:application:default-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -167,7 +167,7 @@
{
"at": 0,
"type": "debug",
- "message": "host-tenant:application:default-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -192,7 +192,7 @@
{
"at": 0,
"type": "debug",
- "message": "host-tenant:application:default-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -217,7 +217,7 @@
{
"at": 0,
"type": "debug",
- "message": "host-tenant:application:default-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -242,7 +242,7 @@
{
"at": 0,
"type": "debug",
- "message": "host-tenant:application:default-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-test.us-east-1: unorchestrated"
},
{
"at": 0,
@@ -267,7 +267,7 @@
{
"at": 0,
"type": "debug",
- "message": "host-tenant:application:default-test.us-east-1: unorchestrated"
+ "message": "host-tenant.application.default-test.us-east-1: unorchestrated"
},
{
"at": 0,
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java
index bddb49f7e2b..67e97fc98ec 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/routing/RoutingPoliciesTest.java
@@ -708,7 +708,7 @@ public class RoutingPoliciesTest {
List<Record> records = tester.controllerTester().nameService().findRecords(Record.Type.CNAME, name);
assertEquals(1, records.size());
- assertEquals(RecordData.from("lb-0--hosted-vespa:zone-config-servers:default--prod.us-west-1."),
+ assertEquals(RecordData.from("lb-0--hosted-vespa.zone-config-servers.default--prod.us-west-1."),
records.get(0).data());
}
@@ -861,7 +861,7 @@ public class RoutingPoliciesTest {
if (shared) {
lbHostname = HostName.of("shared-lb--" + zone.value());
} else {
- lbHostname = HostName.of("lb-" + i + "--" + application.serializedForm() +
+ lbHostname = HostName.of("lb-" + i + "--" + application.toFullString() +
"--" + zone.value());
}
loadBalancers.add(
@@ -985,7 +985,7 @@ public class RoutingPoliciesTest {
deploymentsByDnsName.forEach((dnsName, deployments) -> {
Set<String> weightedTargets = deployments.stream()
.map(d -> "weighted/lb-" + loadBalancerId + "--" +
- d.applicationId().serializedForm() + "--" + d.zoneId().value() +
+ d.applicationId().toFullString() + "--" + d.zoneId().value() +
"/dns-zone-1/" + d.zoneId().value() + "/" + deploymentWeights.get(d))
.collect(Collectors.toSet());
assertEquals(dnsName + " has expected targets", weightedTargets, aliasDataOf(dnsName));
@@ -1009,7 +1009,7 @@ public class RoutingPoliciesTest {
zonesByRegionEndpoint.forEach((regionEndpoint, zonesInRegion) -> {
Set<String> weightedTargets = zonesInRegion.stream()
.map(z -> "weighted/lb-" + loadBalancerId + "--" +
- instance.serializedForm() + "--" + z.value() +
+ instance.toFullString() + "--" + z.value() +
"/dns-zone-1/" + z.value() + "/" + zoneWeights.get(z))
.collect(Collectors.toSet());
assertEquals("Region endpoint " + regionEndpoint + " points to load balancer",
diff --git a/vespajlib/src/main/java/ai/vespa/http/DomainName.java b/vespajlib/src/main/java/ai/vespa/http/DomainName.java
index a566f5b95be..737f6b6d863 100644
--- a/vespajlib/src/main/java/ai/vespa/http/DomainName.java
+++ b/vespajlib/src/main/java/ai/vespa/http/DomainName.java
@@ -15,12 +15,12 @@ import static ai.vespa.validation.Validation.requireMatch;
*/
public class DomainName extends PatternedStringWrapper<DomainName> {
- static final Pattern labelPattern = Pattern.compile("([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])");
- static final Pattern domainNamePattern = Pattern.compile("(" + labelPattern + "\\.)*" + labelPattern);
+ protected static final Pattern labelPattern = Pattern.compile("([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])");
+ protected static final Pattern domainNamePattern = Pattern.compile("(" + labelPattern + "\\.)*" + labelPattern);
public static final DomainName localhost = DomainName.of("localhost");
- private DomainName(String value) {
+ protected DomainName(String value) {
super(requireLength(value, "domain name length", 1, 255), domainNamePattern, "domain name");
}
diff --git a/vespajlib/src/main/java/ai/vespa/validation/StringWrapper.java b/vespajlib/src/main/java/ai/vespa/validation/StringWrapper.java
index 0937627b57e..12be0002f6f 100644
--- a/vespajlib/src/main/java/ai/vespa/validation/StringWrapper.java
+++ b/vespajlib/src/main/java/ai/vespa/validation/StringWrapper.java
@@ -40,7 +40,7 @@ public abstract class StringWrapper<T extends StringWrapper<T>> implements Compa
@Override
public final boolean equals(Object o) {
if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if ( ! (o instanceof StringWrapper<?>)) return false;
return value.equals(((StringWrapper<?>) o).value);
}
diff --git a/vespajlib/src/main/java/com/yahoo/net/HostName.java b/vespajlib/src/main/java/com/yahoo/net/HostName.java
index 20f1008055e..0348197a704 100644
--- a/vespajlib/src/main/java/com/yahoo/net/HostName.java
+++ b/vespajlib/src/main/java/com/yahoo/net/HostName.java
@@ -10,7 +10,7 @@ import java.util.regex.Pattern;
import static ai.vespa.validation.Validation.requireLength;
/**
- * Hostnames match {@link #hostNamePattern}, and are restricted to 64 characters in length.
+ * Hostnames match {@link #domainNamePattern}, and are restricted to 64 characters in length.
*
* This class also has utilities for getting the hostname of the system running the JVM.
* Detection of the hostname is now done before starting any Vespa
@@ -20,15 +20,12 @@ import static ai.vespa.validation.Validation.requireLength;
* @author arnej
* @author jonmv
*/
-public class HostName extends PatternedStringWrapper<HostName> {
-
- static final Pattern labelPattern = Pattern.compile("([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])");
- static final Pattern hostNamePattern = Pattern.compile("(" + labelPattern + "\\.)*" + labelPattern);
+public class HostName extends DomainName {
private static HostName preferredHostName = null;
private HostName(String value) {
- super(requireLength(value, "hostname length", 1, 64), hostNamePattern, "hostname");
+ super(requireLength(value, "hostname length", 1, 64));
}
public static HostName of(String value) {