summaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'controller-api/src/main/java/com')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java4
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java78
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/deployment/TesterCloud.java14
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java17
4 files changed, 33 insertions, 80 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
index cc05bc01d99..93ac16c606d 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java
@@ -4,6 +4,8 @@ package com.yahoo.vespa.hosted.controller.api.integration.configserver;
import ai.vespa.http.HttpURL.Query;
import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
+import com.yahoo.config.provision.EndpointsChecker.Availability;
+import com.yahoo.config.provision.EndpointsChecker.Endpoint;
import com.yahoo.config.provision.zone.ZoneId;
import ai.vespa.http.DomainName;
import ai.vespa.http.HttpURL.Path;
@@ -145,6 +147,8 @@ public interface ConfigServer {
Optional<TestReport> getTestReport(DeploymentId deployment);
+ Availability verifyEndpoints(DeploymentId deploymentId, List<Endpoint> zoneEndpoints);
+
/** Get maximum resources consumed */
QuotaUsage getQuotaUsage(DeploymentId deploymentId);
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java
index 26330f11d65..0c81fbd3670 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/LoadBalancer.java
@@ -8,74 +8,30 @@ import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.ZoneEndpoint.AllowedUrn;
import java.util.List;
-import java.util.Objects;
import java.util.Optional;
+import static java.util.Objects.requireNonNull;
+
/**
* Represents an exclusive load balancer, assigned to an application's cluster.
*
* @author mortent
*/
-public class LoadBalancer {
-
- private final String id;
- private final ApplicationId application;
- private final ClusterSpec.Id cluster;
- private final Optional<DomainName> hostname;
- private final Optional<String> ipAddress;
- private final State state;
- private final Optional<String> dnsZone;
- private final Optional<CloudAccount> cloudAccount;
- private final Optional<PrivateServiceInfo> service;
-
- public LoadBalancer(String id, ApplicationId application, ClusterSpec.Id cluster, Optional<DomainName> hostname,
- Optional<String> ipAddress, State state, Optional<String> dnsZone,
- Optional<CloudAccount> cloudAccount, Optional<PrivateServiceInfo> service) {
- this.id = Objects.requireNonNull(id, "id must be non-null");
- this.application = Objects.requireNonNull(application, "application must be non-null");
- this.cluster = Objects.requireNonNull(cluster, "cluster must be non-null");
- this.hostname = Objects.requireNonNull(hostname, "hostname must be non-null");
- this.ipAddress = Objects.requireNonNull(ipAddress, "ipAddress must be non-null");
- this.state = Objects.requireNonNull(state, "state must be non-null");
- this.dnsZone = Objects.requireNonNull(dnsZone, "dnsZone must be non-null");
- this.cloudAccount = Objects.requireNonNull(cloudAccount, "cloudAccount must be non-null");
- this.service = Objects.requireNonNull(service, "service must be non-null");
- }
-
- public String id() {
- return id;
- }
-
- public ApplicationId application() {
- return application;
- }
-
- public ClusterSpec.Id cluster() {
- return cluster;
- }
-
- public Optional<DomainName> hostname() {
- return hostname;
- }
-
- public Optional<String> ipAddress() {
- return ipAddress;
- }
-
- public Optional<String> dnsZone() {
- return dnsZone;
- }
-
- public State state() {
- return state;
- }
-
- public Optional<CloudAccount> cloudAccount() {
- return cloudAccount;
- }
-
- public Optional<PrivateServiceInfo> service() {
- return service;
+public record LoadBalancer(String id, ApplicationId application, ClusterSpec.Id cluster,
+ Optional<DomainName> hostname, Optional<String> ipAddress,
+ State state, Optional<String> dnsZone, Optional<CloudAccount> cloudAccount,
+ Optional<PrivateServiceInfo> service, boolean isPublic) {
+
+ public LoadBalancer {
+ requireNonNull(id, "id must be non-null");
+ requireNonNull(application, "application must be non-null");
+ requireNonNull(cluster, "cluster must be non-null");
+ requireNonNull(hostname, "hostname must be non-null");
+ requireNonNull(ipAddress, "ipAddress must be non-null");
+ requireNonNull(state, "state must be non-null");
+ requireNonNull(dnsZone, "dnsZone must be non-null");
+ requireNonNull(cloudAccount, "cloudAccount must be non-null");
+ requireNonNull(service, "service must be non-null");
}
public enum State {
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 b4d9dd49880..4095e4b03fd 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,12 +1,11 @@
// 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.config.provision.Environment;
+import com.yahoo.config.provision.EndpointsChecker.Endpoint;
+import com.yahoo.config.provision.EndpointsChecker.Availability;
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;
@@ -27,17 +26,10 @@ public interface TesterCloud {
/** Returns the current status of the tester. */
Status getStatus(DeploymentId deploymentId);
- /** Returns whether the container is ready to serve. */
- boolean ready(URI endpointUrl);
-
/** Returns whether the test container is ready to serve */
boolean testerReady(DeploymentId deploymentId);
- /** Returns the IP address of the given host name, if any. */
- Optional<InetAddress> resolveHostName(DomainName hostname);
-
- /** Returns the host name of the given CNAME, if any. */
- Optional<DomainName> resolveCname(DomainName hostName);
+ Availability verifyEndpoints(DeploymentId deploymentId, List<Endpoint> endpoints);
/** 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/stubs/MockTesterCloud.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/stubs/MockTesterCloud.java
index 939c74fe61d..e29e8086c80 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
@@ -3,6 +3,9 @@ package com.yahoo.vespa.hosted.controller.api.integration.stubs;
import ai.vespa.http.DomainName;
import com.google.common.net.InetAddresses;
+import com.yahoo.config.provision.EndpointsChecker;
+import com.yahoo.config.provision.EndpointsChecker.Endpoint;
+import com.yahoo.config.provision.EndpointsChecker.Availability;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.integration.LogEntry;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TestReport;
@@ -16,7 +19,6 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud.Status.NOT_STARTED;
import static com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterCloud.Status.RUNNING;
@@ -24,6 +26,7 @@ import static com.yahoo.vespa.hosted.controller.api.integration.deployment.Teste
public class MockTesterCloud implements TesterCloud {
private final NameService nameService;
+ private final EndpointsChecker endpointsChecker = EndpointsChecker.mock(this::resolveHostName, this::resolveCname, __ -> true);
private List<LogEntry> log = new ArrayList<>();
private Status status = NOT_STARTED;
@@ -49,25 +52,23 @@ public class MockTesterCloud implements TesterCloud {
public Status getStatus(DeploymentId deploymentId) { return status; }
@Override
- public boolean ready(URI testerUrl) {
+ public boolean testerReady(DeploymentId deploymentId) {
return true;
}
@Override
- public boolean testerReady(DeploymentId deploymentId) {
- return true;
+ public Availability verifyEndpoints(DeploymentId deploymentId, List<Endpoint> endpoints) {
+ return endpointsChecker.endpointsAvailable(endpoints);
}
- @Override
- public Optional<InetAddress> resolveHostName(DomainName hostname) {
+ private Optional<InetAddress> resolveHostName(DomainName hostname) {
return nameService.findRecords(Record.Type.A, RecordName.from(hostname.value())).stream()
.findFirst()
.map(record -> InetAddresses.forString(record.data().asString()))
.or(() -> Optional.of(InetAddresses.forString("1.2.3.4")));
}
- @Override
- public Optional<DomainName> resolveCname(DomainName hostName) {
+ private Optional<DomainName> resolveCname(DomainName hostName) {
return nameService.findRecords(Record.Type.CNAME, RecordName.from(hostName.value())).stream()
.findFirst()
.map(record -> DomainName.of(record.data().asString().substring(0, record.data().asString().length() - 1)));