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

Automatically populate PropertySource with instance metadata when running within an EC2-based environment #962

Merged
merged 10 commits into from
Sep 18, 2024

Conversation

kennyk65
Copy link
Contributor

@kennyk65 kennyk65 commented Nov 16, 2023

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

A new package added to the autoconfigure project (with test classes) to populate a PropertySource whenever IMDS is present, which occurs on EC2, ElasticBeanstalk, ECS, EKS, etc. Auto configuration silently ignores the absence of IMDS. A starter pom is added, docs are updated.

💡 Motivation and Context

Issue addressed is: #954
There are various times when an application needs to know its IP address, availability zone, region, mac address, etc. All this is available via IMDS. This feature simply adds these properties to the Environment when available.

💚 How did you test it?

Three new classes, three new JUnit tests. Plus I created a sample application using the libraries for a sanity test.

📝 Checklist

  • [ x] I reviewed submitted code
  • [x ] I added tests to verify changes
  • [x ] I updated reference documentation to reflect the change
  • [ x] All tests passing
  • [x ] No breaking changes

🔮 Next steps

Others may wish to expand this to retrieve dynamic data, user data, set a common prefix, etc. May want to use a ConfigProperties only to cause the one and only property to be documented.

@github-actions github-actions bot added type: dependency-upgrade Dependency version bump type: documentation Documentation or Samples related issue labels Nov 16, 2023
@maciejwalkowiak
Copy link
Contributor

Thanks @kennyk65 for a PR! We need an integration test for that. Until Localstack supports metadata endpoint (localstack/localstack#8911) we would need to mock it - ideally with WireMock, to make sure whole flow works as expected.

Copy link
Contributor

@maciejwalkowiak maciejwalkowiak left a comment

Choose a reason for hiding this comment

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

Overall - great stuff! Thanks a lot! While most comments are details, an integration test is a must to merge it.

@maciejwalkowiak maciejwalkowiak added this to the 3.2.0 M2 milestone Mar 10, 2024
@maciejwalkowiak maciejwalkowiak self-assigned this Mar 30, 2024
@maciejwalkowiak maciejwalkowiak modified the milestones: 3.2.0 M2, 3.3.x Sep 16, 2024
@maciejwalkowiak maciejwalkowiak modified the milestones: 3.3.x, 3.3.0 Sep 18, 2024
@maciejwalkowiak maciejwalkowiak merged commit b5df124 into awspring:main Sep 18, 2024
4 checks passed
@maciejwalkowiak
Copy link
Contributor

Thanks @kennyk65 once again and apologies it took so long.

@maciejwalkowiak maciejwalkowiak removed type: documentation Documentation or Samples related issue type: dependency-upgrade Dependency version bump labels Sep 18, 2024
@kennyk65
Copy link
Contributor Author

Thanks! Let me know if I can help out with anything else.

@kennyk65 kennyk65 deleted the imds-changes branch November 12, 2024 22:47
@maciejwalkowiak maciejwalkowiak modified the milestones: 3.3.0, 3.3.0 M1 Dec 14, 2024
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.

3 participants