-
Notifications
You must be signed in to change notification settings - Fork 34
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: adds cloudmeta package with AWS provider #4154
Conversation
ae265f3
to
4f52070
Compare
This adds cloudmeta package. For now it's only a basic interface for working with different cloud metadata providers, like aws, gcp, azure.
This extends cloudmeta package with aws metadata provider. Fixes: #4127
4f52070
to
8878021
Compare
integration tests are still running, but this is a completely new package, so it shouldn't affect existing functionality in any case :) |
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.
Nice work!
Just left a few NITs.
Also in the context of this comment, does AWS SDK handle re-tries by default? |
This adds NewAWSMetadataWithEndpoint constructor, so we can have ability to overwrite default aws metadata service endpoint. It might be useful for testing.
good question! yes, by default ec2metadata client will have 2 retires - https://github.com/scylladb/scylla-manager/blob/master/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go#L94 |
Thanks @VAveryanov8 , just a few comments. |
I think default way of handling retries is fine here. |
This makes following changes: 1. Use pkg/errors instead of stdlib error 2. Wrap all errors with WithStack 3. Make aws metadata service private 4. Make GetInstanceMetadata to request all providers concurrently 5. Use table driven tests
@karol-kokoszka @Michal-Leszczynski Thanks for the review! I've updated this pr accordingly, so it's ready to be reviewed again 👀 |
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.
👍
BTW: please "Squash and merge" with the commit name "feat: adds cloudmeta package with AWS provider" |
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!
This adds basic interface and models to work with different cloud metadata providers and also adds implementation for aws metadata provider.
This package will be used in order to extend backup manifest with additional information.
This changes has been manually tested with the help of https://github.com/aws/amazon-ec2-metadata-mock container.
Fixes: #4127
Please make sure that: