Skip to content

gcs: add endpoint configuration option#257

Open
rohansood10 wants to merge 1 commit intothanos-io:mainfrom
rohansood10:fix/7862-gcs-custom-endpoint
Open

gcs: add endpoint configuration option#257
rohansood10 wants to merge 1 commit intothanos-io:mainfrom
rohansood10:fix/7862-gcs-custom-endpoint

Conversation

@rohansood10
Copy link
Copy Markdown

Problem

Thanos currently does not support configuring a custom API endpoint for Google Cloud Storage. This prevents using GCS regional endpoints or GCS-compatible storage backends.

Fixes: thanos-io/thanos#7862

Solution

Added an endpoint field to the GCS Config struct. When set, it is passed as option.WithEndpoint() when creating the GCS storage client.

Configuration example

type: GCS
config:
  bucket: my-bucket
  endpoint: https://storage.europe-west3.rep.googleapis.com

Changes

  • providers/gcs/gcs.go: Added Endpoint field to Config struct and wired it through NewBucketWithConfig via option.WithEndpoint()
  • providers/gcs/gcs_test.go: Added tests for endpoint config parsing and bucket creation with custom endpoint

Notes

  • Follows the same pattern used by the S3 provider for custom endpoints
  • When endpoint is empty (default), behavior is unchanged
  • Compatible with both HTTP and gRPC client modes

@rohansood10 rohansood10 marked this pull request as ready for review March 8, 2026 12:50
Add an Endpoint field to the GCS bucket configuration that allows
specifying a custom GCS API endpoint. This is useful for testing
with emulators or connecting to GCS-compatible storage services.

The endpoint is passed through as a google.golang.org/api/option
WithEndpoint option when creating the GCS client.

Also updates README.md to document the new configuration field.

Fixes: thanos-io/thanos#7862
Signed-off-by: Rohan Sood <56945243+rohansood10@users.noreply.github.com>
@rohansood10 rohansood10 force-pushed the fix/7862-gcs-custom-endpoint branch from b8d46c5 to 34b9f71 Compare March 19, 2026 20:03
@rohansood10
Copy link
Copy Markdown
Author

@bwplotka @JoaoBraveCoding @GiedriusS hey! Fixed the DCO sign-off issue and rebased onto main. Would appreciate a review when you get a chance - this adds a configurable endpoint option for GCS, useful for emulator testing and GCS-compatible storage.

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.

Support setting endpoint for Google Cloud Storage (GCS) in Thanos

1 participant