Skip to content

Support GCS vended credentials in Iceberg REST catalog - #28423

Merged
ebyhr merged 2 commits into
trinodb:masterfrom
kaveti:gcp-vended-credentials-support
Mar 24, 2026
Merged

ebyhr merged 2 commits into
trinodb:masterfrom
kaveti:gcp-vended-credentials-support

Conversation

@kaveti

@kaveti kaveti commented Feb 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

The Iceberg REST catalog spec allows the catalog server to return file IO properties in the load-table response. These can include cloud-specific credentials that override the connector's static settings on a per-table basis ("vended credentials").

Trino already supports vended S3 credentials (access key, secret key, session token), but GCS properties from the REST catalog response are currently ignored. This means users connecting to a REST catalog that vends GCS credentials (e.g., Tabular, Polaris, or custom implementations) cannot use them for GCS-backed tables.

For example, a REST catalog server managing tables across multiple GCP
projects might vend different gcs.project-id and gcs.oauth2.token
values per table. Without this change, Trino would always use the
statically configured credentials, which may not have access to all
tables.

This change adds support for the following GCS properties from vended credentials:

  • gcs.oauth2.token / gcs.oauth2.token-expires-at — short-lived OAuth2 access token and its expiration
  • gcs.project-id — GCP project ID (can differ per table if the catalog manages tables across projects)

These properties are extracted from fileIoProperties in IcebergRestCatalogFileSystemFactory and passed through ConnectorIdentity extra credentials to the GCS filesystem layer, where GcsStorageFactory creates an authenticated Storage client using the vended token.

These properties are extracted from fileIoProperties in
[IcebergRestCatalogFileSystemFactory] and passed through
ConnectorIdentity extra credentials to the GCS filesystem layer:

Fixes #24518

Release notes

## Iceberg
* Add support for vended credentials on GCS. ({issue}`24518 `)

@cla-bot cla-bot Bot added the cla-signed label Feb 23, 2026
@github-actions github-actions Bot added the iceberg Iceberg connector label Feb 23, 2026
@kaveti
kaveti force-pushed the gcp-vended-credentials-support branch from 9ffaa0f to 14c29f7 Compare February 23, 2026 14:58
@wendigo
wendigo requested review from ebyhr and findinpath February 24, 2026 11:17

@findinpath findinpath 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.

Thank you for your contribution - please focus on adding integration tests for the functionality.

Comment thread lib/trino-filesystem-gcs/src/main/java/io/trino/filesystem/gcs/GcsFileSystem.java Outdated
@kaveti
kaveti force-pushed the gcp-vended-credentials-support branch 2 times, most recently from 9783451 to 078d848 Compare February 27, 2026 09:54
@kaveti

kaveti commented Feb 27, 2026

Copy link
Copy Markdown
Contributor Author

thank you reviewing the PR. @findinpath i have addressed all your review comments. could you please take a look again.

@kaveti
kaveti force-pushed the gcp-vended-credentials-support branch 2 times, most recently from e234f58 to 18beb6a Compare March 2, 2026 10:21
Comment thread lib/trino-filesystem-gcs/src/main/java/io/trino/filesystem/gcs/GcsFileSystem.java Outdated
@kekwan

kekwan commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Much needed PR for GCS. Thanks @kaveti. PR LGTM, looks in-line with S3 implementation.

@kaveti
kaveti force-pushed the gcp-vended-credentials-support branch 2 times, most recently from d9b6b17 to d382c1f Compare March 5, 2026 10:25
@kaveti

kaveti commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

@findinpath could you please review again. i have addressed your review comments.

@wendigo wendigo added the stale-ignore Use this label on PRs that should be ignored by the stale bot so they are not flagged or closed. label Mar 10, 2026
@kaveti
kaveti requested review from c-thiel and deverant March 14, 2026 18:56
@findinpath

Copy link
Copy Markdown
Contributor

@kaveti reviewing again today.

@kaveti
kaveti force-pushed the gcp-vended-credentials-support branch from f5eb517 to 2f72988 Compare March 20, 2026 11:37
if (fileIoProperties.containsKey(GCPProperties.GCS_OAUTH2_TOKEN)) {
extraCredentialsBuilder.put(EXTRA_CREDENTIALS_GCS_OAUTH_TOKEN_PROPERTY, fileIoProperties.get(GCPProperties.GCS_OAUTH2_TOKEN));
addOptionalProperty(extraCredentialsBuilder, fileIoProperties, GCPProperties.GCS_OAUTH2_TOKEN_EXPIRES_AT, EXTRA_CREDENTIALS_GCS_OAUTH_TOKEN_EXPIRES_AT_PROPERTY);
addOptionalProperty(extraCredentialsBuilder, fileIoProperties, GCPProperties.GCS_PROJECT_ID, EXTRA_CREDENTIALS_GCS_PROJECT_ID_PROPERTY);

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.

Relevant information from @kaveti for the maintainer:

we have an internal irc service where the catalogs are configured to point to diff gcp projects. so the usecase is from trino we have one catalog and based on the table load IRC will give necessary tokens and project id. otherwise we have keep the static project on trino catalog level.

@kaveti
kaveti force-pushed the gcp-vended-credentials-support branch from 2f72988 to b9c270d Compare March 20, 2026 12:50
@rambleraptor

Copy link
Copy Markdown

I did some local testing on this PR and it appears to be working properly

@ebyhr

ebyhr commented Mar 21, 2026

Copy link
Copy Markdown
Member

/test-with-secrets sha=b9c270df30c5335ec8115d5d855ec26d4310eb41

@github-actions

github-actions Bot commented Mar 21, 2026 •

Copy link
Copy Markdown

The CI workflow run with tests that require additional secrets finished as failure: https://github.com/trinodb/trino/actions/runs/23368838842

@cla-bot

cla-bot Bot commented Mar 21, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

.put("iceberg.rest-catalog.vended-credentials-enabled", "true")
.put("iceberg.writer-sort-buffer-size", "1MB")
.put("fs.native-gcs.enabled", "true")
.buildOrThrow())

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.

.put("gcs.auth-type", "APPLICATION_DEFAULT")

This setting has been forgotton.

https://github.com/trinodb/trino/actions/runs/23368838842


TestIcebergGcsVendingRestCatalogConnectorSmokeTest.: plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestIcebergGcsVendingRestCatalogConnectorSmokeTest.java#L118Configuration errors: 1) Error: Invalid configuration property with prefix '': Either gcs.json-key or gcs.json-key-file-path must be set (for class GcsServiceAccountAuthConfig.authMethodValid) 1 error ====================== Full classname legend: ====================== GcsServiceAccountAuthConfig: "io.trino.filesystem.gcs.GcsServiceAccountAuthConfig" ======================== End of classname legend: ========================
--
 

<br class="Apple-interchange-newline">[TestIcebergGcsVendingRestCatalogConnectorSmokeTest.: plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/catalog/rest/TestIcebergGcsVendingRestCatalogConnectorSmokeTest.java#L118](https://github.com/trinodb/trino/commit/32b874a28de86f98f4d7fbe47a20326432ff2e26#annotation_48518247998)
Configuration errors: 1) Error: Invalid configuration property with prefix '': Either gcs.json-key or gcs.json-key-file-path must be set (for class GcsServiceAccountAuthConfig.authMethodValid) 1 error ====================== Full classname legend: ====================== GcsServiceAccountAuthConfig: "io.trino.filesystem.gcs.GcsServiceAccountAuthConfig" ======================== End of classname legend: ========================

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.

done

@kaveti
kaveti force-pushed the gcp-vended-credentials-support branch from b9c270d to 60eeffd Compare March 21, 2026 08:41
@kaveti

kaveti commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

/test-with-secrets sha=b9c270df30c5335ec8115d5d855ec26d4310eb41

1 similar comment
@kaveti

kaveti commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

/test-with-secrets sha=b9c270df30c5335ec8115d5d855ec26d4310eb41

@ebyhr

ebyhr commented Mar 22, 2026

Copy link
Copy Markdown
Member

@kaveti Note that only maintainers can run /test-with-secrets command.

@ebyhr

ebyhr commented Mar 22, 2026

Copy link
Copy Markdown
Member

/test-with-secrets sha=60eeffde9984b934ce01892f19253498d2fae984

@github-actions

github-actions Bot commented Mar 22, 2026 •

Copy link
Copy Markdown

The CI workflow run with tests that require additional secrets finished as failure: https://github.com/trinodb/trino/actions/runs/23415433626

.setInitialTables(REQUIRED_TPCH_TABLES)
.build();
}

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.

Error:  io.trino.plugin.iceberg.catalog.rest.TestIcebergGcsVendingRestCatalogConnectorSmokeTest.testDropTableWithMissingDataFile -- Time elapsed: 3.294 s <<< ERROR!
io.trino.filesystem.TrinoFileSystemException: GCS service error listing files: gs://trino-ci-test/gcs-vending-rest-test-j8tipshu69/tpch/test_drop_table_with_missing_data_file_t2q9q86zbq-c16f14599c9848f4983388f5b89b7194/data/
	at io.trino.filesystem.gcs.GcsUtils.handleGcsException(GcsUtils.java:46)
	at io.trino.filesystem.gcs.GcsFileSystem.listFiles(GcsFileSystem.java:222)
	at io.trino.filesystem.switching.SwitchingFileSystem.listFiles(SwitchingFileSystem.java:116)
	at io.trino.filesystem.tracing.TracingFileSystem.lambda$listFiles$0(TracingFileSystem.java:119)
	at io.trino.filesystem.tracing.Tracing.withTracing(Tracing.java:51)
	at io.trino.filesystem.tracing.TracingFileSystem.listFiles(TracingFileSystem.java:119)
	at io.trino.filesystem.tracking.TrackingFileSystem.listFiles(TrackingFileSystem.java:95)
	at io.trino.filesystem.cache.CacheFileSystem.listFiles(CacheFileSystem.java:106)
	at io.trino.plugin.iceberg.BaseIcebergConnectorSmokeTest.testDropTableWithMissingDataFile(BaseIcebergConnectorSmokeTest.java:660)

https://github.com/trinodb/trino/actions/runs/23415433626/job/68110003934

We're still missing

    @Override
    @BeforeAll
    public void initFileSystem()
    {
        byte[] jsonKeyBytes = Base64.getDecoder().decode(gcpCredentialKey);
        GcsFileSystemConfig config = new GcsFileSystemConfig();
        GcsServiceAccountAuthConfig authConfig = new GcsServiceAccountAuthConfig().setJsonKey(new String(jsonKeyBytes, UTF_8));
        GcsStorageFactory storageFactory;
        try {
            storageFactory = new GcsStorageFactory(config, new GcsServiceAccountAuth(authConfig));
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
        this.fileSystem = new GcsFileSystemFactory(config, storageFactory).create(SESSION);
    }

I'm still testing locally whether it works.

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.

I've found and proposed a fix for the issue here apache/iceberg#15734

@ebyhr in the context of dealing with the above mentioned apache/iceberg issue - could we proceed with temporarily overriding the failing methods with a TODO to re-enable them once that the fix will be avaiable?

kaveti added 2 commits March 24, 2026 14:55
This change adds support for the following GCS properties from vended credentials:

- gcs.oauth2.token / gcs.oauth2.token-expires-at — short-lived OAuth2 access token and its expiration
- gcs.project-id — GCP project ID (can differ per table if the catalog manages tables across projects)
@ebyhr
ebyhr force-pushed the gcp-vended-credentials-support branch from b8ce8b2 to 327412f Compare March 24, 2026 06:26
@ebyhr

ebyhr commented Mar 24, 2026

Copy link
Copy Markdown
Member

/test-with-secrets sha=327412fbd4c966f70f77a412d252bc6f14d28ef9

@github-actions

Copy link
Copy Markdown

The CI workflow run with tests that require additional secrets has been started: https://github.com/trinodb/trino/actions/runs/23476214902

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed iceberg Iceberg connector stale-ignore Use this label on PRs that should be ignored by the stale bot so they are not flagged or closed.

Development

Successfully merging this pull request may close these issues.

Iceberg REST Catalog: Support for vended credentials for GCP

7 participants