-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
HADOOP-18980. S3A credential provider remapping: make extensible #6406
Conversation
Tested against
|
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@steveloughran could you please review this PR? |
🎊 +1 overall
This message was automatically generated. |
@mukund-thakur could you please review this PR if you have bandwidth? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be happier if Configuration was left alone...its a key class and marked as Stable.
instead
- add tests for StringUtils in TestStringUtils
- use the new method there in the hadoop-aws code
@@ -68,6 +68,10 @@ private Constants() { | |||
public static final String AWS_CREDENTIALS_PROVIDER = | |||
"fs.s3a.aws.credentials.provider"; | |||
|
|||
// aws credentials providers mapping with key/value pairs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: javadocs with @value
@@ -233,6 +236,11 @@ public static AWSCredentialProviderList buildAWSProviderList( | |||
key, className, mapped); | |||
className = mapped; | |||
} | |||
if (awsCredsMappedClasses != null && awsCredsMappedClasses.containsKey(className)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make an else
unless we really want to support remapping of the standard map to different values. Which I suppose we might...
@@ -233,6 +236,11 @@ public static AWSCredentialProviderList buildAWSProviderList( | |||
key, className, mapped); | |||
className = mapped; | |||
} | |||
if (awsCredsMappedClasses != null && awsCredsMappedClasses.containsKey(className)) { | |||
final String mapped = awsCredsMappedClasses.get(className); | |||
LOG_REMAPPED_ENTRY.info("Credential entry {} is mapped to {}", className, mapped); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug
ASSUMED_ROLE_CREDENTIALS_PROVIDER, | ||
new ArrayList<>(), | ||
new HashSet<>()); | ||
assertEquals("Credentials not matching", 3, credentials.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertJ size assert
AWS_CREDENTIALS_PROVIDER, | ||
new ArrayList<>(), | ||
new HashSet<>()); | ||
assertEquals("Credentials not matching", 4, credentials.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertJ. It's predictable I'll expect these, save time by embracing the api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really good one, API rich, gives nice error msg. I really wish to start using it for all other projects too.
Some don't even use "error msg string for AssertionError" for assertEquals etc, making flaky tests debugging annoying at times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like its collection assertion reporting, as well as other things. If you look at IOStatisticAssertions
you can also see how it is possible to write new ones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, IOStatisticAssertions
is another level :)
Addressed all comments. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
I still need to remove the utility from conf and use StringUtils directly in aws module. |
This is done in the latest revision. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- use hasSize() is assertions on map size; this can be mixed with the containsEntry() clauses. There's a
containsOnly()
clause which may help there too. - Needs documentation in
aws_sdk_upgrade.md
under "Credential Provider changes"
conf.set("custom_key", ""); | ||
Map<String, String> splitMap = | ||
conf.getTrimmedStringCollectionSplitByEquals("custom_key"); | ||
Assertions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
assertThat(splitMap).hasSize(0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, btw TestConfiguration changes are removed after reverting Configuration class changes as per your previous feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy with all the code, just doing the final doc proofreading
pair provided by this config. | ||
|
||
For example, if `fs.s3a.aws.credentials.provider.mapping` is set with value: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: prefer triple backslash over indentation as it allows for us to specify the format.
now: should we actually include this as an XML snippet or not? I'm of mixed feelings here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried xml snippet to see how it looks and actually it looks better because now the example is much clear. Please let me know what you think of the latest revision.
With the above key-value pairs, if `fs.s3a.aws.credentials.provider` specifies | ||
`com.amazonaws.auth.AnonymousAWSCredentials`, it will be remapped to | ||
`org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider` by S3A while preparing | ||
AWS credential provider list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "the AWS credential provider list"
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, merging.
…che#6406) Contributed by Viraj Jasani
branch-3.4 backport PR: #6525 |
…che#6406) Contributed by Viraj Jasani
Contributed by Viraj Jasani
Contributed by Viraj Jasani
…als (ADDENDUM) (#6546) This is a followup to #6406: HADOOP-18980. S3A credential provider remapping: make extensible It adds extra validation of key-value pairs in a configuration option, with tests. Contributed by Viraj Jasani
…als (ADDENDUM) (#6546) This is a followup to #6406: HADOOP-18980. S3A credential provider remapping: make extensible It adds extra validation of key-value pairs in a configuration option, with tests. Contributed by Viraj Jasani
Jira: HADOOP-18980