-
Notifications
You must be signed in to change notification settings - Fork 541
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
Configurable s3 storage class #4300
Conversation
I haven't tried to run it against a real s3. |
fixed intended line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @inbarpatashnik!
AccessKey: cfg.AccessKeyID, | ||
SecretKey: cfg.SecretAccessKey.String(), | ||
Insecure: cfg.Insecure, | ||
PutUserMetadata: map[string]string{awsStorageClassHeader: cfg.StorageClass}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be being overly cautious here: it's probably safest for the default value of cfg.StorageClass
to be an empty string, and to not set PutUserMetadata
at all if StorageClass
is not set - some S3-compatible storage services may not support STANDARD
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! thank you so much for the review!
It sounds like a very good point - Ive tried to edit so the default value of the storage class in the config.go will be an empty string, but it seemed to fail some tests because the object storage class "" doesn't exist.
Maybe I should edit it in this file to be an empty string?
I fixed the pr according to all the comments, but I still think how to fix so solve this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also I'm thinking - maybe its better if it will have an actual default value that will be supported by default (If it exists?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than setting it to an empty string, I would simply not set it at all (which is what we were doing before).
The CHANGELOG has just been cut to prepare for the next Mimir release. Please rebase |
Fixture/conflicts to branch main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
34a746f went too far 😄
This comment was a suggestion to only set the X-Amz-Storage-Class
value if cfg.StorageClass
was not an empty string.
So, I'm imagining something like this:
func newS3Config(cfg Config) (s3.Config, error) {
sseCfg, err := cfg.SSE.BuildThanosConfig()
if err != nil {
return s3.Config{}, err
}
putUserMetadata := map[string]string{}
if cfg.StorageClass != "" {
putUserMetadata[awsStorageClassHeader] = cfg.StorageClass
}
return s3.Config{
Bucket: cfg.BucketName,
Endpoint: cfg.Endpoint,
Region: cfg.Region,
AccessKey: cfg.AccessKeyID,
SecretKey: cfg.SecretAccessKey.String(),
Insecure: cfg.Insecure,
PutUserMetadata: putUserMetadata,
SSEConfig: sseCfg,
HTTPConfig: s3.HTTPConfig{
IdleConnTimeout: model.Duration(cfg.HTTP.IdleConnTimeout),
ResponseHeaderTimeout: model.Duration(cfg.HTTP.ResponseHeaderTimeout),
InsecureSkipVerify: cfg.HTTP.InsecureSkipVerify,
TLSHandshakeTimeout: model.Duration(cfg.HTTP.TLSHandshakeTimeout),
ExpectContinueTimeout: model.Duration(cfg.HTTP.ExpectContinueTimeout),
MaxIdleConns: cfg.HTTP.MaxIdleConns,
MaxIdleConnsPerHost: cfg.HTTP.MaxIdleConnsPerHost,
MaxConnsPerHost: cfg.HTTP.MaxConnsPerHost,
Transport: cfg.HTTP.Transport,
},
// Enforce signature version 2 if CLI flag is set
SignatureV2: cfg.SignatureVersion == SignatureVersionV2,
}, nil
}
f4fddbd
to
ffed3fd
Compare
ohh, yes. Makes more sense🤭 @charleskorn |
f831493
to
fd95b1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @inbarpatashnik!
Thank you!!🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some minor tweaks. Thanks!
pkg/storage/bucket/s3/config.go
Outdated
"github.com/grafana/dskit/flagext" | ||
"github.com/minio/minio-go/v7/pkg/encrypt" | ||
"github.com/pkg/errors" | ||
"github.com/thanos-io/objstore/providers/s3" | ||
|
||
"net/http" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you group this with the other stdlib imports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@56quarters i tried to reorganize them, but it seems to fail in the lint :(
pkg/storage/bucket/s3/config_test.go
Outdated
"github.com/grafana/dskit/flagext" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"net/http" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move these with the other stdlib imports?
Co-authored-by: Nick Pillitteri <[email protected]>
Signed-off-by: Nick Pillitteri <[email protected]>
What this PR does
Added support in configurable s3 storage class.
Which issue(s) this PR fixes or relates to
Fixes #3438
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]