-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-2950] Support Ceph as a notebook storage #2598
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,8 @@ | |
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import com.amazonaws.AmazonClientException; | ||
| import com.amazonaws.ClientConfiguration; | ||
| import com.amazonaws.ClientConfigurationFactory; | ||
| import com.amazonaws.auth.AWSCredentialsProvider; | ||
| import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; | ||
| import com.amazonaws.services.s3.AmazonS3; | ||
|
|
@@ -94,33 +96,30 @@ public S3NotebookRepo(ZeppelinConfiguration conf) throws IOException { | |
|
|
||
| // always use the default provider chain | ||
| AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain(); | ||
| CryptoConfiguration cryptoConf = null; | ||
| CryptoConfiguration cryptoConf = new CryptoConfiguration(); | ||
| String keyRegion = conf.getS3KMSKeyRegion(); | ||
|
|
||
| if (StringUtils.isNotBlank(keyRegion)) { | ||
| cryptoConf = new CryptoConfiguration(); | ||
| cryptoConf.setAwsKmsRegion(Region.getRegion(Regions.fromName(keyRegion))); | ||
| } | ||
|
|
||
| ClientConfiguration cliConf = createClientConfiguration(); | ||
|
|
||
| // see if we should be encrypting data in S3 | ||
| String kmsKeyID = conf.getS3KMSKeyID(); | ||
| if (kmsKeyID != null) { | ||
| // use the AWS KMS to encrypt data | ||
| KMSEncryptionMaterialsProvider emp = new KMSEncryptionMaterialsProvider(kmsKeyID); | ||
| if (cryptoConf != null) { | ||
| this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp, cryptoConf); | ||
| } else { | ||
| this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp); | ||
| } | ||
| this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp, cliConf, cryptoConf); | ||
| } | ||
| else if (conf.getS3EncryptionMaterialsProviderClass() != null) { | ||
| // use a custom encryption materials provider class | ||
| EncryptionMaterialsProvider emp = createCustomProvider(conf); | ||
| this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp); | ||
| this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp, cliConf, cryptoConf); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
However, its internal process is not changed because |
||
| } | ||
| else { | ||
| // regular S3 | ||
| this.s3client = new AmazonS3Client(credentialsProvider); | ||
| this.s3client = new AmazonS3Client(credentialsProvider, cliConf); | ||
| } | ||
|
|
||
| // set S3 endpoint to use | ||
|
|
@@ -154,6 +153,22 @@ private EncryptionMaterialsProvider createCustomProvider(ZeppelinConfiguration c | |
| return emp; | ||
| } | ||
|
|
||
| /** | ||
| * Create AWS client configuration and return it. | ||
| * @return AWS client configuration | ||
| */ | ||
| private ClientConfiguration createClientConfiguration() { | ||
| ClientConfigurationFactory configFactory = new ClientConfigurationFactory(); | ||
| ClientConfiguration config = configFactory.getConfig(); | ||
|
|
||
| String s3SignerOverride = conf.getS3SignerOverride(); | ||
| if (StringUtils.isNotBlank(s3SignerOverride)) { | ||
| config.setSignerOverride(s3SignerOverride); | ||
| } | ||
|
|
||
| return config; | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The process of creating |
||
|
|
||
| @Override | ||
| public List<NoteInfo> list(AuthenticationInfo subject) throws IOException { | ||
| List<NoteInfo> infos = new LinkedList<>(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
The
ifbranch is removed for the simplicity but the internal process of each branch is not changed becausenew CryptoConfiguration()is called in thenew AmazonS3EncryptionClient(credentialsProvider, emp)constructor eventually.