Skip to content

feat(catalog,io): refresh vended credentials#795

Open
rockwotj wants to merge 3 commits intoapache:mainfrom
rockwotj:vendor-creds-refresh
Open

feat(catalog,io): refresh vended credentials#795
rockwotj wants to merge 3 commits intoapache:mainfrom
rockwotj:vendor-creds-refresh

Conversation

@rockwotj
Copy link
Contributor

@rockwotj rockwotj commented Mar 17, 2026

Currently credential lifetimes are tied to the table instead, only load
table refreshes the credentials. This commit caches and refreshes the
credentials based on the response included in the table load response
and refreshes it dynamically.

This does still have the effect that holding on to a table IO for a long time does not refresh the table, but this makes steps in that direction.

Fixes: #792

Comment on lines +32 to +37
keyS3TokenExpiresAtMs = "s3.session-token-expires-at-ms"
keyAdlsSasExpiresAtMs = "adls.sas-token-expires-at-ms"
keyGcsOAuthExpiresAt = "gcs.oauth2.token-expires-at"
keyExpirationTime = "expiration-time"

defaultVendedCredentialsTTL = 60 * time.Minute
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zeroshade zeroshade changed the title rest: refresh vended credentials feat(catalog,io): refresh vended credentials Mar 18, 2026
Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

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

It looks like there's a storage-credential value in the LoadTable response that we should be checking. According to the docs we should be checking that first before we load credentials from the config. So it looks like there's two changes that are needed:

  1. The change i suggest below using the ..../credentials endpoint rather than refreshing the entire table
  2. The table load should check for the storage-credentials field in the response and then we should attach the list of credentials to the table IO. When creating a new IO instance we should first check the storage-credentials that were given, and then fallback to looking at the config properties if we don't find credentials in there.

@rockwotj rockwotj force-pushed the vendor-creds-refresh branch from e43594d to 12e0c3d Compare March 18, 2026 20:01
@github-actions github-actions bot added the INFRA label Mar 18, 2026
@rockwotj rockwotj force-pushed the vendor-creds-refresh branch from 12e0c3d to 803a82e Compare March 18, 2026 20:14
@github-actions github-actions bot removed the INFRA label Mar 18, 2026
@rockwotj rockwotj force-pushed the vendor-creds-refresh branch 2 times, most recently from f342e7f to d3795dc Compare March 18, 2026 20:24
@rockwotj rockwotj requested a review from zeroshade March 18, 2026 20:28
rockwotj added a commit to redpanda-data/connect that referenced this pull request Mar 18, 2026
It uses mainline of iceberg-go: apache/iceberg-go@6842055
With the following PRs applied on top:
- apache/iceberg-go#795
- apache/iceberg-go#803
@rockwotj
Copy link
Contributor Author

BTW I ran a test for a couple hours in aws with vended creds in polaris and it seemed to work.


func (r *Catalog) tableFromResponse(ctx context.Context, identifier []string, metadata table.Metadata, loc string, config iceberg.Properties) (*table.Table, error) {
func (r *Catalog) tableFromResponse(_ context.Context, identifier []string, metadata table.Metadata, loc string, config iceberg.Properties) (*table.Table, error) {
refresher := &vendedCredentialRefresher{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we need to only do this if credentials are vended, otherwise the refresher could spam a bunch of extra API calls retrying to refresh credentials

Copy link
Member

Choose a reason for hiding this comment

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

agreed

Copy link
Member

Choose a reason for hiding this comment

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

would it spam refreshes if there's no expiration provided for the creds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would it spam refreshes if there's no expiration provided for the creds?

No it defaults to 60 minute refresh, it's just if the catalog doesn't implement this endpoint and returns a 404 or something, then it could get spammed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm kicking off a couple hour test with polaris on aws to ensure the credential fetching works, but now we only do credential fetching if storage credentials field is populated from the catalog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah my soak test passed with this updated PR

Currently credential lifetimes are tied to the table instead, only load
table refreshes the credentials. This commit caches and refreshes the
credentials based on the response included in the table load response
and refreshes it dynamically.
Skip setting up the credential refresher when the catalog does not
vend storage credentials. Without this, the refresher would spam the
/credentials endpoint with API calls that return errors for catalogs
that do not support vended credentials.
@rockwotj rockwotj force-pushed the vendor-creds-refresh branch from d3795dc to 92b6250 Compare March 19, 2026 19:58
@rockwotj rockwotj requested a review from zeroshade March 19, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refresh vendored credentials

2 participants