Skip to content

Commit

Permalink
Update dskit to latest main.
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
  • Loading branch information
pstibrany committed Mar 31, 2022
1 parent 74b7190 commit b495621
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/golang/snappy v0.0.4
github.com/google/gopacket v1.1.19
github.com/gorilla/mux v1.8.0
github.com/grafana/dskit v0.0.0-20220331100536-6d48ca07ade5
github.com/grafana/dskit v0.0.0-20220331153937-d031b3624eb4
github.com/grafana/e2e v0.1.0
github.com/hashicorp/golang-lru v0.5.4
github.com/json-iterator/go v1.1.12
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -995,8 +995,8 @@ github.com/grafana-tools/sdk v0.0.0-20211220201350-966b3088eec9 h1:LQAhgcUPnzdjU
github.com/grafana-tools/sdk v0.0.0-20211220201350-966b3088eec9/go.mod h1:AHHlOEv1+GGQ3ktHMlhuTUwo3zljV3QJbC0+8o2kn+4=
github.com/grafana/dskit v0.0.0-20211021180445-3bd016e9d7f1/go.mod h1:uPG2nyK4CtgNDmWv7qyzYcdI+S90kHHRWvHnBtEMBXM=
github.com/grafana/dskit v0.0.0-20220112093026-95274ccc858d/go.mod h1:M0/dlftwBvH7+hdNNpjMa/CUXD7gsew67mbkCuDlFXE=
github.com/grafana/dskit v0.0.0-20220331100536-6d48ca07ade5 h1:qRn1ZfbsWq8LBgbwsTqNFRk90VN27kHB3muIDcvIVMw=
github.com/grafana/dskit v0.0.0-20220331100536-6d48ca07ade5/go.mod h1:q51XdMLLHNZJSG6KOGujC20ed2OoLFdx0hBmOEVfRs0=
github.com/grafana/dskit v0.0.0-20220331153937-d031b3624eb4 h1:9u3+6BoBFuyzHHtw2fHZXNn1m72hy9Cbcz8D5r+T71Y=
github.com/grafana/dskit v0.0.0-20220331153937-d031b3624eb4/go.mod h1:q51XdMLLHNZJSG6KOGujC20ed2OoLFdx0hBmOEVfRs0=
github.com/grafana/e2e v0.1.0 h1:nThd0U0TjUqyOOupSb+qDd4BOdhqwhR/oYbjoqiMlZk=
github.com/grafana/e2e v0.1.0/go.mod h1:+26VJWpczg2OU3D0537acnHSHzhJORpxOs6F+M27tZo=
github.com/grafana/memberlist v0.2.5-0.20211201083710-c7bc8e9df94b/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
Expand Down
16 changes: 8 additions & 8 deletions integration/e2emimir/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"

"github.com/go-kit/log"
"github.com/grafana/dskit/flagext"
"github.com/grafana/e2e"
e2edb "github.com/grafana/e2e/db"
"github.com/oklog/ulid"
Expand Down Expand Up @@ -43,13 +42,14 @@ func NewS3Client(cfg s3.Config) (*S3Client, error) {
}

func NewS3ClientForMinio(minio *e2e.HTTPService, bucketName string) (*S3Client, error) {
return NewS3Client(s3.Config{
Endpoint: minio.HTTPEndpoint(),
BucketName: bucketName,
SecretAccessKey: flagext.Secret{Value: e2edb.MinioSecretKey},
AccessKeyID: e2edb.MinioAccessKey,
Insecure: true,
})
cfg := s3.Config{
Endpoint: minio.HTTPEndpoint(),
BucketName: bucketName,
AccessKeyID: e2edb.MinioAccessKey,
Insecure: true,
}
cfg.SecretAccessKey.Set(e2edb.MinioSecretKey)
return NewS3Client(cfg)
}

// DeleteBlocks deletes all blocks for a tenant.
Expand Down
4 changes: 2 additions & 2 deletions pkg/mimir/sanity_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestCheckObjectStoresConfig(t *testing.T) {
bucketCfg.S3.Endpoint = "s3.dualstack.us-east-1.amazonaws.com"
bucketCfg.S3.BucketName = "invalid"
bucketCfg.S3.AccessKeyID = "xxx"
bucketCfg.S3.SecretAccessKey = flagext.Secret{Value: "yyy"}
bucketCfg.S3.SecretAccessKey.Set("yyy")

// Set a different bucket name for blocks storage to avoid config validation error.
if i == 0 {
Expand Down Expand Up @@ -122,7 +122,7 @@ func TestCheckObjectStoresConfig(t *testing.T) {
bucketCfg.Backend = bucket.Azure
bucketCfg.Azure.ContainerName = "invalid"
bucketCfg.Azure.StorageAccountName = ""
bucketCfg.Azure.StorageAccountKey = flagext.Secret{Value: "eHh4"}
bucketCfg.Azure.StorageAccountKey.Set("eHh4")

// Set a different container name for blocks storage to avoid config validation error.
if i == 0 {
Expand Down
8 changes: 7 additions & 1 deletion pkg/ruler/notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func TestBuildNotifierConfig(t *testing.T) {
Notifier: NotifierConfig{
BasicAuth: util.BasicAuth{
Username: "jacob",
Password: flagext.Secret{Value: "test"},
Password: secretWithValue("test"),
},
},
},
Expand Down Expand Up @@ -299,3 +299,9 @@ func TestBuildNotifierConfig(t *testing.T) {
})
}
}

func secretWithValue(v string) flagext.Secret {
s := flagext.Secret{}
_ = s.Set(v)
return s
}
2 changes: 1 addition & 1 deletion pkg/storage/bucket/azure/bucket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func NewBucketClient(cfg Config, name string, logger log.Logger) (objstore.Bucke
// HTTP Config field.
bucketConfig := azure.DefaultConfig
bucketConfig.StorageAccountName = cfg.StorageAccountName
bucketConfig.StorageAccountKey = cfg.StorageAccountKey.Value
bucketConfig.StorageAccountKey = cfg.StorageAccountKey.String()
bucketConfig.ContainerName = cfg.ContainerName
bucketConfig.Endpoint = cfg.Endpoint
bucketConfig.MaxRetries = cfg.MaxRetries
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/bucket/gcs/bucket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func NewBucketClient(ctx context.Context, cfg Config, name string, logger log.Logger) (objstore.Bucket, error) {
bucketConfig := gcs.Config{
Bucket: cfg.BucketName,
ServiceAccount: cfg.ServiceAccount.Value,
ServiceAccount: cfg.ServiceAccount.String(),
}

// Thanos currently doesn't support passing the config as is, but expects a YAML,
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/bucket/s3/bucket_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func newS3Config(cfg Config) (s3.Config, error) {
Endpoint: cfg.Endpoint,
Region: cfg.Region,
AccessKey: cfg.AccessKeyID,
SecretKey: cfg.SecretAccessKey.Value,
SecretKey: cfg.SecretAccessKey.String(),
Insecure: cfg.Insecure,
SSEConfig: sseCfg,
HTTPConfig: s3.HTTPConfig{
Expand Down
8 changes: 7 additions & 1 deletion pkg/storage/bucket/sse_bucket_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestSSEBucketClient_Upload_ShouldInjectCustomSSEConfig(t *testing.T) {
Endpoint: srv.Listener.Addr().String(),
Region: "test",
BucketName: "test-bucket",
SecretAccessKey: flagext.Secret{Value: "test"},
SecretAccessKey: secretWithValue("test"),
AccessKeyID: "test",
Insecure: true,
}
Expand Down Expand Up @@ -127,3 +127,9 @@ func (m *mockTenantConfigProvider) S3SSEKMSKeyID(_ string) string {
func (m *mockTenantConfigProvider) S3SSEKMSEncryptionContext(_ string) string {
return m.s3KmsEncryptionContext
}

func secretWithValue(v string) flagext.Secret {
s := flagext.Secret{}
_ = s.Set(v)
return s
}
8 changes: 4 additions & 4 deletions vendor/github.com/grafana/dskit/flagext/secret.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b495621

Please sign in to comment.