Skip to content
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

Add IAM Role support for exchange spooling on S3 #12536

Merged
merged 2 commits into from
May 27, 2022

Conversation

linzebing
Copy link
Member

Description

As title. Also drop a useless config.

Is this change a fix, improvement, new feature, refactoring, or other?

New feature

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

trino-exchange-filesystem

How would you describe this change to a non-technical end user or system administrator?

Related issues, pull requests, and links

Documentation

( ) No documentation is needed.
(x) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
(x) Release notes entries required with the following suggested text:

# Section
* Add IAM Role support for exchange spooling on S3. ({issue}`12444`)

@cla-bot cla-bot bot added the cla-signed label May 25, 2022
@linzebing linzebing requested review from arhimondr and losipiuk May 25, 2022 06:08
@github-actions github-actions bot added the docs label May 25, 2022
@losipiuk
Copy link
Member

Please note ci / error-prone-checks failure

@@ -455,6 +459,22 @@ private static AwsCredentialsProvider createAwsCredentialsProvider(ExchangeS3Con
return StaticCredentialsProvider.create(AwsBasicCredentials.create(config.getS3AwsAccessKey(), config.getS3AwsSecretKey()));
}

if (config.getS3IamRole().isPresent()) {
Copy link
Member

@losipiuk losipiuk May 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you validate config here that different configuration options are mutually exclusive?

  • both config.getS3AwsAccessKey() and config.getS3AwsSecretKey() must be either set or unset
  • if accessKey and secretKey are set then other auth related config options are not set.
  • externalId can only be set if iaRole is set

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need to do that because TrinoS3FileSystem didn't perform such checks. Also they are not really mutually exclusive, it's just that priority is different (static credentials > iamRole > default credentials)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fact that TS3FS does not do that is an omission.
Also unless I am missing sth they are mutually exclusive. If you set S3 Access and Secret key it does not matter what you set in IamRole as you would not get to line in code when you use that.
You would return in return StaticCredentialsProvider.create(AwsBasicCredentials.create(config.getS3AwsAccessKey(), config.getS3AwsSecretKey())); right?

Hence if user provides both access/secretKey and IAM role it is fishy, I would throw in such case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let me add the validations

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I made the assertions a bit more explicit and used IllegalArgumentException instead of verify (verify should rather be used for consistency assertions - for things that would never happen if system is working correctly).
PTAL if I did not mess anything up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this, but I think my version is more concise. We can merge it still

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it is :) But I think actionable error messages are more important than concise code.
I am also dumb - and reading concise code is hard for me :P

Copy link
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Small comment on validation

@linzebing linzebing force-pushed the exchange-spooling-iam-role branch from 64a1610 to 4138771 Compare May 25, 2022 20:39
@linzebing linzebing force-pushed the exchange-spooling-iam-role branch 2 times, most recently from e753799 to 33b1336 Compare May 25, 2022 21:59
@linzebing
Copy link
Member Author

CI: #12300

@losipiuk losipiuk force-pushed the exchange-spooling-iam-role branch from 33b1336 to 41f4084 Compare May 26, 2022 10:17
@losipiuk losipiuk merged commit 7e566b9 into trinodb:master May 27, 2022
@github-actions github-actions bot added this to the 383 milestone May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

IAM role support for exchange spooling on S3
3 participants