From 80eaca6f1d1eda772cbe4b7671f2e439c97c16af Mon Sep 17 00:00:00 2001 From: this-user Date: Wed, 19 Feb 2025 02:50:37 +0100 Subject: [PATCH] [Improvement] feat(iceberg): Enable setting of additional configuration parameters through environment variables (#6458) ### What changes were proposed in this pull request? Add the environment variables `GRAVITINO_JDBC_USER`, `GRAVITINO_JDBC_PASSWORD`, and `GRAVITINO_S3_ENDPOINT` to the `rewrite_config.py`, so database user and password can be set by the user in a container environment as well as a custom S3 endpoint. ### Why are the changes needed? Currently, JDBC user and PW are hardcoded to `iceberg` and cannot be changed when using the container images. One workaround is including the values in the JDBC connection string, but this neither elegant nor in line with how containers commonly handle this issue. Additionally, it wasn't possible to set the value of `gravitino.iceberg-rest.s3-endpoint` in a container environment, which can be useful in a variety of situations when using a provider other than AWS. ### Does this PR introduce _any_ user-facing change? Added the three aforementioned two environment variables that can be used by the user. ### How was this patch tested? Was tested locally only, since this is a minimal change. --- dev/docker/iceberg-rest-server/rewrite_config.py | 4 ++++ docs/iceberg-rest-service.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dev/docker/iceberg-rest-server/rewrite_config.py b/dev/docker/iceberg-rest-server/rewrite_config.py index 8b9b42a531c..652712039bf 100755 --- a/dev/docker/iceberg-rest-server/rewrite_config.py +++ b/dev/docker/iceberg-rest-server/rewrite_config.py @@ -21,6 +21,9 @@ env_map = { "GRAVITINO_IO_IMPL" : "io-impl", "GRAVITINO_URI" : "uri", + "GRAVITINO_JDBC_DRIVER": "jdbc-driver", + "GRAVITINO_JDBC_USER": "jdbc-user", + "GRAVITINO_JDBC_PASSWORD": "jdbc-password", "GRAVITINO_WAREHOUSE" : "warehouse", "GRAVITINO_CREDENTIAL_PROVIDER_TYPE" : "credential-providers", "GRAVITINO_CREDENTIAL_PROVIDERS" : "credential-providers", @@ -28,6 +31,7 @@ "GRAVITINO_GCS_SERVICE_ACCOUNT_FILE" : "gcs-service-account-file", "GRAVITINO_S3_ACCESS_KEY" : "s3-access-key-id", "GRAVITINO_S3_SECRET_KEY" : "s3-secret-access-key", + "GRAVITINO_S3_ENDPOINT" : "s3-endpoint", "GRAVITINO_S3_REGION" : "s3-region", "GRAVITINO_S3_ROLE_ARN" : "s3-role-arn", "GRAVITINO_S3_EXTERNAL_ID" : "s3-external-id", diff --git a/docs/iceberg-rest-service.md b/docs/iceberg-rest-service.md index 823ae5b03a3..6ea4a8bb05a 100644 --- a/docs/iceberg-rest-service.md +++ b/docs/iceberg-rest-service.md @@ -428,11 +428,15 @@ Gravitino Iceberg REST server in docker image could access local storage by defa |----------------------------------------|-----------------------------------------------------|------------------| | `GRAVITINO_IO_IMPL` | `gravitino.iceberg-rest.io-impl` | 0.7.0-incubating | | `GRAVITINO_URI` | `gravitino.iceberg-rest.uri` | 0.7.0-incubating | +| `GRAVITINO_JDBC_DRIVER` | `gravitino.iceberg-rest.jdbc-driver` | 0.9.0-incubating | +| `GRAVITINO_JDBC_USER` | `gravitino.iceberg-rest.jdbc-user` | 0.9.0-incubating | +| `GRAVITINO_JDBC_PASSWORD` | `gravitino.iceberg-rest.jdbc-password` | 0.9.0-incubating | | `GRAVITINO_WAREHOUSE` | `gravitino.iceberg-rest.warehouse` | 0.7.0-incubating | | `GRAVITINO_CREDENTIAL_PROVIDERS` | `gravitino.iceberg-rest.credential-providers` | 0.8.0-incubating | | `GRAVITINO_GCS_SERVICE_ACCOUNT_FILE` | `gravitino.iceberg-rest.gcs-service-account-file` | 0.8.0-incubating | | `GRAVITINO_S3_ACCESS_KEY` | `gravitino.iceberg-rest.s3-access-key-id` | 0.7.0-incubating | | `GRAVITINO_S3_SECRET_KEY` | `gravitino.iceberg-rest.s3-secret-access-key` | 0.7.0-incubating | +| `GRAVITINO_S3_ENDPOINT` | `gravitino.iceberg-rest.s3-endpoint` | 0.9.0-incubating | | `GRAVITINO_S3_REGION` | `gravitino.iceberg-rest.s3-region` | 0.7.0-incubating | | `GRAVITINO_S3_ROLE_ARN` | `gravitino.iceberg-rest.s3-role-arn` | 0.7.0-incubating | | `GRAVITINO_S3_EXTERNAL_ID` | `gravitino.iceberg-rest.s3-external-id` | 0.7.0-incubating |