Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor bucket configuration flags for Object Store #500

Merged
merged 43 commits into from
Sep 19, 2018

Conversation

jojohappy
Copy link
Member

Changes

This PR try to make some unified bucket flags for all provider. User should set the --provider.type to represent which provider they use. And all flags will be reused for all provider now. This aim is to reduce the number of flags when new provider appended if it can reuse the flags have been exists.

Verification

User can run the thanos bucket ls to verify this PR

@jojohappy
Copy link
Member Author

jojohappy commented Aug 31, 2018

@Bplotka Sorry for later. I'm so busy with my work this two weeks. But it is prepare to review now.

no trace will be sent periodically, unless forced
by baggage item. See `pkg/tracing/tracing.go` for
details.
--provider.type=<provider>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these parameters are S3 specific. :( I think best approach would be to specify provider config in external JSON file where you can specify type and all additional provider options, like Premium/Standard storage, access policies etc.. Each provider can have arbitrary options to pass there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree... We need some way to not exponentially increase number of flags, but also keep documentation clear, how to configure obj stores. I am generally against moving to a config file, instead of flags. This is basically harder to operate. There is no clear winner here..

Some quick idea:

  • Put to flags only things that are common and add objstore.extra for file content and allow different providers parse it dynamically to internal structs?

Anything smarter? @brancz you are after inspiring Gophercon, maybe you have some idea (:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed feelings for anything that goes into the provider direction but still baked into the binary. It's going to be a pain no matter how we spin it and there's always going to be that next provider that someone desperately needs. I think similar to peer discovery we should find an interface that someone can implement and create a shim between Thanos and the storage provider they want to use. Maybe we could extend the store component to expose an additional "upload" service so all object storage functionality is central to that component and people can then just implement their own store binaries, as the code is really not complex, and we could even expose everything except the actual bucket implementation as a library.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I feel like we need another proposal for this as we need to consider various issues like performance and operating of yet another sidecar/service.

The problem is that this is quite critical part, but some gRPC S3 like API could make sense. It is not time critical though, as we have some safety buffer. I think I like this idea more & more.

But clearly this change will not happen from day to day. I feel like we need something simple for time being...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added #505

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial review. Overall - very good direction. We need exactly that! Thanks for this!

And good timing, I was just about to implement this (:

func NewBucketConfig(cmd *kingpin.CmdClause) *BucketConfig {
var bucketConfig BucketConfig

cmd.Flag("provider.type", "Specify the provider for object store. If empty or unsupport provider, Thanos won't read and store any block to the object store. Now supported GCS / S3.").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/unsupport/unsupported

var bucketConfig BucketConfig

cmd.Flag("provider.type", "Specify the provider for object store. If empty or unsupport provider, Thanos won't read and store any block to the object store. Now supported GCS / S3.").
PlaceHolder("<provider>").StringVar(&bucketConfig.Provider)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use EnumVar type here (instead of String var)?

}

// NewBucketConfig return the configuration of object store
// TODO(jojohappy) should it support multiple bucket?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think yes. We need some way of being able to use NewBucketConfig more than once, with some certain prefix maybe for both flag names and envvars names?

One use case is in bucket verify subcommand, where you can specify backup bucket. (: Not sure if we need this now though. Let's leave TODO and add that in next PRs

Unsupported objProvider = "UNSUPPORTED"
)

var ErrNotFound = errors.New("no valid provider configuration supplied")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this should move to client package. It is confusing that ErrNotFound indicates not found provided and not, "not found bucket" or "not found object"

)

var ErrNotFound = errors.New("no valid provider configuration supplied")
var ErrMissingGCSBucket = errors.New("missing Google Cloud Storage bucket name for stored blocks")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objstore is meant to be generic, no provider details should be here

// BucketConfig encapsulates the necessary config values to instantiate an object store client.
// Use Provider to represent the Object Stores
type BucketConfig struct {
Provider string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objProvider instead of string?

cmd.Flag("provider.access-key", "Access key for an object store API. Support S3-Compatible API").
PlaceHolder("<key>").Envar("PROVIDER_ACCESS_KEY").StringVar(&bucketConfig.AccessKey)

// TODO(jojohappy): should it be encrypted?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. How this improve things, if you would need encryption password/key passed somehow anyway?

Copy link
Member Author

@jojohappy jojohappy Sep 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, users should provide the original password or key, but the BucketConfig will encrypt that and return it decrypted. Because the s3.Config did not export the secretKey, I didn't know why did that. In the new BucketConfig, I still doesn't export this field, so I think should it be encrypted?

Not sure for that, if it is not necessary, I will remove that.

func NewBucketConfig(cmd *kingpin.CmdClause) *BucketConfig {
var bucketConfig BucketConfig

cmd.Flag("provider.type", "Specify the provider for object store. If empty or unsupport provider, Thanos won't read and store any block to the object store. Now supported GCS / S3.").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also not sure about provider name. Provider does not suggest for what things provider we mean. Maybe objstore instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, it will make sense.

no trace will be sent periodically, unless forced
by baggage item. See `pkg/tracing/tracing.go` for
details.
--provider.type=<provider>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree... We need some way to not exponentially increase number of flags, but also keep documentation clear, how to configure obj stores. I am generally against moving to a config file, instead of flags. This is basically harder to operate. There is no clear winner here..

Some quick idea:

  • Put to flags only things that are common and add objstore.extra for file content and allow different providers parse it dynamically to internal structs?

Anything smarter? @brancz you are after inspiring Gophercon, maybe you have some idea (:

}

// NewBackupBucketConfig return the configuration of backup object store
func NewBackupBucketConfig(cmd *kingpin.CmdClause) *BucketConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, maybe we want just NewBucketConfig(cmd, suffix) ^^

@bwplotka
Copy link
Member

bwplotka commented Sep 3, 2018

Please rebase this for green CI (Landed fix #504) (:

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing all comments! Some extra one, but overall good direction.

There is blocker comment we need to make some decision on before merging, which is this discussion: #500 (comment)

In current state it still requires custom flags that does not make any sense for different providers. I feel like creating 2 flags:
objstore.type
objstore.config
and config being some custom yaml, marhsalled differently for each provider makes the most sense now.

@@ -31,7 +31,7 @@ func registerStore(m map[string]setupFunc, app *kingpin.Application, name string
dataDir := cmd.Flag("tsdb.path", "Data directory of TSDB.").
Default("./data").String()

bucketConf := objstore.NewBucketConfig(cmd)
bucketConf := objstore.NewBucketConfig(cmd, "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could potentiall add NewBucketConfigWithPrefix method to avoid this (:

@@ -34,104 +43,52 @@ type BucketConfig struct {
}

// NewBucketConfig return the configuration of object store
// TODO(jojohappy) should it support multiple bucket?
func NewBucketConfig(cmd *kingpin.CmdClause) *BucketConfig {
func NewBucketConfig(cmd *kingpin.CmdClause, suffix string) *BucketConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this has to be here and not in client package?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and all changes in this file)

@bwplotka
Copy link
Member

bwplotka commented Sep 3, 2018

Added #505 that relates to this, but in mean time we should have something working now - objstore.type and objstore.config sounds like some idea for now. Any thoughts?

@jojohappy feel free to ping me on slack, I explain more.

@jojohappy jojohappy force-pushed the set_unified_flag_for_store branch from 5b6673b to 8764690 Compare September 4, 2018 01:49
This was referenced Sep 6, 2018
@jojohappy jojohappy force-pushed the set_unified_flag_for_store branch from b25496d to 8057c44 Compare September 7, 2018 08:41
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIce. This will help a lot I think. But this is major change so I will share it widely for review, OK?

I am mostly ok, just some suggestions.

PlaceHolder("<bucket>").String()

s3Config := s3.RegisterS3Params(cmd)
bucketConf := cmd.Flag("objstore.config", "The yaml format configuration of bucket for stored blocks.").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we improve this description by saying The object store configuration in yaml format.


s3Config := s3.RegisterS3Params(cmd)
bucketConf := cmd.Flag("objstore.config", "The yaml format configuration of bucket for stored blocks.").
PlaceHolder("<bucket.config>").String()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is .Required() here I believe.


type BucketConfig struct {
Type objProvider `yaml:"type"`
Content interface{} `yaml:"content"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just config instead of content?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

if config == "" {
return nil, ErrNotFound
}
err = yaml.Unmarshal([]byte(config), &bucketConf)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use if err := ... ; err != nil { idiom here (:

Bucket string `yaml:"bucket"`
Endpoint string `yaml:"endpoint"`
AccessKey string `yaml:"access-key"`
SecretKey string `yaml:"secret-key"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And now is that real question.. should it be available here or just through envvar (: I remember people saying it is not good idea to specify them via config file or flags

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I will rollback it to just use envvar (:

@bwplotka
Copy link
Member

bwplotka commented Sep 7, 2018

Can you @jojohappy rebase?

@bwplotka
Copy link
Member

bwplotka commented Sep 7, 2018

As a next step we can do in next PR: Some thanos command to describe the schemas of the config files for each objstore provider. It is not enough to just maintain doc - it needs to be tied to binary the config will be used against. But that is something we need to figure out later

Copy link
Contributor

@vglafirov vglafirov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good, need some minor tweaks.


s3Config := s3.RegisterS3Params(cmd)
bucketConf := cmd.Flag("objstore.config", "The yaml format configuration of bucket for stored blocks.").
PlaceHolder("<bucket.config>").String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.Required() I guess

cmd/thanos/rule.go Show resolved Hide resolved
cmd/thanos/bucket.go Show resolved Hide resolved
@@ -24,17 +23,15 @@ import (

// registerStore registers a store command.
func registerStore(m map[string]setupFunc, app *kingpin.Application, name string) {
cmd := app.Command(name, "store node giving access to blocks in a GCS bucket")
cmd := app.Command(name, "store node giving access to blocks in a supported bucket provider")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would print out provider signature here.

How often we send traces (1/<sample-factor>). If 0 no
trace will be sent periodically, unless forced by
baggage item. See `pkg/tracing/tracing.go` for details.
--objstore.config=<bucket.config>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear from the description that it should be yaml file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.. It is not a yaml file, just content of configuration in yaml format. But we should update the example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the noise. I know your opinion.


type BucketConfig struct {
Type objProvider `yaml:"type"`
Content interface{} `yaml:"content"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@bwplotka
Copy link
Member

bwplotka commented Sep 8, 2018

  • let's update CHANGELOG please (:

@jojohappy jojohappy force-pushed the set_unified_flag_for_store branch from 8057c44 to 7d5dffa Compare September 8, 2018 13:53
@jojohappy
Copy link
Member Author

@Bplotka @vglafirov Fixed review and CHANGELOG. Meanwhile update the documents.

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, awesome work. Just super tiny nits, except maybe error handling in client.Bucket. Let's fix those and we are good to go 💪 Thanks!


s3Config := s3.RegisterS3Params(cmd)
bucketConf := cmd.Flag("objstore.config", "The object store configuration in yaml format.").
PlaceHolder("<bucket.config.yaml>").Required().String()

// Verify command.
verify := cmd.Command("verify", "verify all blocks in the bucket against specified issues")
verifyRepair := verify.Flag("repair", "attempt to repair blocks for which issues were detected").
Short('r').Default("false").Bool()
// NOTE(bplotka): Currently we support backup buckets only in the same project.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not relevant anymore, we can kill this

cmd/thanos/bucket.go Show resolved Hide resolved
cmd/thanos/rule.go Show resolved Hide resolved
case S3:
bucket, err = s3.NewBucket(logger, config, reg, component)
default:
return nil, ErrNotFound
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should return different error than not found. It's not known type we should error on.

@@ -32,29 +37,56 @@ const (
// DirDelim is the delimiter used to model a directory structure in an object store bucket.
const DirDelim = "/"

// gcsConfig stores the configuration for gcs bucket
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing trailing period

func NewBucket(name string, cl *storage.Client, reg prometheus.Registerer) *Bucket {
func NewBucket(logger log.Logger, ctx context.Context, conf []byte, reg prometheus.Registerer, component string) (*Bucket, error) {
var gc gcsConfig
err := yaml.Unmarshal(conf, &gc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can if err := (..); err != nil { .. } idiom

return nil, err
}
config.secretKey = os.Getenv("S3_SECRET_KEY")
err = Validate(config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err := (...); err != nil {} idiom (:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and above

if err != nil {
return nil, err
}
config.secretKey = os.Getenv("S3_SECRET_KEY")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -185,6 +147,31 @@ func NewBucket(logger log.Logger, conf *Config, reg prometheus.Registerer, compo
return bkt, nil
}

// GetBucket return the bucket name for s3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returns instead of return and missing trailing period (:

CHANGELOG.md Outdated
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add Thanos compact --retention.default flag, for configuring storage bucket retention period.
- Removes support for multiple units in duration. For example: 1m0s won't work, while 1m will work.
- Adds support for y,w,d time units
- Use the configuration of bucket in yaml format.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move to something like:

Removes support of those flags

--gcs-bucket=<bucket>
 --s3.bucket=<bucket>     
--s3.endpoint=<api-url> 
--s3.access-key=<key>    
--s3.insecure     
--s3.signature-version2  
--s3.encrypt-sse     
--gcs-backup-bucket=<bucket>  	
--s3-backup-bucket=<bucket>  

instead added --objstore.config

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this special case, otherwise rebase + LGTM

bucket, err = gcs.NewBucket(logger, context.Background(), config, reg, component)
case S3:
bucket, err = s3.NewBucket(logger, config, reg, component)
case "":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not required. It's clearly an error if someone puts config with type: "" (:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

testutil.Assert(t, err != ErrNotFound, "it should not error with not found")
}

func TestBlankBucketConfig(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not required case

@jojohappy jojohappy force-pushed the set_unified_flag_for_store branch from 4b001d5 to aa29f10 Compare September 10, 2018 15:14
@bwplotka
Copy link
Member

@vglafirov you requested some changes. Is it ok now? I would like to merge this to unblock you and @jojohappy COS client

@xjewer
Copy link
Contributor

xjewer commented Sep 11, 2018

Isn't it better to pass link to yaml file to the --objstore.config instead of yaml data, is it?

@domgreen
Copy link
Contributor

@Bplotka I tend to agree with @xjewer I think passing a path to the yaml file will be much cleaner than actually passing the yaml in a string.

Copy link
Contributor

@domgreen domgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly nits ... can we wrap errors that we are returning to give more context and updating a few function signatures.


s3config := s3.RegisterS3Params(cmd)
bucketConf := cmd.Flag("objstore.config", "The object store configuration in yaml format.").
PlaceHolder("<bucket.config.yaml>").String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be required for compact? We will not be able to do anything without a bucket.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, It should be required.

return objstore.BucketWithMetrics(s3Config.Bucket, b, reg), nil
config, err := yaml.Marshal(bucketConf.Config)
if err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we wrap this error 👍

pkg/objstore/client/factory.go Outdated Show resolved Hide resolved
pkg/objstore/client/factory.go Outdated Show resolved Hide resolved
@@ -83,7 +78,7 @@ func runStore(
verbose bool,
) error {
{
bkt, err := client.NewBucket(logger, &gcsBucket, *s3Config, reg, component)
bkt, err := client.NewBucket(logger, bucketConf, reg, component)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind wrapping this whilst were here


closer io.Closer
}

// NewBucket returns a new Bucket against the given bucket handle.
func NewBucket(name string, cl *storage.Client, reg prometheus.Registerer) *Bucket {
func NewBucket(logger log.Logger, ctx context.Context, conf []byte, reg prometheus.Registerer, component string) (*Bucket, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think its convention to have ctx as the first variable in the method. See conclusion here https://blog.golang.org/context

bkt *storage.BucketHandle
opsTotal *prometheus.CounterVec
bucket string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name?

@@ -26,6 +26,9 @@ type Bucket interface {

// Delete removes the object with the given name.
Delete(ctx context.Context, name string) error

// GetBucket returns the bucket name for the provider.
GetBucket() string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update this function name ... Name()? We tend not to have Getters in Go and although its returning string on first glance I would assume it returns the bucket.

@jojohappy jojohappy force-pushed the set_unified_flag_for_store branch from c0ae0e6 to a1ec2b3 Compare September 12, 2018 14:05
@jojohappy jojohappy force-pushed the set_unified_flag_for_store branch from cce5eba to 4d665f1 Compare September 18, 2018 23:34
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comment after changing to file loading.

PlaceHolder("<bucket>").String()
verifyBackupS3Bucket := cmd.Flag("s3-backup-bucket", "S3 bucket name to backup blocks on repair operations.").
PlaceHolder("<bucket>").String()
backupBucketConfFile := verify.Flag("objstore-backup.config", "The backup object store configuration in yaml format.").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config-file for consistency (:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's my fault. Will be updated

func loadFile(confFile string) (*BucketConfig, error) {
content, err := ioutil.ReadFile(confFile)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap with confFile maybe?

}

bucketConf := &BucketConfig{}
if err := yaml.UnmarshalStrict(content, bucketConf); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Strict?

Copy link
Member Author

@jojohappy jojohappy Sep 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the gopkg.in/yaml.v2 documents, using UnmarshalStrict can throw the error in the data that mapping keys that are duplicates or other unknown errors. The opinion comes from this issue.


bucketConf := &BucketConfig{}
if err := yaml.UnmarshalStrict(content, bucketConf); err != nil {
return nil, fmt.Errorf("parsing YAML file %s: %v", confFile, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use errors.Wrapf(err, msg, ...) from github/pkg/errors package.

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thanks for you work @jojohappy

Let's merge it!

@bwplotka bwplotka merged commit 984f42e into thanos-io:master Sep 19, 2018
@jojohappy jojohappy deleted the set_unified_flag_for_store branch September 20, 2018 02:34
jojohappy added a commit to jojohappy/thanos that referenced this pull request Sep 22, 2018
@xjewer
Copy link
Contributor

xjewer commented Sep 26, 2018

Just noticed, interesting moment, we deleted support env S3_SECRET_KEY, so what's the way to keep it in secrets in k8s and use configmap for the rest? @jojohappy

@xjewer
Copy link
Contributor

xjewer commented Sep 26, 2018

the only way to use it in k8s seams to put the whole bucket.yaml config file into the secret https://kubernetes.io/docs/concepts/configuration/secret/#use-case-dotfiles-in-secret-volume

@bwplotka
Copy link
Member

bwplotka commented Sep 26, 2018 via email

@jojohappy
Copy link
Member Author

jojohappy commented Sep 27, 2018

Well, thanks @xjewer !
We could get the secret variable as Envvar such as S3_SECRET_KEY back with higher priority than the variable in configuration file.
IMO, I don't like put the whole configuration file into the secret.

Open issue: #539

jojohappy added a commit to jojohappy/thanos that referenced this pull request Oct 11, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Oct 30, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Oct 30, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Nov 6, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Nov 14, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Nov 28, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Nov 28, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Dec 4, 2018
jojohappy added a commit to jojohappy/thanos that referenced this pull request Jan 2, 2019
bwplotka pushed a commit that referenced this pull request Jan 2, 2019
* Feature: support tencent cloud object storage

Signed-off-by: jojohappy <[email protected]>

* To set Content-Length for *os.File

Signed-off-by: jojohappy <[email protected]>

* Fixed circleci test

Signed-off-by: jojohappy <[email protected]>

* Rebase master to migrate PR #500

Signed-off-by: jojohappy <[email protected]>

* Fixed code style

Signed-off-by: jojohappy <[email protected]>

* Update inconsistent constant variable

Signed-off-by: jojohappy <[email protected]>

* Update storage document

Signed-off-by: jojohappy <[email protected]>

* Fixed snake_case & some nits

Signed-off-by: jojohappy <[email protected]>

* Remove unnecessary store metrics

Signed-off-by: jojohappy <[email protected]>

* Remove evaluating type of block object in production code

Signed-off-by: jojohappy <[email protected]>

* Remove bucket metrics

Signed-off-by: jojohappy <[email protected]>

* Address review comments

Signed-off-by: jojohappy <[email protected]>

* To wrap reader closer as a nop to avoid to close it after uploading in COS client

Signed-off-by: jojohappy <[email protected]>

* Rebase & Add client struct config to bucketcfggen

Signed-off-by: jojohappy <[email protected]>

* Update storage docs using bucketcfggen

Signed-off-by: jojohappy <[email protected]>

* Address review comments

Signed-off-by: jojohappy <[email protected]>

* Address review comments

Signed-off-by: jojohappy <[email protected]>

* Update version of COS provider && Remove getting the length of reader

Signed-off-by: jojohappy <[email protected]>

* Missing the comment of object storage testing env THANOS_SKIP_SWIFT_TESTS

Signed-off-by: jojohappy <[email protected]>

* Address review comments

Signed-off-by: jojohappy <[email protected]>

* Typo error && Remove unused function argument

Signed-off-by: jojohappy <[email protected]>
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.

8 participants