diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-06-30 12:57:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 12:57:04 +0200 |
commit | 590d56ee6c92dce0637c252622d224ea61844c9b (patch) | |
tree | 3d424c3e84c0271365327ba4f58b03d7cca4a0ff | |
parent | 087c670cadd94e24106276609d525a69db3972db (diff) | |
parent | d9da501de962175b6798cef10c1bdbf7d74e827e (diff) |
Merge pull request #13722 from vespa-engine/bjorncs/tenant-cd-commons
Move shared tenant-cd-api implementations to new module
17 files changed, 57 insertions, 47 deletions
diff --git a/cloud-tenant-cd/OWNERS b/cloud-tenant-cd/OWNERS new file mode 100644 index 00000000000..ff9741f2060 --- /dev/null +++ b/cloud-tenant-cd/OWNERS @@ -0,0 +1,2 @@ +mortent +bjorncs
\ No newline at end of file diff --git a/cloud-tenant-cd/pom.xml b/cloud-tenant-cd/pom.xml index b4670e6e83f..d7e5a4a9642 100644 --- a/cloud-tenant-cd/pom.xml +++ b/cloud-tenant-cd/pom.xml @@ -53,19 +53,19 @@ <!-- compile scope --> <dependency> <groupId>com.yahoo.vespa</groupId> - <artifactId>tenant-auth</artifactId> + <artifactId>hosted-api</artifactId> <version>${project.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.yahoo.vespa</groupId> - <artifactId>hosted-api</artifactId> + <artifactId>config-provisioning</artifactId> <version>${project.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.yahoo.vespa</groupId> - <artifactId>config-provisioning</artifactId> + <artifactId>tenant-cd-commons</artifactId> <version>${project.version}</version> <scope>compile</scope> </dependency> diff --git a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/VespaTestRuntime.java b/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntime.java index 3a70a1ed531..5f6cc252d85 100644 --- a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/VespaTestRuntime.java +++ b/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntime.java @@ -1,13 +1,15 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.cd.impl; +package ai.vespa.hosted.cd.cloud.impl; import ai.vespa.cloud.Zone; import ai.vespa.hosted.api.ControllerHttpClient; +import ai.vespa.hosted.api.DefaultApiAuthenticator; +import ai.vespa.hosted.cd.commons.DefaultEndpointAuthenticator; import ai.vespa.hosted.api.Properties; import ai.vespa.hosted.api.TestConfig; import ai.vespa.hosted.cd.Deployment; import ai.vespa.hosted.cd.TestRuntime; -import ai.vespa.hosted.cd.impl.http.HttpDeployment; +import ai.vespa.hosted.cd.commons.HttpDeployment; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.zone.ZoneId; @@ -37,7 +39,7 @@ public class VespaTestRuntime implements TestRuntime { } private VespaTestRuntime(TestConfig config) { this.config = config; - this.deploymentToTest = new HttpDeployment(config.deployments().get(config.zone()), new ai.vespa.hosted.auth.EndpointAuthenticator(config.system())); + this.deploymentToTest = new HttpDeployment(config.deployments().get(config.zone()), new DefaultEndpointAuthenticator(config.system())); } @Override @@ -69,7 +71,7 @@ public class VespaTestRuntime implements TestRuntime { } private static TestConfig fromController() { - ControllerHttpClient controller = new ai.vespa.hosted.auth.ApiAuthenticator().controller(); + ControllerHttpClient controller = new DefaultApiAuthenticator().controller(); ApplicationId id = Properties.application(); Environment environment = Properties.environment().orElse(Environment.dev); ZoneId zone = Properties.region().map(region -> ZoneId.from(environment, region)) diff --git a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/VespaTestRuntimeProvider.java b/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntimeProvider.java index c27e1d4a0c9..d90a2d595c7 100644 --- a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/VespaTestRuntimeProvider.java +++ b/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/cloud/impl/VespaTestRuntimeProvider.java @@ -1,5 +1,5 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.cd.impl; +package ai.vespa.hosted.cd.cloud.impl; import ai.vespa.hosted.cd.internal.TestRuntimeProvider; import com.yahoo.component.AbstractComponent; diff --git a/cloud-tenant-cd/src/main/resources/META-INF/services/ai.vespa.hosted.cd.TestRuntime b/cloud-tenant-cd/src/main/resources/META-INF/services/ai.vespa.hosted.cd.TestRuntime index 35cb2ed7c25..884d7d4b171 100644 --- a/cloud-tenant-cd/src/main/resources/META-INF/services/ai.vespa.hosted.cd.TestRuntime +++ b/cloud-tenant-cd/src/main/resources/META-INF/services/ai.vespa.hosted.cd.TestRuntime @@ -1,2 +1,2 @@ # Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -ai.vespa.hosted.cd.impl.VespaTestRuntime
\ No newline at end of file +ai.vespa.hosted.cd.cloud.impl.VespaTestRuntime
\ No newline at end of file diff --git a/tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java b/hosted-api/src/main/java/ai/vespa/hosted/api/DefaultApiAuthenticator.java index 55b3af93050..cdd9a9a56dc 100644 --- a/tenant-auth/src/main/java/ai/vespa/hosted/auth/ApiAuthenticator.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/DefaultApiAuthenticator.java @@ -1,10 +1,7 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.auth; +package ai.vespa.hosted.api; -import ai.vespa.hosted.api.ControllerHttpClient; -import ai.vespa.hosted.api.Properties; - -public class ApiAuthenticator implements ai.vespa.hosted.api.ApiAuthenticator { +public class DefaultApiAuthenticator implements ai.vespa.hosted.api.ApiAuthenticator { /** Returns a controller client using mTLS if a key and certificate pair is provided, or signed requests otherwise. */ @Override @@ -126,9 +126,9 @@ <module>standalone-container</module> <module>statistics</module> <module>storage</module> - <module>tenant-auth</module> <module>tenant-base</module> <module>tenant-cd-api</module> + <module>tenant-cd-commons</module> <module>testutil</module> <module>vdslib</module> <module>vespaclient-core</module> diff --git a/tenant-auth/OWNERS b/tenant-auth/OWNERS deleted file mode 100644 index d0a102ecbf4..00000000000 --- a/tenant-auth/OWNERS +++ /dev/null @@ -1 +0,0 @@ -jonmv diff --git a/tenant-auth/README.md b/tenant-auth/README.md deleted file mode 100644 index c7552bd987c..00000000000 --- a/tenant-auth/README.md +++ /dev/null @@ -1,2 +0,0 @@ -<!-- Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -# Utilities that authenticate users to the hosted Vespa API, or to hosted Vespa applications. diff --git a/tenant-auth/src/test/java/ai/vespa/hosted/auth/AuthenticatorTest.java b/tenant-auth/src/test/java/ai/vespa/hosted/auth/AuthenticatorTest.java deleted file mode 100644 index 64282c26849..00000000000 --- a/tenant-auth/src/test/java/ai/vespa/hosted/auth/AuthenticatorTest.java +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.auth; - -public class AuthenticatorTest { - -} diff --git a/tenant-cd-commons/OWNERS b/tenant-cd-commons/OWNERS new file mode 100644 index 00000000000..0a0d219e4eb --- /dev/null +++ b/tenant-cd-commons/OWNERS @@ -0,0 +1,2 @@ +bjorncs +mortent diff --git a/tenant-cd-commons/README.md b/tenant-cd-commons/README.md new file mode 100644 index 00000000000..b1cd95606c8 --- /dev/null +++ b/tenant-cd-commons/README.md @@ -0,0 +1,3 @@ +# tenant-cd-commons + +Contains shared implementations of APIs/interfaces of `tenant-cd-api`.
\ No newline at end of file diff --git a/tenant-auth/pom.xml b/tenant-cd-commons/pom.xml index be8b42dd6c2..4d92be95c0b 100644 --- a/tenant-auth/pom.xml +++ b/tenant-cd-commons/pom.xml @@ -1,40 +1,56 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<!-- Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> + + <groupId>com.yahoo.vespa</groupId> + <artifactId>tenant-cd-commons</artifactId> + <packaging>jar</packaging> + <parent> <groupId>com.yahoo.vespa</groupId> <artifactId>parent</artifactId> <version>7-SNAPSHOT</version> - <relativePath>../parent/pom.xml</relativePath> + <relativePath>../parent</relativePath> </parent> - <artifactId>tenant-auth</artifactId> - <description>Provides resources for authenticating with the hosted Vespa API or application containers</description> <dependencies> + <!-- compile --> <dependency> <groupId>com.yahoo.vespa</groupId> - <artifactId>hosted-api</artifactId> + <artifactId>tenant-cd-api</artifactId> <version>${project.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>com.yahoo.vespa</groupId> - <artifactId>config-provisioning</artifactId> + <artifactId>security-utils</artifactId> <version>${project.version}</version> + <scope>provided</scope> </dependency> + + <!-- compile --> <dependency> <groupId>com.yahoo.vespa</groupId> - <artifactId>security-utils</artifactId> + <artifactId>hosted-api</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> + <groupId>com.yahoo.vespa</groupId> + <artifactId>config-provisioning</artifactId> + <version>${project.version}</version> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + </plugins> + </build> + </project> diff --git a/tenant-auth/src/main/java/ai/vespa/hosted/auth/EndpointAuthenticator.java b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/DefaultEndpointAuthenticator.java index a13e2d8ee56..89414cc069a 100644 --- a/tenant-auth/src/main/java/ai/vespa/hosted/auth/EndpointAuthenticator.java +++ b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/DefaultEndpointAuthenticator.java @@ -1,5 +1,5 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.auth; +package ai.vespa.hosted.cd.commons; import ai.vespa.hosted.api.Properties; import com.yahoo.config.provision.SystemName; @@ -26,12 +26,12 @@ import static ai.vespa.hosted.api.Properties.getNonBlankProperty; * * @author jonmv */ -public class EndpointAuthenticator implements ai.vespa.hosted.api.EndpointAuthenticator { +public class DefaultEndpointAuthenticator implements EndpointAuthenticator { - private static final Logger logger = Logger.getLogger(EndpointAuthenticator.class.getName()); + private static final Logger logger = Logger.getLogger(DefaultEndpointAuthenticator.class.getName()); /** Don't touch. */ - public EndpointAuthenticator(@SuppressWarnings("unused") SystemName __) { } + public DefaultEndpointAuthenticator(@SuppressWarnings("unused") SystemName __) { } /** * If {@code System.getProperty("vespa.test.credentials.root")} is set, key and certificate files diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/EndpointAuthenticator.java b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/EndpointAuthenticator.java index 81813335a63..e7936ddea7a 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/EndpointAuthenticator.java +++ b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/EndpointAuthenticator.java @@ -1,10 +1,9 @@ // Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.api; +package ai.vespa.hosted.cd.commons; import javax.net.ssl.SSLContext; import java.net.http.HttpRequest; import java.security.NoSuchAlgorithmException; -import java.util.Optional; /** * Adds environment dependent authentication to HTTP request against Vespa deployments. diff --git a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/http/HttpDeployment.java b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpDeployment.java index 65210455b85..90a33bcb513 100644 --- a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/http/HttpDeployment.java +++ b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpDeployment.java @@ -1,7 +1,6 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.cd.impl.http; +package ai.vespa.hosted.cd.commons; -import ai.vespa.hosted.api.EndpointAuthenticator; import ai.vespa.hosted.cd.Deployment; import ai.vespa.hosted.cd.Endpoint; diff --git a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/http/HttpEndpoint.java b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpEndpoint.java index f48973b7382..cf8865df878 100644 --- a/cloud-tenant-cd/src/main/java/ai/vespa/hosted/cd/impl/http/HttpEndpoint.java +++ b/tenant-cd-commons/src/main/java/ai/vespa/hosted/cd/commons/HttpEndpoint.java @@ -1,7 +1,6 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.hosted.cd.impl.http; +package ai.vespa.hosted.cd.commons; -import ai.vespa.hosted.api.EndpointAuthenticator; import ai.vespa.hosted.cd.Endpoint; import javax.net.ssl.SSLParameters; |