Skip to content

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

Merged
zeroshade merged 3 commits into
apache:mainfrom
rockwotj:vendor-creds-refresh
Mar 25, 2026
Merged

zeroshade merged 3 commits into
apache:mainfrom
rockwotj:vendor-creds-refresh

Conversation

@rockwotj

@rockwotj rockwotj commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

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.

Comment thread catalog/rest/rest.go Resolved
@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
Copy Markdown
Contributor Author

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

Comment thread catalog/rest/rest.go Outdated

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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

agreed

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread catalog/rest/rest.go Resolved
Comment thread catalog/rest/rest.go Resolved
Comment thread catalog/rest/vended_creds.go Resolved
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
@rockwotj

Copy link
Copy Markdown
Contributor Author

@zeroshade gentle ping when you have some time, we have a few customers that are running successfully with this.

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good to me! Thanks for this!

@zeroshade
zeroshade merged commit b168e01 into apache:main Mar 25, 2026
13 checks passed
@rockwotj
rockwotj deleted the vendor-creds-refresh branch March 25, 2026 14:58
@laskoviymishka laskoviymishka mentioned this pull request Apr 3, 2026
96 tasks done
jwtryg pushed a commit to jwtryg/iceberg-go that referenced this pull request May 4, 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: apache#792
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
iceberg-cli 0.6.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* build(deps): bump the gomod_updates group with 18 updates by @dependabot[bot] in apache/iceberg-go#763
* build(deps): bump go.opentelemetry.io/otel/sdk from 1.39.0 to 1.40.0 by @dependabot[bot] in apache/iceberg-go#764
* fix: nil field Type causes unrecovered panic in MarshalJSON by @shtripat in apache/iceberg-go#765
* fix(manifest): handle lifecycle of the decoder in reader by @ferhatelmas in apache/iceberg-go#766
* feat(rest): add RegisterView to REST catalog by @shtripat in apache/iceberg-go#753
* fix(table): fix refcount leak in enrichRecordsWithPosDeleteFields by @laskoviymishka in apache/iceberg-go#762
* chore: Update copyright year in NOTICE file by @zeroshade in apache/iceberg-go#771
* refactor: make partition spec and sort order fields range friendly by @ferhatelmas in apache/iceberg-go#772
* feat(table): roll parquet files based on actual compressed size by @twuebi in apache/iceberg-go#759
* fix(table): ensure partition path is deterministic by @ferhatelmas in apache/iceberg-go#767
* build(deps): bump the gomod_updates group across 1 directory with 12 updates by @dependabot[bot] in apache/iceberg-go#782
* fix: skip pageSize query param when value is 0 by @alessandro-nori in apache/iceberg-go#778
* fix: handle LargeString columns in partition transforms by @hamilton-earthscope in apache/iceberg-go#780
* fix(table): removeSnaphosts postCommit now takes effect by @starpact in apache/iceberg-go#783
* feat: Implemented write-default and initial-default v3 by @PranjalChaitanya in apache/iceberg-go#779
* feat(table): add Scan.ReadTasks for reading pre-planned file scan tasks by @twuebi in apache/iceberg-go#781
* feat(table): export StructLike and GetPartitionRecord by @twuebi in apache/iceberg-go#791
* feat(catalog): refresh oauth tokens by @rockwotj in apache/iceberg-go#793
* feat(table): public write DataFile API by @twuebi in apache/iceberg-go#776
* fix: remove unnecessary safe-guard by @twuebi in apache/iceberg-go#775
* fix(table): don't always set schema.name-mapping.default by @rockwotj in apache/iceberg-go#803
* build(deps): bump google.golang.org/grpc from 1.79.2 to 1.79.3 by @dependabot[bot] in apache/iceberg-go#804
* feat(table): add RowDelta API for atomic row-level mutations by @laskoviymishka in apache/iceberg-go#789
* feate(hive): Add Create View for Hive catalog by @dttung2905 in apache/iceberg-go#788
* build(deps): bump the gomod_updates group with 2 updates by @dependabot[bot] in apache/iceberg-go#807
* fix(table): AddFiles: close file after usage and parallelize by @starpact in apache/iceberg-go#799
* feat(catalog): add TransactionalCatalog interface and REST multi-table commit by @laskoviymishka in apache/iceberg-go#787
* feat(catalog,io): refresh vended credentials by @rockwotj in apache/iceberg-go#795
* fix(table): AddFiles() should respect commit.manifest-merge.enabled by @RSP22 in apache/iceberg-go#806
* feat(table): configure Parquet DataPage version by @laskoviymishka in apache/iceberg-go#812
* chore: add CODEOWNERS file by @zeroshade in apache/iceberg-go#814
* fix(table): deadlock in MapExec when workers error by @laskoviymishka in apache/iceberg-go#810
* fix(table): add warnings for silent data-affecting behavior by @laskoviymishka in apache/iceberg-go#811
* build(deps): bump github.com/moby/buildkit from 0.27.1 to 0.28.1 by @dependabot[bot] in apache/iceberg-go#813
* feat(hive): adding register table in hive catalog by @Hashcode-Ankit in apache/iceberg-go#816
* feat(table): equality delete write path by @laskoviymishka in apache/iceberg-go#809
* feat(catalog): add CommitAndReload, error ctx, and 404 test for multi-tx by @laskoviymishka in apache/iceberg-go#817
* feat(types): add Parquet support for nanosecond timestamp types (v3) by @laskoviymishka in apache/iceberg-go#819
* build(deps): bump the gomod_updates group with 6 updates by @dependabot[bot] in apache/iceberg-go#822
* feat(table): enforce write-default and initial-default for required fields by @laskoviymishka in apache/iceberg-go#820
* feat(table): equality delete read path in scanner by @laskoviymishka in apache/iceberg-go#818
* feat(rest): add audience and resource params to OAuth requests by @lovromazgon in apache/iceberg-go#815
* feat(table): equality delete writing for partitioned tables by @laskoviymishka in apache/iceberg-go#823
* fix(table): goroutine leak in positionDeleteRecordsToDataFiles by @hcrosse in apache/iceberg-go#825
* fix(manifest): default to v1 files by @rockwotj in apache/iceberg-go#826
* feat(table): add Transaction.UpgradeFormatVersion by @rockwotj in apache/iceberg-go#827
* feat(table): multi-arg transforms in partition and sort fields by @laskoviymishka in apache/iceberg-go#824
* build(deps): bump github.com/go-jose/go-jose/v4 from 4.1.3 to 4.1.4 by @dependabot[bot] in apache/iceberg-go#828
* Thread context.Context through deletedEntries() by @Herrtian in apache/iceberg-go#847
* feat(table): Add statistics files to orphan cleanup referenced set by @dttung2905 in apache/iceberg-go#848
* build(deps): bump the gomod_updates group with 5 updates by @dependabot[bot] in apache/iceberg-go#854
* fix(ci): resolve flaky integration-setup by @laskoviymishka in apache/iceberg-go#858
* bench(table): read-perf degradation under equality delete pressure by @laskoviymishka in apache/iceberg-go#852
* fix(table): read Parquet batch size from table properties by @gabrnavarro in apache/iceberg-go#849
* feat(table): Add OpReplace to updateSnapshotSummaries by @dttung2905 in apache/iceberg-go#853
* feat(table): strengthen orphan-cleanup stats referenced-set tests and document empty-path guard by @dttung2905 in apache/iceberg-go#856
* fix: require Transform in NewSortOrder and add related tests by @Narwhal-fish in apache/iceberg-go#859
* feat(table): support delete file removal in overwrite commits by @laskoviymishka in apache/iceberg-go#851
* feat(table): classify deletion vectors in scan planning by @laskoviymishka in apache/iceberg-go#855
* build(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp from 1.41.0 to 1.43.0 by @dependabot[bot] in apache/iceberg-go#864
* feat(table): add bin-pack compaction strategy by @laskoviymishka in apache/iceberg-go#850
* build(deps): bump go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp from 1.38.0 to 1.43.0 by @dependabot[bot] in apache/iceberg-go#862
* fix: handle missing format-version in NewManifestReader for v1 manifests by @rockwotj in apache/iceberg-go#868
* docs: expand CONTRIBUTING.md with issue claiming and PR guidelines by @laskoviymishka in apache/iceberg-go#887
* build(deps): bump the gomod_updates group with 4 updates by @dependabot[bot] in apache/iceberg-go#872
* fix(table): prune StatisticsList and PartitionStatsList in RemoveSnapshots by @alliasgher in apache/iceberg-go#873
* fix(table): read retention table properties as defaults in ExpireSnapshots by @alliasgher in apache/iceberg-go#877
* feat(table): wire bloom filter properties into Parquet writer by @alliasgher in apache/iceberg-go#878
* fix(table): populate WriteTask.SortOrderID in data file writers by @alliasgher in apache/iceberg-go#875
* fix(schema): reject duplicate field IDs at schema construction by @alliasgher in apache/iceberg-go#879
* fix: emit proper Avro fixed schema for FixedType partition columns (#845) by @tanmayrauth in apache/iceberg-go#881
* fix(table): delete statistics files in ExpireSnapshots PostCommit #837 by @tanmayrauth in apache/iceberg-go#882
* refactor(table): collapse DataFileStatistics.ToDataFile args into DataFileOpts by @alliasgher in apache/iceberg-go#888
* perf(table): Decrease memory pressure by releasing records by @abhirathod95 in apache/iceberg-go#886
* fix(deletes): change equality_ids array elements avro schema type from Long to Integer to match spec by @rohilsurana in apache/iceberg-go#880
* feat(avro): replace hamba/avro with twmb/avro v1.5.0 by @twmb in apache/iceberg-go#871
* feat(compaction): add Analyze for dry-run compaction planning by @laskoviymishka in https://github.com/apache/iceberg-go/pull/

See merge request: Harmonybrew/homebrew-core!9291
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