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

AppConfig integration #473

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

MatejNedic
Copy link
Member

@MatejNedic MatejNedic commented Aug 3, 2022

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Still have to go through it once more time and add some docs. Tried against real AWS and all tests are passing.
Since AWS Localstack has a bug it is not possible to make a real integration test.
Closes #465

@eddumelendez SInce you worked on AppConfig integration before please when you have time check the design. I will do more cleaning and polishing of the code.

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

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

🔮 Next steps

@github-actions github-actions bot added type: dependency-upgrade Dependency version bump type: documentation Documentation or Samples related issue labels Aug 3, 2022
@MatejNedic MatejNedic changed the title App config integration AppConfig integration Aug 3, 2022
@MatejNedic MatejNedic added component: appconfig AppConfig integration related issue and removed type: dependency-upgrade Dependency version bump labels Aug 3, 2022
spring-cloud-aws-autoconfigure/pom.xml Outdated Show resolved Hide resolved
RequestContext.Builder builder = RequestContext.builder();
AtomicReference<Integer> i = new AtomicReference<>(0);
builder.context(context);
Arrays.stream(context.split("___")).forEach(split -> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Should the prefix that is splitting values be adjustable or changed to something else?
I think even a simple / could do but I am afraid there will be cases where someone has / in ConfigurationProfileName or ApplicationName

Copy link
Contributor

Choose a reason for hiding this comment

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

I would go with the simple delimiter / and wait for feedback on the next milestone. Given you can have any character in the names. Also, for better debugging trace for loop would be enough

@github-actions github-actions bot added the type: dependency-upgrade Dependency version bump label Aug 3, 2022
@MatejNedic MatejNedic marked this pull request as ready for review August 3, 2022 23:22
@sonarcloud
Copy link

sonarcloud bot commented Aug 3, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@eddumelendez eddumelendez left a comment

Choose a reason for hiding this comment

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

My concern is related to the token management

From docs

This token should only be used once in your first call to GetLatestConfiguration. You must use the new token in the GetLatestConfiguration response (NextPollConfigurationToken) in each subsequent call to GetLatestConfiguration.

This token and the NextPollConfigurationToken token expire after 24 hours. If a GetLatestConfiguration call uses an expired token, the system returns BadRequestException.

Also, regarding to

Configuration
The data of the configuration. This may be empty if the client already has the latest version of configuration.

is the integration already managing this? I guess the token is the one that is used here and in every restart the app will generate a new token and will perform those request to fetch the latest configuration. However, what about refresh? I think the result is the same but just writing down some doubts I have regarding to this.

Source: https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_Operations_AWS_AppConfig_Data.html

@@ -12,14 +12,17 @@ io.awspring.cloud.autoconfigure.dynamodb.DynamoDbAutoConfiguration
# ConfigData Location Resolvers
org.springframework.boot.context.config.ConfigDataLocationResolver=\
io.awspring.cloud.autoconfigure.config.parameterstore.ParameterStoreConfigDataLocationResolver,\
io.awspring.cloud.autoconfigure.config.appconfig.AppConfigDataLocationResolver,\
Copy link
Contributor

Choose a reason for hiding this comment

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

order should be alphabetically. it applies for the other two entries


public static RequestContext splitContext(String context) {
RequestContext.Builder builder = RequestContext.builder();
AtomicReference<Integer> i = new AtomicReference<>(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

any specific use? maybe I'm missing something

RequestContext.Builder builder = RequestContext.builder();
AtomicReference<Integer> i = new AtomicReference<>(0);
builder.context(context);
Arrays.stream(context.split("___")).forEach(split -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would go with the simple delimiter / and wait for feedback on the next milestone. Given you can have any character in the names. Also, for better debugging trace for loop would be enough

* @author Matej Nedic
* @since 3.0
*/
public class RequestContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

From AppConfig perspective, there is known attributes such as configurationProfileIdentifier, environmentIdentifier and applicationIdentifier. However, context is something to be used internally AFAICS. I would suggest to use and internal format to be built once the other attributes have been filled.

Copy link
Member Author

Choose a reason for hiding this comment

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

So we should pass String context which is full path and in AppConfigPropertySource split it up to configurationProfileIdentifier, environmentIdentifier and applicationIdentifier? If I understood it right. RequestContext does contain a full context String tho, but mb this approach follows a pattern that other integrations have.

@MatejNedic MatejNedic marked this pull request as draft August 28, 2022 07:23
@github-actions github-actions bot added the component: s3 S3 integration related issue label Oct 28, 2022
@MatejNedic
Copy link
Member Author

Hey @noshua , it is planned go be tackled once 3.0.0 is released. There are some minor work to be done on this PR.

@MatejNedic MatejNedic modified the milestones: 3.x, 3.1 May 2, 2023
# Conflicts:
#	spring-cloud-aws-autoconfigure/pom.xml
@MatejNedic
Copy link
Member Author

It would be cool to include tests with localstack once is implemented ->
localstack/localstack#6891

@yurybubnov
Copy link

I'm also eagerly waiting for the feature. How can I help to get it integrated?

@maxjiang153
Copy link

any updates?

@mikelhamer
Copy link

This feature would be awesome! Keeping an eye on this, and willing to help if needed.

@NChitty
Copy link

NChitty commented Oct 28, 2023

I feel like I must have missed it but can you clarify what happens when a new AppConfig HostedVersion gets pushed to the application and environment? Does it force a reload of the context?

@maciejwalkowiak
Copy link
Contributor

@MatejNedic Localstack implemented Appconfig support

@MatejNedic
Copy link
Member Author

@maciejwalkowiak didn't know that perfect. Will implement with LocalStack tests and we can then hopefully merge and release.
One more thing is that we will need to put LocalStack PRO credentials in GitHub pipeline

@MatejNedic
Copy link
Member Author

Hey @NChitty , if you enable reload inside of integration it will periodically call AppConfig and do a reload or refresh depending on what you choose. It is covered by documentation.

@noshua
Copy link

noshua commented Apr 10, 2024

I don't wanna be rude, but over a year has passed by since my last status request. Is this feature dead before arrival?!

@MatejNedic
Copy link
Member Author

Hey @noshua , I am thinking about redoing this integration. I have to rethink it, don't like current implementation can do more things will be exploring it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: appconfig AppConfig integration related issue component: s3 S3 integration related issue type: dependency-upgrade Dependency version bump type: documentation Documentation or Samples related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AppConfig support
9 participants