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

Feat/support aws sdk default credential provider chain #5636

Conversation

aljoshare
Copy link
Contributor

@aljoshare aljoshare commented Jul 31, 2023

What this PR does

This PR allows to use the default credential provider chain of the AWS SDK. It is already part of the used thanos.io/objstore and can now also be enabled for Mimir. The default credential provider chain allows the use of e.g. role chaining using the ./aws/config or other authentication methods which are not implemented in thanos.io/objstore or Mimir.

Example config:

mimir:
  structuredConfig:
    common:
      storage:
        backend: s3
        s3:
          endpoint: s3.eu-central-1.amazonaws.com
          region: eu-central-1
          native_aws_auth_enabled: true
    blocks_storage:
      s3:
        bucket_name: mimir-bucket

Which issue(s) this PR fixes or relates to

Fixes #5613

Checklist

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

@CLAassistant
Copy link

CLAassistant commented Jul 31, 2023

CLA assistant check
All committers have signed the CLA.

@aljoshare aljoshare force-pushed the feat/support-aws-sdk-default-credential-provider-chain branch 3 times, most recently from a4aa1f1 to f152918 Compare July 31, 2023 16:48
@aljoshare aljoshare marked this pull request as ready for review July 31, 2023 16:50
@aljoshare aljoshare requested a review from a team as a code owner July 31, 2023 16:50
@56quarters
Copy link
Contributor

Thanks for this PR! I'm confused about why it's necessary though (and why it was added to thanos/objstore). It seems like Minio does indeed support the same authentication methods that the AWS SDK does:

https://github.com/minio/minio-go/tree/master/pkg/credentials

It seems like objstore configures a few of them by default

@aljoshare
Copy link
Contributor Author

aljoshare commented Aug 1, 2023

I was also confused and during my research I found a lot of confusion in many issues/PRs and discussions around the topic. My guess is that there is a lot of reinventing the wheel again instead of relying on the default provider chain of the SDK and of course legacy code which doesn't support all of the countless ways how to authenticate against AWS.

If I understand it correctly, the minio implementation had no way to use cross account role chaining when the aws_sdk_auth was introduced in the objstore [1][2]. It seems that it's supported...maybe, but I need to try it out to be really sure.

I can say that my use case (which was also the use case of the guy who introduced it in the objstore) is working properly now and I agree with him that relying on a consistent implementation from AWS is better than reimplementing it again and again and again.

What do you think?

@aljoshare aljoshare requested a review from a team as a code owner August 1, 2023 09:37
@56quarters
Copy link
Contributor

That makes sense to me. This is a much quicker way to let people use the auth logic they expect. My only suggestion is a different, slightly more descriptive name for the flag. What do you think about native_aws_auth_discovery_enabled?

@aljoshare
Copy link
Contributor Author

native_aws_auth_enabled maybe? to keep it short?

Is it okay for you, if I fixup the existing commits? 😊

@56quarters
Copy link
Contributor

native_aws_auth_enabled maybe? to keep it short?

Is it okay for you, if I fixup the existing commits? blush

Sure, sounds great. Thanks!

@aljoshare aljoshare force-pushed the feat/support-aws-sdk-default-credential-provider-chain branch from 986d6fd to a2d99e2 Compare August 2, 2023 08:32
@56quarters
Copy link
Contributor

I think CI is failing because of whitespace. Can you run make clean-white-noise and push again? I can merge after that. Thanks!

Copy link
Contributor

@56quarters 56quarters 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!

@aljoshare aljoshare force-pushed the feat/support-aws-sdk-default-credential-provider-chain branch from a2d99e2 to 0757638 Compare August 3, 2023 06:34
@aljoshare
Copy link
Contributor Author

make clean-white-noise didn't change anything but I recreated it with make reference-help and there were some whitespace changes. Looks good now, when running the tests locally 🤞

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.

Support default authentication methods of the AWS SDK
3 participants