summaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/main/java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java56
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicy.java1
2 files changed, 19 insertions, 38 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 7da61f9bc63..8ab0a7ce56d 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
@@ -9,6 +9,7 @@ import com.yahoo.config.application.api.Notifications;
import com.yahoo.config.application.api.Notifications.When;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.EndpointsChecker;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.RoutingMethod;
@@ -45,6 +46,7 @@ import com.yahoo.yolean.Exceptions;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.UncheckedIOException;
+import java.net.InetAddress;
import java.security.cert.CertificateExpiredException;
import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate;
@@ -87,6 +89,7 @@ import static com.yahoo.vespa.hosted.controller.deployment.Step.deployReal;
import static com.yahoo.vespa.hosted.controller.deployment.Step.deployTester;
import static com.yahoo.vespa.hosted.controller.deployment.Step.installTester;
import static com.yahoo.vespa.hosted.controller.deployment.Step.report;
+import static com.yahoo.yolean.Exceptions.uncheck;
import static java.util.Objects.requireNonNull;
import static java.util.logging.Level.FINE;
import static java.util.logging.Level.INFO;
@@ -504,45 +507,24 @@ public class InternalStepRunner implements StepRunner {
private boolean endpointsAvailable(ApplicationId id, ZoneId zone, DualLogger logger) {
DeploymentId deployment = new DeploymentId(id, zone);
Map<ZoneId, List<Endpoint>> endpoints = controller.routing().readTestRunnerEndpointsOf(Set.of(deployment));
- if ( ! endpoints.containsKey(zone)) {
- logger.log("Endpoints not yet ready.");
+ DeploymentRoutingContext context = controller.routing().of(deployment);
+ boolean resolveEndpoints = context.routingMethod() == RoutingMethod.exclusive;
+ var unavailableCause = controller.serviceRegistry().testerCloud().verifyEndpoints(
+ endpoints.getOrDefault(zone, List.of())
+ .stream()
+ .map(endpoint -> {
+ ClusterSpec.Id cluster = ClusterSpec.Id.from(endpoint.name());
+ RoutingPolicy policy = context.routingPolicy(cluster).get();
+ return new EndpointsChecker.Endpoint(cluster,
+ DomainName.of(endpoint.dnsName()),
+ policy.ipAddress().filter(__ -> resolveEndpoints).map(uncheck(InetAddress::getByName)),
+ policy.canonicalName().filter(__ -> resolveEndpoints),
+ policy.isPublic());
+ }).toList());
+ if (unavailableCause.isPresent()) {
+ logger.log(unavailableCause.get().message());
return false;
}
- for (var endpoint : endpoints.get(zone)) {
- 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 + "'.");
- return false;
- }
- DeploymentRoutingContext context = controller.routing().of(deployment);
- if (context.routingMethod() == RoutingMethod.exclusive) {
- RoutingPolicy policy = context.routingPolicy(ClusterSpec.Id.from(endpoint.name()))
- .orElseThrow(() -> new IllegalStateException(endpoint + " has no matching policy"));
- if (policy.ipAddress().isPresent()) {
- if (ipAddress.equals(policy.ipAddress().map(InetAddresses::forString))) continue;
- logger.log(INFO, "IP address of '" + endpointName + "' (" +
- ipAddress.map(InetAddresses::toAddrString).get() + ") and load balancer "
- + "' (" + policy.ipAddress().orElseThrow() + ") are not equal");
- return false;
- }
-
- var cNameValue = controller.jobController().cloud().resolveCname(endpointName);
- if ( ! cNameValue.map(policy.canonicalName().get()::equals).orElse(false)) {
- logger.log(INFO, "CNAME '" + endpointName + "' points at " +
- cNameValue.map(name -> "'" + name + "'").orElse("nothing") +
- " but should point at load balancer '" + policy.canonicalName() + "'");
- return false;
- }
- var loadBalancerAddress = controller.jobController().cloud().resolveHostName(policy.canonicalName().get());
- if ( ! loadBalancerAddress.equals(ipAddress)) {
- logger.log(INFO, "IP address of CNAME '" + endpointName + "' (" + ipAddress.get() + ") and load balancer '" +
- policy.canonicalName().get() + "' (" + loadBalancerAddress.orElse(null) + ") are not equal");
- return false;
- }
- }
- }
-
logEndpoints(endpoints, logger);
return true;
}
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 acf3ba99a1a..38ecff452c8 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
@@ -7,7 +7,6 @@ import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.zone.RoutingMethod;
import com.yahoo.text.Text;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
-import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry;
import com.yahoo.vespa.hosted.controller.application.Endpoint;
import com.yahoo.vespa.hosted.controller.application.Endpoint.Port;
import com.yahoo.vespa.hosted.controller.application.EndpointId;