Skip to content

Add AwsVendedTokenProvider to renew the correct credentials. - #1098

Merged
tdas merged 13 commits into
unitycatalog:mainfrom
openinx:1096-aws-token-provider
Oct 9, 2025
Merged

tdas merged 13 commits into
unitycatalog:mainfrom
openinx:1096-aws-token-provider

Conversation

@openinx

@openinx openinx commented Oct 6, 2025

Copy link
Copy Markdown
Collaborator

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

Implement this aws token provider for this issue: #1096. This provider can accept the initialized credentials provider for the first time, and then it will automatically renew the credentials before the expiration time. So that the provider can always deliver the valid credentials to the upper layer.

import io.unitycatalog.spark.UCHadoopConf;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.shaded.com.google.common.base.Preconditions;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Since we will need to deploy this unitycatalog-spark jar and users need to add it as the dependency, then I will suggest to use the unity catalog relocated guava for the OSS-unitycatalog release.

But in this PR, I don't want to block it. So I temporarily use the hadoop's relocated guava. FYI @tdas

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Filed a separate issue for this : #1102

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

doesnt spark already have with guava as a transitive dependency? cant we just use that guava?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and i dont see you changing the build file in this PR. if this compiling, then this unitycatalog-spark project already has guava in its dependency .. either directly or via spark. isnt it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think it's indirectly using the hadoop's shaded guava, that's why it currently works fine.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think it should be okay to use the hadoop's guava here, especially the filesystem's CredentialsProvider or TokenProvider, because it's natively the hadoop filesystem plugin.

But in future, if the UCSingleCatalog wants to use the guava, or other place. Then it should be better to have our own shaded guava dep.

For this PR, I will suggest to keep it is. can be a separate task for further UC level guava shading.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

agreed.

@tdas tdas Oct 8, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does spark depend on guava? we can always use Spark's guava as UC-Spark will always definitely have Spark?
either ways .. not a blocker for this PR.

public static final String UC_PATH_OPERATION = "fs.unitycatalog.path.operation";

// Key indicating the credential request type, table or path.
public static final String UC_CREDENTIALS_TYPE = "fs.unitycatalog.credentials.type";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

copying this comment from other PR over here
#1087 (comment)

lets make the conf key strings have _KEY at the end of constant var name. for example ... ...CREDENTIALS_TYPE_KEY.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good to me, thanks for the reminder . Done !

public static final String S3A_INIT_CRED_EXPIRED_TIME = "fs.s3a.init.credential.expired.time";

// Keys for the UnityCatalog client.
public static final String UC_URI = "fs.unitycatalog.uri";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: any reason to have "fs" in the beginning? are there any special handling associated with configs that start with fs.* ?

also this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Since those keys are used for the filesystem's credentials provider, that's why I use the fs prefix. But it may also have problem, because the fs.unitycatalog always implies it's used for the unitycatalog filesystem, however we are not driving a new UnityCatlaogFileSystem. So maybe it's better to remove the fs. prefix ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thats what i was thinking.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, already removed the fs. prefix.

Comment thread build.sbt Resolved
@openinx

openinx commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator Author

Comment thread build.sbt Resolved
openinx added 11 commits October 8, 2025 14:33
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
@openinx
openinx force-pushed the 1096-aws-token-provider branch from c6f7d07 to 59c43a6 Compare October 8, 2025 21:33
Signed-off-by: Zheng Hu <[email protected]>
Comment thread build.sbt Resolved

@tdas tdas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.. just a few more minor comments. please address them and then we can merge.
thank you for starting this work and i look forward to the follow up PRs.

Signed-off-by: Zheng Hu <[email protected]>
@tdas
tdas merged commit a730f33 into unitycatalog:main Oct 9, 2025
openinx added a commit to openinx/unitycatalog that referenced this pull request Oct 10, 2025
…talog#1098)

**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [x] If you've fixed a bug or added code that should be tested, add
tests!
- [x] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

Implement this aws token provider for this issue:
unitycatalog#1096. This provider
can accept the initialized credentials provider for the first time, and
then it will automatically renew the credentials before the expiration
time. So that the provider can always deliver the valid credentials to
the upper layer.

---------

Signed-off-by: Zheng Hu <[email protected]>
openinx added a commit to openinx/unitycatalog that referenced this pull request Nov 6, 2025
…talog#1098)

**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [x] If you've fixed a bug or added code that should be tested, add
tests!
- [x] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

Implement this aws token provider for this issue:
unitycatalog#1096. This provider
can accept the initialized credentials provider for the first time, and
then it will automatically renew the credentials before the expiration
time. So that the provider can always deliver the valid credentials to
the upper layer.

---------

Signed-off-by: Zheng Hu <[email protected]>
tdas pushed a commit that referenced this pull request Nov 7, 2025
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] If there is a related issue, make sure it is linked to this PR.
- [x] If you've fixed a bug or added code that should be tested, add
tests!
- [x] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

Backport the #1098 to
branch-0.3, the related issue is here:
#1163

Signed-off-by: Zheng Hu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants