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

Add option to use v2 signatures for S3 blocks store #3540

Merged

Conversation

simonswine
Copy link
Contributor

@simonswine simonswine commented Nov 25, 2020

What this PR does:

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@@ -32,6 +32,7 @@ type Config struct {
SecretAccessKey flagext.Secret `yaml:"secret_access_key"`
AccessKeyID string `yaml:"access_key_id"`
Insecure bool `yaml:"insecure"`
SignatureV2 bool `yaml:"signature_v2"`
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 we’re missing setting of the corresponding field here:

func newS3Config(cfg Config) s3.Config {

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this field is currently unused. Needs to be passed to the S3 client.

Another comment I have. Such booleans are bad for extensibility in the future, in case a new version scheme will be introduced. You may achieve the same result allowing to configure the version number signature_version: 2|4, introducing a check in Config.Validate() (function to be added and called from parents) to make sure it's either 2 or 4. If in the future v6 will be introduced, this flag will support it too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting the missing passing-through 😬

On using an enum parameter: I have done that as part of the last commit. I think it might be misrepresenting what is actually happening, I am not too sure as in the background the minio client seems to use https://github.com/minio/minio-go/blob/26addf203d4a7d73e33f0731b67a7c02a910632a/pkg/credentials/signature-type.go#L28 SignatureDefault, which is equal to v4. It might be more accurate to rename the parameters from v4 to default, but I felt that is more confusing.

Btw: I have purposely used strings with v prefix to avoid YAML parsing issues around integers vs. strings.

@simonswine simonswine force-pushed the expose-option-to-configure-v2-auth branch from 7d99f48 to ca38b49 Compare November 26, 2020 09:42
@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 26, 2020
This allow to configure the block store client to use V2 signatures for
S3 authentication.

Signed-off-by: Christian Simon <simon@swine.de>
Signed-off-by: Christian Simon <simon@swine.de>
Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@pracucci pracucci merged commit 2670896 into cortexproject:master Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants