Repository navigation
[Helm] Pass the credential encryption key from a Secret - #2175
Conversation
|
/review |
7ce207d to
cd484b0
Compare
|
/review |
cd484b0 to
7295513
Compare
|
/review |
7295513 to
59d5832
Compare
|
/review |
59d5832 to
80b6d85
Compare
|
/review |
80b6d85 to
5242e88
Compare
|
/review |
…s fail (#2176) ## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2176/files) to review incremental changes. - [stack/storage_errors](#2176) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2176/files)] --------- **Description of changes** The server's own AWS SDK calls (S3, STS) put the storage's error text, which can name its endpoint, into error responses. They now return a general error. - `StorageExceptions`: an `SdkException` in the cause chain becomes `INTERNAL` "Failed to access storage.", in `BaseExceptionHandler` and `TransactionManager` - the walk stops at a `BaseException`, which already says what callers get - the cause is kept, so the handler logs it once with the response - A failed `AssumeRole` returns `INTERNAL` "Failed to vend temporary storage credentials.", with the STS exception as its cause - A storage cleanup that fails this way records its error code and its cause's class, such as `INTERNAL caused by StsException`, still without any message text Behavior change: the status and error code of these failures are unchanged (`INTERNAL`, HTTP 500), but the message no longer includes the storage or STS text. A storage failure anywhere in the cause chain now takes precedence over the `INVALID_ARGUMENT`, `UNAUTHENTICATED` and database error-code mappings, so an `IllegalArgumentException` that wraps one is reported as `INTERNAL`. `BaseException`s the server builds itself, such as the region errors in `FileOperationsImpl`, are unaffected. Azure and GCS failures are not covered. Note: independent of the S3-compatible storage stack (#2170 to #2175, then #2169). Once this merges, #2172 adds a test that relies on this error handling. Tests: handler tests for the UC, Iceberg and Delta APIs; `TransactionManagerTest`; `CloudCredentialVendorTest`. **PR Checklist** - [x] 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. - [x] 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 This pull request and its description were written by Isaac. --------- Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
528ba43 to
ef682ec
Compare
|
/review |
ef682ec to
05a8753
Compare
|
/review |
05a8753 to
b080e62
Compare
|
/review |
b080e62 to
c04d536
Compare
|
/review |
c04d536 to
d0985e8
Compare
|
/review |
|
/review |
f1042c0 to
7cdc830
Compare
|
/review |
7cdc830 to
e2588b9
Compare
|
/review |
e2588b9 to
4443034
Compare
|
/review |
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2173/files) to review incremental changes. - [stack/s3compat_spec](#2170) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2170/files)] [MERGED] - [stack/s3compat_credentials](#2171) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2171/files)] [MERGED] - [stack/s3compat_vending](#2172) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2172/files)] [MERGED] - [**stack/s3compat_hadoop_cli**](#2173) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2173/files)] ← _this PR_ - [stack/s3compat_test_storage](#2174) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2174/files/7d5ddf7e9720b6f2cec3fc71ccb53d54d8673ae7..e7e2bc04280b0b124a3a9a3a2900c0e90f0b46ff)] - [stack/s3compat_helm_key](#2175) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2175/files/e7e2bc04280b0b124a3a9a3a2900c0e90f0b46ff..4443034338bd1eca465258461ca6426763358b6a)] - [stack/s3compat_credentials_text](#2169) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2169/files/4443034338bd1eca465258461ca6426763358b6a..ed888a1e8e6bd11d226dbc2c354006a9e26e3b8f)] --------- Part of a stack adding experimental S3-compatible storage (MinIO, Ceph, SeaweedFS, RustFS, Garage): #2170 (merged) to #2175, then #2169. Each PR builds on the one before it; the files changed since the previous PR are under the link above. **Description of changes** Engines use the endpoint and region vended for S3-compatible storage. - `S3CredPropsBuilder` sets `fs.s3a.bucket.<bucket>.endpoint`, `.endpoint.region` and `.path.style.access` per vended credential, and the vended keys with a provider that reads them (`SimpleAWSCredentialsProvider` or `TemporaryAWSCredentialsProvider`), or the vended provider with renewal, since a bucket option in the engine's configuration overrides a global one - the bucket is read from the prefix as text, so underscores and characters invalid in a URI work - two credentials that put one bucket on different storage are rejected - `FileSystemCredId`: for a bucket with an S3 endpoint, the credential-scoped file system cache key includes a hash of the bucket and every S3A option for it, at bucket scope and global (the endpoint and region, transport and signing options, and the engine's own S3A credentials, credential stores and assumed role), except the per-load `fs.s3a.init.*` credentials and other buckets' options, so one bucket name on two storages, or under two engine S3A configurations, never shares a file system ; for any S3 path without vended keys (the table load records whether the vended keys sign the bucket's requests, as `fs.unitycatalog.vended.s3.keys.<bucket>`: not for a keyless vend, several AWS S3 credentials without renewal, or an engine whose own bucket provider, bucket keys without renewal, or global provider without renewal signs instead, or, without renewal, any configured Hadoop credential store, which S3A reads before the vended keys, or S3A delegation tokens, whose token signs; a value only from Hadoop's own defaults, such as S3A's default provider list, does not count as the engine's), or a bucket the table load did not route, the key includes the S3A settings hash and the current Hadoop user, told apart as Hadoop's own file system cache does (so two users of one name with different credentials do not share), since the engine then signs with its own keys, which may differ per user however the engine resolves them; AWS S3 paths with vended keys keep their key, unless the engine sets a global `fs.s3a.endpoint` or `fs.s3a.endpoint.region`, or the bucket's own `endpoint.region` - Credentials without keys leave the engine's own S3A credentials in use, without the vended provider - S3-compatible keys and the vended provider are set only at the scope of their buckets; a table whose credentials are all S3-compatible gets no global provider or keys, so another bucket the file system opens does not get them. The storage hash matches the URI scheme case-insensitively. - several credentials with keys for S3-compatible storage need credential renewal and credential-scoped file systems, or the table load refuses them - a table's credentials are assumed to be all with keys or all without; a mix is rejected, with a `TODO` to process each credential on its own - Renewal only for credentials that can expire; several credentials always take the vended provider, which picks the one covering each path - the table load records each bucket's vended endpoint and region (`fs.unitycatalog.vended.s3.*`, empty for AWS S3), and a renewal for other storage, including a switch between AWS S3 and S3-compatible storage, fails with a message that names both storages and asks to load the table again, since the open file system keeps its endpoint; a renewal that changes only the region, as after the server first used a fallback, is taken; the initial credential's region travels as `fs.s3a.init.s3.region` - the check compares a renewal with the record of the bucket the file system serves (from its prefix, or the table's only recorded bucket), and refuses a renewal for another bucket, as for a table recreated elsewhere; it runs once per credential rather than per request; a bucket without a record, or a renewal with no storage path to check, takes only AWS S3 renewals; the provider credential cache keys on the recorded storage, so a table loaded for new storage does not get a credential cached for the old one; `fs.s3a.init.s3.endpoint` and `.region` are always written, empty when unset - `AwsVendedTokenProvider` returns `AwsBasicCredentials` for a key pair without a session token - a renewal that gets only the endpoint, for example after the server's vending mode changed, fails with a message to load the table again - A vended key pair without a session token sets `fs.s3a.session.token` to empty, so a configured token is not paired with it - When every credential is for S3-compatible storage, no global vended provider is set, and one the engine's own configuration lists is dropped from its list, keeping its other providers (an empty list is S3A's default chain), so the keys reach only their buckets - `DeltaKernelUtils` (CLI) sets the vended endpoint, region and, for S3-compatible storage, the keys at the table's bucket scope only (global keys for AWS S3); only a response with just the endpoint leaves the keys to the environment, and a session token that is set must not be empty; the CLI turns off Hadoop's S3A file system cache, whose key ignores the endpoint and keys - `AwsCredential` treats an empty endpoint, region or session token as absent, as the renewal path already did - The same-bucket check counts AWS S3 paths too, so a bucket name on both AWS and S3-compatible storage is rejected rather than sent to one of them - A session token stays required without an S3 endpoint: the provider reads the endpoint back from `fs.s3a.init.s3.endpoint`, and otherwise fetches from Unity Catalog as before; an empty `fs.s3a.init.session.token` is no token - Responses without storage credentials, or without a cloud config, still fail as before Known: - An open file system does not follow a change of a credential's storage: its renewal fails instead, and the next table load gets the new storage. - Without a bucket-scoped endpoint the cache key has no storage hash, so engine configurations that differ only in their own global `fs.s3a.endpoint` or path style share a credential-scoped file system, as before this change. - A credential store entry (`hadoop.security.credential.provider.path`) for a bucket's `access.key` or `secret.key` takes precedence over fixed vended keys, as for the global keys on the AWS path. The `--s3_*` CLI options are documented with the user docs, later in the series. Compatibility: AWS, Azure and GCS behavior is unchanged. Tests: Hadoop connector and CLI suites. **PR Checklist** - [x] 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. - [x] 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 This pull request and its description were written by Isaac. Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
4443034 to
d0fab88
Compare
|
/review |
d0fab88 to
e6386ee
Compare
timothyw553
left a comment
There was a problem hiding this comment.
the implementation looks sound from code inspection. i left questions about the public config and runtime coverage, plus a few docs comments.
| adls: | ||
| - storageAccountName: ciaccount | ||
| credentialsSecretName: ci-adls-credentials | ||
| encryptionKeySecretName: ci-credential-encryption |
There was a problem hiding this comment.
why does this server-wide key live under storage.credentials, and could we let users choose the secret entry too? could we use server.credentialEncryptionKeySecret with name and key before this becomes a public chart setting? otherwise users with an existing secret entry under another name have to copy it.
| ! grep -qF 'UC_SERVER_CREDENTIAL_ENCRYPTION_KEY' <<<"$default_render" || exit 1 | ||
| # With any database, in the one env list of the server container, and never in the file. | ||
| for values in "" "-f helm/ci/postgresql-values.yaml" "-f helm/ci/mysql-values.yaml"; do | ||
| key_only="$(helm template uc helm $values --set storage.credentials.encryptionKeySecretName=k)" |
There was a problem hiding this comment.
these checks only inspect rendered yaml, and the install tests supply neither the key nor the feature flag. could we extend one existing install case to create a secret using openssl rand -base64 32, set its name, enable server.s3-compatible-storage.enabled through server.config.extraProperties, and check that the server becomes ready? please keep coverage for the default install too.
|
|
||
| Required to create or use `s3_compatible` storage credentials, which are experimental: enable | ||
| them with `server.s3-compatible-storage.enabled: "true"` in `server.config.extraProperties`. | ||
| With that set, the server refuses to start with a malformed key. Keep the same key for as long |
There was a problem hiding this comment.
nit: could we name the feature flag explicitly here?
- # With that set, the server refuses to start with a malformed key. Keep the same key for as long
+ # with `server.s3-compatible-storage.enabled` enabled, the server refuses to start with a malformed key.
+ # keep the same key for as longcould we also add one complete values example showing both the secret name and the flag, and link to it from the server.config.override instructions? setting the secret name alone leaves the feature disabled.
|
/review |
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2174/files) to review incremental changes. - [stack/s3compat_spec](#2170) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2170/files)] [MERGED] - [stack/s3compat_credentials](#2171) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2171/files)] [MERGED] - [stack/s3compat_vending](#2172) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2172/files)] [MERGED] - [stack/s3compat_hadoop_cli](#2173) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2173/files)] [MERGED] - [**stack/s3compat_test_storage**](#2174) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2174/files)] ← _this PR_ - [stack/s3compat_helm_key](#2175) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2175/files/e4edf9f3cb2f7685ca8d668575fba4965e074cc0..e6386ee8b80766ae9be833dc4eacea0b024af8fd)] - [stack/s3compat_credentials_text](#2169) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2169/files/e6386ee8b80766ae9be833dc4eacea0b024af8fd..5f03fa8c88f5ccda9608158e0585bdcac6a8c08e)] --------- Part of a stack adding experimental S3-compatible storage (MinIO, Ceph, SeaweedFS, RustFS, Garage): #2170 (merged) to #2175, then #2169. Each PR builds on the one before it; the files changed since the previous PR are under the link above. **Description of changes** Runs the tests on real S3-compatible storage in Docker. Tests, sbt aliases and an `AGENTS.md` line only; the spec and connector changes in the diff against `main` come from #2170 to #2173. - `server/src/test/.../teststorage`: a harness selected by `UC_TEST_STORAGE`, like `UC_TEST_DATABASE` - MinIO, SeaweedFS and RustFS with STS - Ceph and Garage without STS, in both `static-key-vending` modes - sbt aliases: `testMinIO`, `testSeaweedFS`, `testRustFS`, `testCeph`, `testCephStaticKey`, `testGarage`, `testGarageStaticKey` - `S3CompatibleCredentialScopeTest`: on real storage, a session vended for a table, a path or a volume reaches only its directory (a sibling, a prefix twin and the bucket root are denied, for reads, writes, deletes and lists), a write credential deletes only there, and a read credential cannot write or delete - `S3CompatibleCredentialVendingTest`: every vending endpoint, per credential and mode - The storage suites and `BaseSparkIntegrationTest` turn on `server.s3-compatible-storage.enabled` (off by default in `BaseServerTest`) - `BaseSparkIntegrationTest` runs the Spark suites on the selected storage, resolved on use (`s3Storage()`) so a failed start reports its cause in each suite; with an endpoint-only vend the engine brings only the keys, and the routing comes from the vend, except for the bucket that gets none - `AGENTS.md` mentions the aliases - Each storage stops what it started when its start or setup fails, and `TestStorages.selected` remembers the failure, so later tests fail at once - `McRunner`, shared by MinIO and RustFS, retries a dropped or hung `mc` admin call (each attempt runs under `timeout` with at most 20 seconds of the time left) for up to a minute; a retried change already in effect counts as done; each harness S3 request is capped at 20 seconds, so the setup loops reach their deadline; Ceph and Garage setup commands run with a deadline too (`ContainerExec`), and a failed Ceph install points at `CEPH_VERSION`, since Ubuntu's index keeps only the newest build Not in CI: the aliases are run manually, and need Docker. Tests: Spark emulated; MinIO: scope, vending and Spark suites; Garage: vending and Spark suites (the scope suite is skipped, since Garage has no STS to scope sessions). **PR Checklist** - [x] 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. - [x] 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 This pull request and its description were written by Isaac. Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
e6386ee to
2591616
Compare
- `server.credentialEncryptionKeySecret` (`name`, `key` defaulting to `encryptionKey`): the Secret's key becomes `UC_SERVER_CREDENTIAL_ENCRYPTION_KEY`, with any database - CI: - render checks: the variable, a custom `key`, its absence by default, and the key never in the generated properties - the PostgreSQL install case turns on `server.s3-compatible-storage.enabled` with a generated key and checks the server read it - `docs/server/configuration.md`, a complete example in the chart README, and regenerated `helm/README.md` Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
2591616 to
072e1ad
Compare
|
/review |
timothyw553
left a comment
There was a problem hiding this comment.
thanks for addressing my comments. change is relatively straightforward
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2169/files) to review incremental changes. - [stack/s3compat_spec](#2170) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2170/files)] [MERGED] - [stack/s3compat_credentials](#2171) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2171/files)] [MERGED] - [stack/s3compat_vending](#2172) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2172/files)] [MERGED] - [stack/s3compat_hadoop_cli](#2173) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2173/files)] [MERGED] - [stack/s3compat_test_storage](#2174) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2174/files)] [MERGED] - [stack/s3compat_helm_key](#2175) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2175/files)] [MERGED] - [**stack/s3compat_credentials_text**](#2169) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2169/files)] ← _this PR_ - [stack/s3compat_location_endpoint](#2289) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2289/files/76859fc160061ad821312ef6bc69f986e9c44e5f..708dcb589fb36067a3e15464c2fd5513cddab4cb)] --------- Last of a stack adding experimental S3-compatible storage (MinIO, Ceph, SeaweedFS, RustFS, Garage): #2170 to #2175 are merged. **Description of changes** Stores credentials as text instead of PostgreSQL large objects, and widens the column on MySQL, where `tinytext` (255 bytes) is too small for real `s3_compatible` credentials with `assume_role`. It makes the change #1928 plans for `uc_credentials.credential`, and is a placeholder until #1928 and its follow-up merge. Builds on #2117 (merged): the server starts only once the steps have run, so it never sees the column before step V4. - `CredentialDAO.credential` drops `@Lob` and adds `length = 16777215` - Schema step `V4__credentials_credential_as_text`, one statement per database: - MySQL: `tinytext` to `mediumtext` - PostgreSQL: large object (`oid`) to `text`, through `convert_from(lo_get(credential), 'UTF8')` - H2: no change - Schema effect files for V4 - `docs/server/upgrades.md`: - the PostgreSQL step reads every credential's large object as UTF-8, as `hibernate.connection.username`; a missing or unreadable one fails it, with how to recover - the large objects stay (still holding the earlier stored values) for `vacuumlo`, and a release from before the step cannot read the converted column on PostgreSQL - Removes the `TODO(#2169)` on `CredentialDAO.setS3Compatible` - `SchemaMigratorTest.upgradeKeepsStoredCredentialsAndFitsLongerOnes`: a credential stored before the step (a large object on PostgreSQL, with two-, three- and four-byte characters) reads back as the same text, and one longer than 255 bytes fits, on all three databases; on PostgreSQL the old row is written through pgjdbc's large object path - `SchemaMigratorTest.upgradeWithAMissingLargeObjectChangesNothing`: on PostgreSQL, a credential whose large object is missing fails the step and leaves the column and the row as they were - `MigrationStepRulesTest`: MySQL `tinytext` widens to `text`, `mediumtext` or `longtext`; on PostgreSQL an `oid` column may change only as `TYPE text USING convert_from(lo_get(c), 'UTF8')`, the one allowed change that rows can fail, with cases for it; a plain type change of an `oid` column is refused - `SchemaMigratorTest.refusesAStepThatDropsAConstraintTheDatabaseNoLongerHasByThatName` brings the database to step 3 itself instead of to the newest step, so a later step no longer leaves a gap in its schema history - `BaseCredentialCRUDTest.testLongS3CompatibleCredential`: a credential over 1000 bytes, with non-ASCII text, round-trips through the server on every database Compatibility: no API change. Going back to an earlier release needs the database backup. Tests: `SchemaMigratorTest`, `BaselineMatchesEntitiesTest`, `MigrationStepRulesTest` and the credential and external location CRUD tests on H2, PostgreSQL 18 and MySQL 8 (`MigrationStepRulesTest` with `UC_TEST_MIGRATION_CHECKS=true`); all pass. **PR Checklist** - [x] 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. - [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 This pull request and its description were written by Isaac. Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
… on the external location (#2289) ## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2289/files) to review incremental changes. - [**stack/s3compat_location_endpoint**](#2289) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2289/files)] ← _this PR_ - [stack/s3compat_external_location_id](#2395) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2395/files/279e4214f62311816d4cec93fd0150a021d5f495..8a58c1528404e758093091408a9a4266eeb581e4)] --------- Finalizes S3-compatible storage, which the stack #2170 to #2175 and #2169 (all merged) built. **Description of changes** **Why.** The S3 endpoint belongs to the storage a location is on, not to the key pair that reaches it. With the endpoint on the credential, one credential could not serve locations on several storage hosts, and moving a bucket to a new host meant editing the credential. This PR moves the endpoint, and whether its requests are path-style, to the external location. The vend returns the location's settings beside the keys, so a client always gets the endpoint, region and addressing style that match the keys it signs with. It also takes the feature out of experimental status. **API** (`api/all.yaml`, `api/delta.yaml`, regenerated `api/` docs) Storage credential and external location: ```json {"name": "aistor_cred", "purpose": "STORAGE", "s3_compatible_access_key": {"access_key_id": "uc-user", "secret_access_key": "...", "sts_endpoint": "https://sts.example.com", "role_arn": "arn:aws:iam:::role/uc-tables"}} {"name": "aistor_loc", "url": "s3://sales/tables", "credential_name": "aistor_cred", "endpoint": "https://aistor.example.com", "path_style_access": true} ``` Vended credentials (`TemporaryCredentials`): ```json {"aws_temp_credentials": {"access_key_id": "...", "secret_access_key": "...", "session_token": "..."}, "expiration_time": 1764200000000, "external_location_settings": { "s3_compatible": {"endpoint": "https://aistor.example.com", "region": "us-east-1", "path_style_access": true}}} ``` - The credential field `s3_compatible` is renamed `s3_compatible_access_key` (`S3CompatibleAccessKeyRequest`/`Response`). It holds the keys plus the optional flat STS fields `sts_endpoint` and `role_arn`. `s3_endpoint`, the nested `assume_role` (`S3AssumeRole`) and `sts_region` are removed. - `CreateExternalLocation`, `UpdateExternalLocation` and `ExternalLocationInfo` get `endpoint` (`http[s]://host[:port]`, at most 2048 characters, without a path) and `path_style_access` (boolean). `UpdateExternalLocation.path_style_access` has its own description: it needs a stored `endpoint`, and leaving it out keeps the stored value. - A location's `endpoint` and a credential's `sts_endpoint` are stored, returned and vended with the scheme and host in lowercase. The `sts_endpoint` text states the same `http[s]://host[:port]` form, and `updateExternalLocation` says which rules fail with `INVALID_ARGUMENT`. - The schemas carry the server's limits: `maxLength: 2048` on the endpoint, `minLength: 1` on the keys, and `pattern: '^arn:'` on `role_arn`. Vended credentials carry the location's `endpoint`; a credential's `sts_endpoint` is only where the server calls STS, and is never vended. - `ui/src/types/api/catalog.gen.ts` is regenerated from `api/all.yaml`, which also picks up earlier spec changes it was missing (`browse_only`, `include_browse`, the required `purpose`). - `TemporaryCredentials` gets `external_location_settings` (`ExternalLocationSettings`), set exactly when the path is on S3-compatible storage. It has `s3_compatible` (`endpoint`, `region`, `path_style_access`). `AwsCredentials` carries only keys again: `s3_endpoint` and `s3_region` are removed. An endpoint-only vend returns the settings and `expiration_time` without `aws_temp_credentials`. - Delta API: the credential `config` key map carries `s3.endpoint`, `client.region` and `s3.path-style-access`, the same keys the Iceberg REST config uses. - No "EXPERIMENTAL" labels remain on S3-compatible storage. - `spec/protocols/ManagedDeltaTablesSpec.md` matches `api/delta.yaml`: the config carries `s3.endpoint`, `client.region` and the boolean `s3.path-style-access`, so its values are strings or a boolean, and a false or absent `s3.path-style-access` means virtual-hosted. **Rules** - A location has an `endpoint`, and may have `path_style_access`, exactly when it is on S3-compatible storage: required with an `s3_compatible_access_key` credential, refused with another, and kept after its credential is force-deleted. An update that leaves either out keeps the stored value. - A missing or false `path_style_access` means virtual-hosted. Then the bucket name must be a host name label: 3 to 63 lowercase letters, digits and hyphens, a letter or digit at both ends, and no dots, since a dot breaks wildcard TLS certificates. Create and update refuse other names and name the bucket. `ExternalLocationInfo` always returns `path_style_access` when the location has an `endpoint`. - STS is on when `role_arn` is set. It holds the ARN of the role to assume, for example `arn:aws:iam:::role/uc-tables`, sent unchanged as AssumeRole's `RoleArn`; a value that doesn't start with `arn:` is refused. Storage that ignores the role, such as MinIO, still needs an ARN-shaped value. `sts_endpoint` is allowed only with `role_arn`. Without it, AssumeRole goes to the location's endpoint, signed with the bucket region the server detects. - A location keeps its storage kind, which its stored `endpoint` decides, also after its credential was force-deleted. A location with an endpoint can only get another `s3_compatible_access_key` credential; one without can get neither an endpoint, nor `path_style_access`, nor such a credential. Moving a location to other storage means deleting it and creating a new one, so an update can't clear `endpoint` or `path_style_access`. A credential's type can't change while a location uses it; new keys or a new role can. - Changing `endpoint` or `path_style_access` of a location in use is refused unless `force` is set, with the same in-use check as a URL change. Resending the stored value isn't a change, and neither is an `endpoint` that differs only in the case of its scheme or host. - A location whose credential was force-deleted still checks its own settings on update: the endpoint form and length, the `s3://` URL, and the bucket rule for virtual-hosted addressing. Vending under it fails until it is repaired. **Server** - Schema steps `V20__external_location_endpoint` (nullable `varchar(2048)`) and `V21__external_location_path_style_access` (nullable boolean, `bit` on MySQL), with their effect files. A virtual-hosted location stores `false`, so the column is null exactly without an endpoint. - `ExternalLocationUtils.getExternalLocationCredentialForPath` returns the location together with its credential, read from one snapshot (`TransactionManager.snapshotIsolation`: REPEATABLE READ on PostgreSQL and MySQL, SERIALIZABLE on H2), so a vend never pairs a location with a credential from another committed state. A location of an `s3_compatible_access_key` credential without an endpoint fails the vend with `INTERNAL`, so keys are never sent to AWS S3 by mistake. - The location's endpoint, detected region and path style travel through `CredentialContext` and the vend cache key into `external_location_settings`; the `endpoint-only` client response, built after the cache in `StorageCredentialVendorImpl`, carries the same settings; the Iceberg REST config (`s3.endpoint`, `client.region`, `s3.path-style-access`) and the Delta config. Region discovery addresses the bucket as the location says. - The server property `server.s3-compatible-storage.enabled` is removed, with every guard that read it. The encryption key `server.credential-encryption-key` is now read whenever it's set: a malformed key refuses startup. Without a key, creating or updating an `s3_compatible_access_key` secret fails with `FAILED_PRECONDITION`, while stored credentials stay readable, renamable and deletable. `server.s3-compatible-storage.static-key-vending` is unchanged. **Clients** - Hadoop connector: reads the endpoint, region and path style from `external_location_settings.s3_compatible`. Settings that are absent mean AWS S3, and a missing `path_style_access` means virtual-hosted. It sets `fs.s3a.bucket.<bucket>.path.style.access`, records the style per bucket and in the file system cache id, and renewal refuses a changed style just as it refuses a changed endpoint. - CLI: - `credential create`/`update`: `--s3_endpoint` and `--s3_sts_region` are removed, and `--s3_role_arn` sets `role_arn`. - `external_location create`/`update`: new `--endpoint` and `--path_style_access`. - The Delta Kernel path reads the location's settings. - `docs/usage/cli.md` documents `--endpoint` and `--path_style_access` on `external_location create`/`update`, and that `--force` also covers an endpoint or path-style change on a location in use. - Docs, Helm and `etc/conf/server.properties` use the new names and no longer mention the enable property. The chart needs only `server.credentialEncryptionKeySecret`, and the Helm CI install case passes only the key Secret. **Tests** - External location CRUD (SDK and CLI): the endpoint rules and forms (including an over-long one), one credential on two endpoints, the storage-kind refusals, key and role changes of credentials in use, endpoint and path-style changes while in use (with and without `force`), locations whose credential was force-deleted, and `path_style_access` defaults, updates and the bucket-name rule. - Vending under an S3-compatible location whose credential was force-deleted fails, and works again after repair. - Mixed-case `endpoint` and `sts_endpoint` values on create and update are stored, returned and vended lowercased, and a case-only `endpoint` edit on a location in use needs no `force`. - Region discovery for one bucket on one endpoint with both addressing styles: `forcePathStyle(true)` and `forcePathStyle(false)`, cached apart. - Credential CRUD and DAO: `role_arn` and `sts_endpoint` validation. - Vending, unit and on real storage: the settings for STS sessions, static keys and endpoint-only vends. AssumeRole gets the role's ARN, the detected region, and the location endpoint as fallback. - The cache key includes the path style. - The Iceberg and Delta configs, for both path-style values. - AWS S3 credentials from the UC API, the Delta API and the constructors are equal: the path style is only kept with an endpoint, and a missing flag is virtual-hosted. - The cached credential id (`FileSystemCredId.create(Configuration)`) differs by endpoint, region and path style. - Connector and CLI settings, including renewal refusing a changed style, a bucket whose two paths differ only in style, and a cached credential not shared across styles. Both new connector tests fail when the style check or the `pathStyle.` key of the cache id is removed. - Secret store and repository behavior without a key or with a malformed one. - The real-storage harness reaches its containers at `127.0.0.1` ports, so its locations set `path_style_access: true`. Virtual-hosted addressing isn't run against real storage. Follow-ups: `external_location_id` in `ExternalLocationSettings` (#2395, stacked on this PR); `ExternalLocationSettings` entries for other storage types: `s3` (with `region`), `adls` and `gcs`. **Compatibility.** S3-compatible storage hasn't been released, so these API, property and CLI changes need no compatibility shim, and no data is migrated. Credentials, locations and vends for other storage are unchanged. **Tests run** on the final head, rebased onto main with #2268, #1928 and #2394: - `io.unitycatalog.server.migrate.*` with `UC_TEST_MIGRATION_CHECKS=true` on H2, PostgreSQL 18 and MySQL 8: 241 tests each. - `dev/run-tests.py`, full suite on H2: 4,085 tests. - The server suite on PostgreSQL 18 and on MySQL 8: 1,779 tests each. - On MinIO (`UC_TEST_STORAGE=MINIO`): the S3-compatible, external location and credential tests plus `spark/test`, 576 tests. - The Hadoop connector tests (1,530), on the head before the last rebase. - The Helm workflow's lint and render checks, and `helm/README.md` regenerated with helm-docs v1.14.2. - Regenerating the API docs and the UI types leaves no diff; `yarn test:format` passes in `ui/`, and `tsc --noEmit` reports no errors outside `node_modules`, as before. On an earlier head, before the endpoint length limit: the S3-compatible tests plus `spark/test` on Garage (555). All pass. **PR Checklist** - [x] 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. - [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 This pull request and its description were written by Isaac. --------- Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
🥞 Stacked PR
Use this link to review incremental changes.
Part of a stack adding experimental S3-compatible storage (MinIO, Ceph, SeaweedFS, RustFS, Garage): #2170 (merged) to #2175, then #2169. Each PR builds on the one before it; the files changed since the previous PR are under the link above.
Description of changes
The Helm chart passes the credential encryption key from a Kubernetes Secret.
server.credentialEncryptionKeySecret: the Secret named bynamegivesUC_SERVER_CREDENTIAL_ENCRYPTION_KEYfrom itskey(defaultencryptionKey), through the existing secret env helpers3_compatiblecredentials; unset by defaultopenssl rand -base64 32, turns onserver.s3-compatible-storage.enabled, and checks the server becomes ready and read the key; the file and MySQL cases keep the default installdocs/server/configuration.md: the key's environment variable, that the chart passes it with any database, and when it is neededserver.config.overrideandserver.credentialEncryptionKeySecret.namedocshelm/README.mdCompatibility: additive and opt-in.
PR Checklist
docsis updatedThis pull request and its description were written by Isaac.