From 5aa00fffe0b3ebae4f0252031b6ad9214b4d6ff8 Mon Sep 17 00:00:00 2001 From: jonmv Date: Fri, 27 Jan 2023 18:03:07 +0100 Subject: Revert "Merge pull request #25770 from vespa-engine/jonmv/private-endpoints" This reverts commit a3ae8f5b0ec3a7f2f3c9205289470dbb89e477ff, reversing changes made to 6534f02466a8958513a8b8684cc2a4369fab7666. --- .../api/integration/configserver/ConfigServer.java | 4 -- .../api/integration/configserver/LoadBalancer.java | 78 +++++++++++++++++----- .../api/integration/deployment/TesterCloud.java | 14 +++- .../api/integration/stubs/MockTesterCloud.java | 17 +++-- 4 files changed, 80 insertions(+), 33 deletions(-) (limited to 'controller-api') 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 93ac16c606d..cc05bc01d99 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,8 +4,6 @@ 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; @@ -147,8 +145,6 @@ public interface ConfigServer { Optional getTestReport(DeploymentId deployment); - Availability verifyEndpoints(DeploymentId deploymentId, List 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 0c81fbd3670..26330f11d65 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,30 +8,74 @@ 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 record LoadBalancer(String id, ApplicationId application, ClusterSpec.Id cluster, - Optional hostname, Optional ipAddress, - State state, Optional dnsZone, Optional cloudAccount, - Optional 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 class LoadBalancer { + + private final String id; + private final ApplicationId application; + private final ClusterSpec.Id cluster; + private final Optional hostname; + private final Optional ipAddress; + private final State state; + private final Optional dnsZone; + private final Optional cloudAccount; + private final Optional service; + + public LoadBalancer(String id, ApplicationId application, ClusterSpec.Id cluster, Optional hostname, + Optional ipAddress, State state, Optional dnsZone, + Optional cloudAccount, Optional 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 hostname() { + return hostname; + } + + public Optional ipAddress() { + return ipAddress; + } + + public Optional dnsZone() { + return dnsZone; + } + + public State state() { + return state; + } + + public Optional cloudAccount() { + return cloudAccount; + } + + public Optional service() { + return service; } 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 4095e4b03fd..b4d9dd49880 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,11 +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 com.yahoo.config.provision.EndpointsChecker.Endpoint; -import com.yahoo.config.provision.EndpointsChecker.Availability; +import ai.vespa.http.DomainName; +import com.yahoo.config.provision.Environment; 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; @@ -26,10 +27,17 @@ 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); - Availability verifyEndpoints(DeploymentId deploymentId, List endpoints); + /** Returns the IP address of the given host name, if any. */ + Optional resolveHostName(DomainName hostname); + + /** Returns the host name of the given CNAME, if any. */ + Optional resolveCname(DomainName hostName); /** Returns the test report as JSON if available */ Optional 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 e29e8086c80..939c74fe61d 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,9 +3,6 @@ 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; @@ -19,6 +16,7 @@ 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; @@ -26,7 +24,6 @@ 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 log = new ArrayList<>(); private Status status = NOT_STARTED; @@ -52,23 +49,25 @@ public class MockTesterCloud implements TesterCloud { public Status getStatus(DeploymentId deploymentId) { return status; } @Override - public boolean testerReady(DeploymentId deploymentId) { + public boolean ready(URI testerUrl) { return true; } @Override - public Availability verifyEndpoints(DeploymentId deploymentId, List endpoints) { - return endpointsChecker.endpointsAvailable(endpoints); + public boolean testerReady(DeploymentId deploymentId) { + return true; } - private Optional resolveHostName(DomainName hostname) { + @Override + public Optional 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"))); } - private Optional resolveCname(DomainName hostName) { + @Override + public Optional 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))); -- cgit v1.2.3