-
Notifications
You must be signed in to change notification settings - Fork 319
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
[#4994][#4369] feat(core): support S3 credential vending #4966
Conversation
### What changes were proposed in this pull request? support credential vending framework ### Why are the changes needed? Fix: #4992 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? 1. add UT 2. propose a draft PR in #4966 , and could run pass S3 token with Gravitino IcebergRESTServer
@yuqi1129 @jerqi @jerryshao please help to review when you have time, thanks |
public class S3TokenCredential implements Credential { | ||
|
||
/** S3 token credential type. */ | ||
public static final String S3_TOKEN_CREDENTIAL_TYPE = "s3-token"; |
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.
what do you mean about token
and session-token
?
return uri.getHost(); | ||
} | ||
|
||
private Credentials getS3Token( |
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.
createS3Token?
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.
updated
StaticCredentialsProvider.create( | ||
AwsBasicCredentials.create( | ||
s3CredentialConfig.accessKeyID(), s3CredentialConfig.secretAccessKey())); | ||
String region = s3CredentialConfig.region(); |
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.
Builder builder = StsClient.builder()
.credentialsProvider(credentialsProvider);
if (StringUtils.isNotBlank(region)) {
builder.region(Region.of(region));
}
return builder.build();
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.
updated
} | ||
} | ||
|
||
private IamPolicy getPolicy( |
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.
createPolicy?
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.
updated
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
org.apache.gravitino.s3.credential.S3TokenProvider |
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 is AWS Hadoop Credential provider names
org.apache.hadoop.fs.s3a.TemporaryAWSCredentialsProvider,
org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider,
software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider,
org.apache.hadoop.fs.s3a.auth.IAMInstanceCredentialsProvider
Do we need to refer to them? Many people may be used to using them.
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 is for developers only, the user only care about credential provider type, like s3-token
for this, I'm ok to use this name, do you have some suggestion?
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 ok if it's only used by developers. But we need to make sure that s3-token
is easy to understand by users.
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.
Do you think s3-token
and s3-secret-key
is clear for users?
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.
What name do other systems use?
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.
polaris use storage-type
= s3
please refer to https://polaris.io/#tag/Polaris-Entities/Catalog, uc get s3 properties if the location is s3 schema, see https://docs.unitycatalog.io/server/configuration/
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.
Two consideration points.
- GCP is
gcp-token
? Should be thisaws-token
? - I am not sure token is correct enough? Does S3 have multiple tokens? Do we support all?
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.
- GCP is
gcs-token
, I prefer to keeps3-token
, because it's used for s3 storage. - We just support token from AsummRole, I think the name is simple and clear. You could provide your option if have better name.
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.
OK. I just discuss some possible names to make sure. I'm ok with current name.
@jerqi any other comments? |
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.
LGTM.
@jerryshao @yuqi1129 , do you have time to take another look? |
/** The static access key ID used to access S3 data. */ | ||
public static final String GRAVITINO_S3_ACCESS_KEY_ID = "s3-access-key-id"; | ||
/** The static secret access key used to access S3 data. */ | ||
public static final String GRAVITINO_S3_SECRET_ACCESS_KEY = "s3-secret-access-key"; |
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 is duplicated here and above, can you please consolidate them?
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.
yes, they are different properties in S3TokenCredential and S3SecretKeyCredential with same name.
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.
So please tell me what's the difference? If they're different, why do you use the same name and the same definition 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.
You didn't address this comment.
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.
sorry for miss this comment, Sts will response a sessionToken
with AccessKeyId
and secretAccessKey
which is different from the AKSK, do you think we should use a different name like sessionAccessKeyId
to make it more clear , but this maybe inconsistent with traditional s3 naming.
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 update the comment for the properties
private String accessKeyId; | ||
private String secretAccessKey; |
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 them final
here and below.
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.
updated
@FANNG1 please fix the ci problem. |
caused by temporal network error, fixed by rerun |
@jerryshao any other comments? |
/** The session access key ID used to access S3 data. */ | ||
public static final String GRAVITINO_S3_ACCESS_KEY_ID = "s3-access-key-id"; | ||
/** The session secret access key used to access S3 data. */ | ||
public static final String GRAVITINO_S3_SECRET_ACCESS_KEY = "s3-secret-access-key"; |
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.
Although the name of two key "static" and "session" are the same in S3, in the gravitino side, we can choose a different name to define, like "GRAVITINO_STATIC_S3_SECRET_ACCESS_KEY" and "GRAVITINO_SESSION_S3_SECRET_ACCESS_KEY"
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.
ok
/** The static secret access key used to access S3 data. */ | ||
public static final String GRAVITINO_S3_SECRET_ACCESS_KEY = "s3-secret-access-key"; | ||
public static final String GRAVITINO_S3_STATIC_SECRET_ACCESS_KEY = "s3-static-secret-access-key"; |
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 mean that we can still follow AWS convention to use "s3-secret-access-key", but the definition here in Gravitino can be a more differentiable name. like:
public static final String GRAVITINO_S3_STATIC_SECRET_ACCESS_KEY = "s3-secret-access-key";
Also for other keys, what do you think? @FANNG1
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.
ok
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.
updated
Please make the CI pass. |
### What changes were proposed in this pull request? support S3 credential vending, include s3 token and s3 static key ### Why are the changes needed? Fix: #4994 Fix: #4369 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? add IT to do Iceberg operation by using S3 token
What changes were proposed in this pull request?
support S3 credential vending, include s3 token and s3 static key
Why are the changes needed?
Fix: #4994
Fix: #4369
Does this PR introduce any user-facing change?
no
How was this patch tested?
add IT to do Iceberg operation by using S3 token