Skip to content

HADOOP-18820. Cut AWS v1 support #5872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
70380c3
HADOOP-18820. Cut AWS v1 support
steveloughran Jul 21, 2023
8357400
HADOOP-18820. Cut AWS v1 support
steveloughran Jul 24, 2023
b282db3
HADOOP-18820. ongoing dev
steveloughran Jul 25, 2023
b608465
HADOOP-18820. RoleCredentialProvider
steveloughran Jul 26, 2023
4119dbc
HADOOP-18742. AWS v2 SDK: stabilise dependencies with rest of hadoop …
steveloughran May 17, 2023
e5672ef
HADOOP-18820. javadocs and dependencies
steveloughran Jul 27, 2023
d40b3fa
HADOOP-18830. S3 Select: deprecate and declare optional.
steveloughran Jul 27, 2023
3f5181c
HADOOP-18820 reinstate aws-crt as mandatory; mention in troubleshooting
steveloughran Jul 27, 2023
b73afe2
HADOOP-18820. Mukund comments on docs
steveloughran Jul 31, 2023
f8ecbbb
HADOOP-18820. comment from HADOOP-18795 applied
steveloughran Jul 31, 2023
0cf85e0
HADOOP-18820. javadoc and spotbug complaints.
steveloughran Aug 1, 2023
90abbde
HADOOP-18820. migration; cut back on V2Migration, remove Inconsistent…
steveloughran Aug 9, 2023
4553cb2
HADOOP-18820. SDK v1 cut: S3AInternals
steveloughran Aug 14, 2023
99273eb
HADOOP-18820. checkstyle, spotbugs, feedback and doc/xml updates
steveloughran Aug 15, 2023
34beeea
HADOOP-18820. checkstyle and minor code cleanups
steveloughran Aug 15, 2023
f6eeb29
HADOOP-18820. ITestS3AAWSCredentialsProvider enhancements
steveloughran Aug 15, 2023
644b390
HADOOP-18820. style and line endings
steveloughran Aug 16, 2023
f7b2638
HADOOP-18820: cut v1ProviderReferenced; update audit docs
steveloughran Aug 17, 2023
afc6787
HADOOP-18820. Audit handler migration.
steveloughran Aug 17, 2023
d89d95e
HADOOP-18820. EOLs in auditing.md
steveloughran Aug 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion LICENSE-binary
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ com.aliyun:aliyun-java-sdk-kms:2.11.0
com.aliyun:aliyun-java-sdk-ram:3.1.0
com.aliyun:aliyun-java-sdk-sts:3.0.0
com.aliyun.oss:aliyun-sdk-oss:3.13.2
com.amazonaws:aws-java-sdk-bundle:1.12.367
com.cedarsoftware:java-util:1.9.0
com.cedarsoftware:json-io:2.5.1
com.fasterxml.jackson.core:jackson-annotations:2.12.7
Expand Down Expand Up @@ -364,6 +363,8 @@ org.objenesis:objenesis:2.6
org.xerial.snappy:snappy-java:1.1.10.1
org.yaml:snakeyaml:2.0
org.wildfly.openssl:wildfly-openssl:1.1.3.Final
software.amazon.awssdk:bundle:jar:2.19.12
software.amazon.awssdk.crt:aws-crt:0.21.0


--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1241,61 +1241,31 @@
<description>AWS secret key used by S3A file system. Omit for IAM role-based or provider-based authentication.</description>
</property>

<property>
<name>fs.s3a.session.token</name>
<description>Session token, when using org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider
as one of the providers.
</description>
</property>

<property>
<name>fs.s3a.aws.credentials.provider</name>
<value>
org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider,
org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider,
com.amazonaws.auth.EnvironmentVariableCredentialsProvider,
software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider,
org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider
</value>
<description>
Comma-separated class names of credential provider classes which implement
com.amazonaws.auth.AWSCredentialsProvider.
software.amazon.awssdk.auth.credentials.AwsCredentialsProvider.

When S3A delegation tokens are not enabled, this list will be used
to directly authenticate with S3 and other AWS services.
When S3A Delegation tokens are enabled, depending upon the delegation
token binding it may be used
to communicate wih the STS endpoint to request session/role
credentials.

These are loaded and queried in sequence for a valid set of credentials.
Each listed class must implement one of the following means of
construction, which are attempted in order:
* a public constructor accepting java.net.URI and
org.apache.hadoop.conf.Configuration,
* a public constructor accepting org.apache.hadoop.conf.Configuration,
* a public static method named getInstance that accepts no
arguments and returns an instance of
com.amazonaws.auth.AWSCredentialsProvider, or
* a public default constructor.

Specifying org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider allows
anonymous access to a publicly accessible S3 bucket without any credentials.
Please note that allowing anonymous access to an S3 bucket compromises
security and therefore is unsuitable for most use cases. It can be useful
for accessing public data sets without requiring AWS credentials.

If unspecified, then the default list of credential provider classes,
queried in sequence, is:
* org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider: looks
for session login secrets in the Hadoop configuration.
* org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider:
Uses the values of fs.s3a.access.key and fs.s3a.secret.key.
* com.amazonaws.auth.EnvironmentVariableCredentialsProvider: supports
configuration of AWS access key ID and secret access key in
environment variables named AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
and AWS_SESSION_TOKEN as documented in the AWS SDK.
* org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider: picks up
IAM credentials of any EC2 VM or AWS container in which the process is running.
</description>
</property>

<property>
<name>fs.s3a.session.token</name>
<description>Session token, when using org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider
as one of the providers.
</description>
</property>

Expand Down Expand Up @@ -1393,10 +1363,10 @@
Note: for job submission to actually collect these tokens,
Kerberos must be enabled.

Options are:
Bindings available in hadoop-aws are:
org.apache.hadoop.fs.s3a.auth.delegation.SessionTokenBinding
org.apache.hadoop.fs.s3a.auth.delegation.FullCredentialsTokenBinding
and org.apache.hadoop.fs.s3a.auth.delegation.RoleTokenBinding
org.apache.hadoop.fs.s3a.auth.delegation.RoleTokenBinding
</description>
</property>

Expand Down
14 changes: 13 additions & 1 deletion hadoop-project/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
<aws-java-sdk.version>1.12.367</aws-java-sdk.version>
<hsqldb.version>2.7.1</hsqldb.version>
<aws-java-sdk-v2.version>2.19.12</aws-java-sdk-v2.version>
<aws.evenstream.version>1.0.1</aws.evenstream.version>
<awscrt.version>0.21.0</awscrt.version>
<frontend-maven-plugin.version>1.11.2</frontend-maven-plugin.version>
<jasmine-maven-plugin.version>2.1</jasmine-maven-plugin.version>
Expand Down Expand Up @@ -1132,18 +1133,29 @@
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>${aws-java-sdk.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bundle</artifactId>
<version>${aws-java-sdk-v2.version}</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.amazon.eventstream</groupId>
<artifactId>eventstream</artifactId>
<version>${aws.evenstream.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions hadoop-tools/hadoop-aws/dev-support/findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
<Field name="futurePool"/>
<Bug pattern="IS2_INCONSISTENT_SYNC"/>
</Match>
<Match>
<Class name="org.apache.hadoop.fs.s3a.S3AFileSystem"/>
<Field name="s3AsyncClient"/>
<Bug pattern="IS2_INCONSISTENT_SYNC"/>
</Match>
<Match>
<Class name="org.apache.hadoop.fs.s3a.s3guard.S3GuardTool$BucketInfo"/>
<Method name="run"/>
Expand Down
22 changes: 20 additions & 2 deletions hadoop-tools/hadoop-aws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,16 @@
<bannedImport>org.apache.hadoop.mapred.**</bannedImport>
</bannedImports>
</restrictImports>
<restrictImports>
<includeTestCode>false</includeTestCode>
<reason>Restrict AWS v1 imports to adapter code</reason>
<exclusions>
<exclusion>org.apache.hadoop.fs.s3a.adapter.V1ToV2AwsCredentialProviderAdapter</exclusion>
</exclusions>
<bannedImports>
<bannedImport>com.amazonaws.**</bannedImport>
</bannedImports>
</restrictImports>
</rules>
</configuration>
</execution>
Expand Down Expand Up @@ -494,10 +504,14 @@
<scope>test</scope>
<type>test-jar</type>
</dependency>

<!-- The v1 SDK is used at compilation time for adapter classes in
org.apache.hadoop.fs.s3a.adapter. It is not needed at runtime
unless a non-standard v1 credential provider is declared. -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
Expand All @@ -507,7 +521,11 @@
<dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>software.amazon.eventstream</groupId>
<artifactId>eventstream</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,21 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.auth.BasicSessionCredentials;
import org.apache.hadoop.classification.VisibleForTesting;
import org.apache.hadoop.fs.s3a.adapter.V1V2AwsCredentialProviderAdapter;
import org.apache.hadoop.util.Preconditions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.classification.VisibleForTesting;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.fs.s3a.auth.NoAuthWithAWSException;
import org.apache.hadoop.fs.s3a.auth.NoAwsCredentialsException;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.util.Preconditions;

import software.amazon.awssdk.auth.credentials.AnonymousCredentialsProvider;
import software.amazon.awssdk.auth.credentials.AwsCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.AwsSessionCredentials;
import software.amazon.awssdk.core.exception.SdkException;

/**
Expand Down Expand Up @@ -106,23 +99,8 @@ public AWSCredentialProviderList() {
* @param providers provider list.
*/
public AWSCredentialProviderList(
Collection<AWSCredentialsProvider> providers) {
for (AWSCredentialsProvider provider: providers) {
this.providers.add(V1V2AwsCredentialProviderAdapter.adapt(provider));
}
}

/**
* Create with an initial list of providers.
* @param name name for error messages, may be ""
* @param providerArgs provider list.
*/
public AWSCredentialProviderList(final String name,
final AWSCredentialsProvider... providerArgs) {
setName(name);
for (AWSCredentialsProvider provider: providerArgs) {
this.providers.add(V1V2AwsCredentialProviderAdapter.adapt(provider));
}
Collection<AwsCredentialsProvider> providers) {
this.providers.addAll(providers);
}

/**
Expand All @@ -148,14 +126,6 @@ public void setName(final String name) {
}
}

/**
* Add a new provider.
* @param provider provider
*/
public void add(AWSCredentialsProvider provider) {
providers.add(V1V2AwsCredentialProviderAdapter.adapt(provider));
}

/**
* Add a new SDK V2 provider.
* @param provider provider
Expand All @@ -164,7 +134,6 @@ public void add(AwsCredentialsProvider provider) {
providers.add(provider);
}


/**
* Add all providers from another list to this one.
* @param other the other list.
Expand All @@ -174,19 +143,11 @@ public void addAll(AWSCredentialProviderList other) {
}

/**
* This method will get credentials using SDK V2's resolveCredentials and then convert it into
* V1 credentials. This required by delegation token binding classes.
* @return SDK V1 credentials
* Was an implementation of the v1 refresh; now just
* a no-op.
*/
public AWSCredentials getCredentials() {
AwsCredentials credentials = resolveCredentials();
if (credentials instanceof AwsSessionCredentials) {
return new BasicSessionCredentials(credentials.accessKeyId(),
credentials.secretAccessKey(),
((AwsSessionCredentials) credentials).sessionToken());
} else {
return new BasicAWSCredentials(credentials.accessKeyId(), credentials.secretAccessKey());
}
@Deprecated
public void refresh() {
}

/**
Expand Down Expand Up @@ -257,8 +218,7 @@ public AwsCredentials resolveCredentials() {
*
* @return providers
*/
@VisibleForTesting
List<AwsCredentialsProvider> getProviders() {
public List<AwsCredentialsProvider> getProviders() {
return providers;
}

Expand Down Expand Up @@ -290,9 +250,11 @@ public String listProviderNames() {
*/
@Override
public String toString() {
return "AWSCredentialProviderList[" +
name +
"refcount= " + refCount.get() + ": [" +
return "AWSCredentialProviderList"
+ " name=" + name
+ "; refcount= " + refCount.get()
+ "; size="+ providers.size()
+ ": [" +
StringUtils.join(providers, ", ") + ']'
+ (lastProvider != null ? (" last provider: " + lastProvider) : "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,11 +727,19 @@ private Constants() {
public static final String STREAM_READ_GAUGE_INPUT_POLICY =
"stream_read_gauge_input_policy";

/**
* S3 Client Factory implementation class: {@value}.
* Unstable and incompatible between v1 and v2 SDK versions.
*/
@InterfaceAudience.Private
@InterfaceStability.Unstable
public static final String S3_CLIENT_FACTORY_IMPL =
"fs.s3a.s3.client.factory.impl";

/**
* Default factory:
* {@code org.apache.hadoop.fs.s3a.DefaultS3ClientFactory}.
*/
@InterfaceAudience.Private
@InterfaceStability.Unstable
public static final Class<? extends S3ClientFactory>
Expand Down
Loading