Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove rt from bucket client contract
  • Loading branch information
ashwanthgoli committed Nov 12, 2024
commit 0afe96dd729a76ebfbb14573b7a1b366e625d021
4 changes: 4 additions & 0 deletions pkg/storage/bucket/azure/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package azure

import (
"flag"
"net/http"

"github.com/grafana/dskit/flagext"
)
Expand All @@ -15,6 +16,9 @@ type Config struct {
Endpoint string `yaml:"endpoint_suffix"`
MaxRetries int `yaml:"max_retries"`
UserAssignedID string `yaml:"user_assigned_id"`

// Allow upstream callers to inject a round tripper
Transport http.RoundTripper `yaml:"-"`
}

// RegisterFlags registers the flags for Azure storage
Expand Down
5 changes: 2 additions & 3 deletions pkg/storage/bucket/gcs/bucket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package gcs

import (
"context"
"net/http"

"github.com/go-kit/log"
"github.com/thanos-io/objstore"
"github.com/thanos-io/objstore/providers/gcs"
)

// NewBucketClient creates a new GCS bucket client
func NewBucketClient(ctx context.Context, cfg Config, name string, logger log.Logger, rt http.RoundTripper) (objstore.Bucket, error) {
func NewBucketClient(ctx context.Context, cfg Config, name string, logger log.Logger) (objstore.Bucket, error) {
// start with default http configs
bucketConfig := gcs.DefaultConfig
bucketConfig.Bucket = cfg.BucketName
Expand All @@ -19,5 +18,5 @@ func NewBucketClient(ctx context.Context, cfg Config, name string, logger log.Lo
bucketConfig.MaxRetries = cfg.MaxRetries
bucketConfig.HTTPConfig.Transport = cfg.Transport

return gcs.NewBucketWithConfig(ctx, logger, bucketConfig, name, rt)
return gcs.NewBucketWithConfig(ctx, logger, bucketConfig, name, nil)
}
6 changes: 2 additions & 4 deletions pkg/storage/bucket/s3/bucket_client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package s3

import (
"net/http"

"github.com/go-kit/log"
"github.com/prometheus/common/model"
"github.com/thanos-io/objstore"
Expand All @@ -16,13 +14,13 @@ const (
)

// NewBucketClient creates a new S3 bucket client
func NewBucketClient(cfg Config, name string, logger log.Logger, rt http.RoundTripper) (objstore.Bucket, error) {
func NewBucketClient(cfg Config, name string, logger log.Logger) (objstore.Bucket, error) {
s3Cfg, err := newS3Config(cfg)
if err != nil {
return nil, err
}

return s3.NewBucketWithConfig(logger, s3Cfg, name, rt)
return s3.NewBucketWithConfig(logger, s3Cfg, name, nil)
}

func newS3Config(cfg Config) (s3.Config, error) {
Expand Down
4 changes: 4 additions & 0 deletions pkg/storage/bucket/s3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"flag"
"fmt"
"net/http"
"slices"
"strings"
"time"
Expand Down Expand Up @@ -65,6 +66,9 @@ type HTTPConfig struct {
MaxIdleConnsPerHost int `yaml:"max_idle_connections_per_host" category:"advanced"`
MaxConnsPerHost int `yaml:"max_connections_per_host" category:"advanced"`

// Allow upstream callers to inject a round tripper
Transport http.RoundTripper `yaml:"-"`

TLSConfig TLSConfig `yaml:",inline"`
}

Expand Down
4 changes: 1 addition & 3 deletions pkg/storage/bucket/swift/bucket_client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package swift

import (
"net/http"

"github.com/go-kit/log"
"github.com/prometheus/common/model"
"github.com/thanos-io/objstore"
Expand All @@ -11,7 +9,7 @@ import (
)

// NewBucketClient creates a new Swift bucket client
func NewBucketClient(cfg Config, _ string, logger log.Logger, rt http.RoundTripper) (objstore.Bucket, error) {
func NewBucketClient(cfg Config, _ string, logger log.Logger) (objstore.Bucket, error) {
bucketConfig := swift.Config{
AuthVersion: cfg.AuthVersion,
AuthUrl: cfg.AuthURL,
Expand Down
Loading