-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-19471. ABFS: Support Fixed SAS Token at Container Level #7461
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-19471. ABFS: Support Fixed SAS Token at Container Level #7461
Conversation
💔 -1 overall
This message was automatically generated. |
c5b14bb
to
4a182ac
Compare
🎊 +1 overall
This message was automatically generated. |
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java
Outdated
Show resolved
Hide resolved
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java
Outdated
Show resolved
Hide resolved
...oop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java
Outdated
Show resolved
Hide resolved
🎊 +1 overall
This message was automatically generated. |
Test Results============================================================
|
b2cb26d
to
6915d0e
Compare
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -150,7 +150,9 @@ public void testBothProviderFixedTokenConfigured() throws Exception { | |||
* Helper method to get the Fixed SAS token value | |||
*/ | |||
private String getFixedSASToken(AbfsConfiguration config) throws Exception { | |||
return config.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(), "read"); | |||
String readPermission = "read"; |
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.
this should be a static string used as a constant.
testAbfsConfig.set(FS_AZURE_SAS_FIXED_TOKEN, accountSAS); | ||
|
||
// Assert that Container Specific Fixed SAS is used | ||
Assertions.assertThat(getFixedSASToken(testAbfsConfig)).contains("sr=c"); |
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.
Please add description for this.
|
||
// Assert that Account Specific Fixed SAS is used if container SAS isn't set | ||
testAbfsConfig.unset(containerProperty(FS_AZURE_SAS_FIXED_TOKEN, this.getFileSystemName(), this.getAccountName())); | ||
Assertions.assertThat(getFixedSASToken(testAbfsConfig)).contains("ss=bf"); |
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.
Same as above, please add description in all the assert.
//Assert that Account-Agnostic fixed SAS is used if no other fixed SAS configs are set. | ||
// The token is the same as the Account Specific Fixed SAS. | ||
testAbfsConfig.unset(accountProperty(FS_AZURE_SAS_FIXED_TOKEN, this.getAccountName())); | ||
Assertions.assertThat(getFixedSASToken(testAbfsConfig)).contains("ss=bf"); |
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.
Same as above.
* Helper method to get the Fixed SAS token value | ||
*/ | ||
private String getFixedSASToken(AbfsConfiguration config) throws Exception { | ||
return config.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(), |
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.
Please review the format. This line has too many characters.
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.
Corrected
@@ -322,6 +322,10 @@ public static String accountProperty(String property, String account) { | |||
return property + "." + account; | |||
} | |||
|
|||
public static String containerProperty(String property, String fsName, String account) { | |||
return property + "." + fsName + "." + account; |
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.
We can use DOT constant here (AbfsHttpConstants)
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.
Taken
* @return Container-specific configuration key | ||
*/ | ||
public String containerConf(String key) { | ||
return key + "." + fsName + "." + accountName; |
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.
We can use DOT constant here (AbfsHttpConstants)
0969033
to
f4c6458
Compare
🎊 +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.
Some changes in test code needed
...oop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java
Outdated
Show resolved
Hide resolved
...oop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java
Show resolved
Hide resolved
...oop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java
Show resolved
Hide resolved
...oop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java
Outdated
Show resolved
Hide resolved
22851b7
to
a800cda
Compare
🎊 +1 overall
This message was automatically generated. |
🎊 +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.
Some suggestions around documentation.
Rest Looks good.
f87a493
to
0e1ce6b
Compare
🎊 +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
…he#7461) Contributed by Manika Joshi Reviewed by Anuj Modi, Anmol Asrani, Manish Bhatt Signed off by Anuj Modi <anujmodi@apache.org>
…he#7461) Contributed by Manika Joshi Reviewed by Anuj Modi, Anmol Asrani, Manish Bhatt Signed off by Anuj Modi <anujmodi@apache.org>
…he#7461) Contributed by Manika Joshi Reviewed by Anuj Modi, Anmol Asrani, Manish Bhatt Signed off by Anuj Modi <anujmodi@apache.org>
… (#7597) Contributed by Manika Joshi Reviewed by Anuj Modi, Anmol Asrani, Manish Bhatt Signed off by Anuj Modi <anujmodi@apache.org>
Description of PR
The ABFS driver currently lacks support for multiple SAS tokens for the same storage account across different containers.
Introducing this support through this PR.
To use fixed SAS token at container level the configuration to be used is:
fs.azure.sas.fixed.token.<container-name>.<storage-account-name>
How was this patch tested?
Adding the test results in the comments below.