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

Support multiple Spring application names for AWS Secrets Manager #2664

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

leekib
Copy link
Contributor

@leekib leekib commented Dec 5, 2024

Support multiple spring application names for AWS Secret Manager

Spring Cloud Config supports multiple application names in backends like Git and Vault, but this feature seems to be missing in AWS Secret Manager. This change enables AWS Secret Manager to handle comma-separated application names, aligning with these backends.

This implementation is similar to PR #1379, which added support for multiple applications in the Vault backend, and resolves the limitations discussed in issue #1356.

What’s Changed

  • Enabled processing of comma-separated application names for AWS Secret Manager, allowing it to handle multiple applications like Git and Vault backends.

Why This Matters

  • Teams migrating from Git or Vault to AWS Secret Manager can now use the same configuration structure.

Testing

  • Added test cases for:
    • Non-existing profile and label.
    • Default profile with an existing label.
    • Existing profile with null label.

- Enable processing of comma-separated application names in Spring Cloud Config.
- Add test cases for handling multiple application names.
}
}
if (!Arrays.asList(profiles).contains(defaultProfile)) {
addPropertySource(environment, application, defaultProfile, l);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there existing tests that verify that changing this logic doesn't break anything? I am nervous that we might be changing the order of certain property sources and breaking expectations.

Copy link
Contributor Author

@leekib leekib Dec 6, 2024

Choose a reason for hiding this comment

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

This one appears to provide good coverage for the logic changes in AWS Secrets Manager, particularly regarding the ordering and inclusion of profiles.

It helps ensure that:

  • Profiles specified as a comma-separated list (like "prod,east") are handled in the correct order.
  • null profiles are properly included.
  • The default profile is correctly added, and its position relative to other profiles (including null profiles) is maintained.

For label-related scenarios, testFindOneWithExistingApplicationAndDefaultProfileAndExistingLabelWhenMultipleLabelIsSet seems to cover the handling of multiple labels effectively.

Based on my review, these tests, along with testFindOneWithNullApplicationAndNonExistingProfileAndNullLabelWhenDefaultLabelIsSet and testFindOneWithExistingApplicationAndNonExistingProfileAndNoDefaultProfileForFooAndNullLabelWhenDefaultLabelIsSet, seem to cover the existing logic quite well.

@leekib
Copy link
Contributor Author

leekib commented Dec 11, 2024

I added a comprehensive test case to thoroughly ensure that the logic for retrieving secrets remains consistent with the previous implementation.

The test covers scenarios with multi-profiles and multi-labels, including default profiles and null profiles, verifying the exact order of secrets in all cases.

@leekib leekib requested a review from ryanjbaxter December 11, 2024 12:06
@ryanjbaxter ryanjbaxter added this to the 4.2.1 milestone Dec 12, 2024
@ryanjbaxter
Copy link
Contributor

The tests are great! Thank you!

@ryanjbaxter ryanjbaxter merged commit f883133 into spring-cloud:main Dec 12, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants