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: adds cloudmeta package with AWS provider #4154

Merged
merged 9 commits into from
Dec 13, 2024
Merged

Conversation

VAveryanov8
Copy link
Collaborator

@VAveryanov8 VAveryanov8 commented Dec 10, 2024

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:

  • Code is split to commits that address a single change
  • Commit messages are informative
  • Commit titles have module prefix
  • Commit titles have issue nr. suffix

@VAveryanov8 VAveryanov8 force-pushed the va/cloudmeta-aws branch 2 times, most recently from ae265f3 to 4f52070 Compare December 10, 2024 16:04
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
@VAveryanov8 VAveryanov8 marked this pull request as ready for review December 11, 2024 10:14
@VAveryanov8
Copy link
Collaborator Author

integration tests are still running, but this is a completely new package, so it shouldn't affect existing functionality in any case :)

Copy link
Collaborator

@Michal-Leszczynski Michal-Leszczynski left a 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.

pkg/cloudmeta/metadata.go Outdated Show resolved Hide resolved
pkg/cloudmeta/metadata_test.go Outdated Show resolved Hide resolved
pkg/cloudmeta/aws.go Outdated Show resolved Hide resolved
@Michal-Leszczynski
Copy link
Collaborator

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.
@VAveryanov8
Copy link
Collaborator Author

Also in the context of this #4159 (review), does AWS SDK handle re-tries by default?

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

@karol-kokoszka
Copy link
Collaborator

Thanks @VAveryanov8 , just a few comments.

@karol-kokoszka
Copy link
Collaborator

Also in the context of this #4159 (review), does AWS SDK handle re-tries by default?

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

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
@VAveryanov8
Copy link
Collaborator Author

@karol-kokoszka @Michal-Leszczynski Thanks for the review! I've updated this pr accordingly, so it's ready to be reviewed again 👀

Copy link
Collaborator

@karol-kokoszka karol-kokoszka left a comment

Choose a reason for hiding this comment

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

👍

@karol-kokoszka
Copy link
Collaborator

BTW: please "Squash and merge" with the commit name "feat: adds cloudmeta package with AWS provider"

Copy link
Collaborator

@Michal-Leszczynski Michal-Leszczynski left a comment

Choose a reason for hiding this comment

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

LGTM!

@VAveryanov8 VAveryanov8 merged commit 92775c3 into master Dec 13, 2024
51 checks passed
@VAveryanov8 VAveryanov8 deleted the va/cloudmeta-aws branch December 13, 2024 12:43
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.

Possibility to query instance metadata for AWS
3 participants