From b7dfb6091b868c7d0d9dad5baeffe72f5817aeca Mon Sep 17 00:00:00 2001 From: Retr0-XD <88275564+Retr0-XD@users.noreply.github.com> Date: Sat, 21 Mar 2026 15:10:56 +0530 Subject: [PATCH] gcs: add CustomEndpoint config option for GCS regional endpoints Adds a `custom_endpoint` configuration field to the GCS Config struct, allowing users to override the default Google Cloud Storage API endpoint. This is useful for: - Connecting to GCS regional endpoints for data residency compliance (https://cloud.google.com/storage/docs/regional-endpoints) - Connecting to GCS-compatible storage services When set, the endpoint is passed to the GCS client via option.WithEndpoint(). Fixes: https://github.com/thanos-io/thanos/issues/7862 Signed-off-by: Retr0-XD --- providers/gcs/gcs.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/providers/gcs/gcs.go b/providers/gcs/gcs.go index b8723b8ca0..2356db7ad6 100644 --- a/providers/gcs/gcs.go +++ b/providers/gcs/gcs.go @@ -59,6 +59,11 @@ type Config struct { // Overrides the default gcs storage client behavior if this value is greater than 0. // Set this to 1 to disable retries. MaxRetries int `yaml:"max_retries"` + + // CustomEndpoint allows overriding the default Google Cloud Storage API endpoint. + // This is useful for connecting to GCS-compatible services or GCP regional endpoints. + // See https://cloud.google.com/storage/docs/regional-endpoints for details. + CustomEndpoint string `yaml:"custom_endpoint"` } // Bucket implements the store.Bucket and shipper.Bucket interfaces against GCS. @@ -109,6 +114,9 @@ func NewBucketWithConfig(ctx context.Context, logger log.Logger, gc Config, comp if gc.noAuth { opts = append(opts, option.WithoutAuthentication()) } + if gc.CustomEndpoint != "" { + opts = append(opts, option.WithEndpoint(gc.CustomEndpoint)) + } opts = append(opts, option.WithUserAgent(fmt.Sprintf("thanos-%s/%s (%s)", component, version.Version, runtime.Version())), )