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

Feature: Universal config: Enable a light weight config storage option #217

Closed
8 tasks done
cwoods-cpointe opened this issue Jul 18, 2024 · 0 comments · Fixed by #234
Closed
8 tasks done

Feature: Universal config: Enable a light weight config storage option #217

cwoods-cpointe opened this issue Jul 18, 2024 · 0 comments · Fixed by #234
Labels
enhancement New feature or request

Comments

@cwoods-cpointe
Copy link
Contributor

cwoods-cpointe commented Jul 18, 2024

217-helper.zip

Description

The universal config store offers robust production ready configuration storage using vault. This solution may work for many enterprise applications but it has the draw back of being resource intensive. This means for smaller applications, it is not ideal to stand up. The solution should be simple and easy to implement.

DOD

  • Implement a light weight storage solution
    • Determine if Krausening is a valid solution
    • Leverage Krausening file watching as the "storage" instead of loading them into a config-store
    • Potentially load the properties as needed instead of in the up front initialization
  • Make sure the solution works with the regeneration policy
    • When the properties are updated we need to persist these updates across deployments
  • Allow users the ability to choose between the different storage options: vault, light weight, in memory, etc
  • Update documentation: helm chart, adocs, etc

Implementation details

  • There are some properties shared in the config store that are temporal and need to be refreshed. This solution needs to work with the regeneration policy
  • This means the updates need to be written/saved
  • We need to simplify the service layer to make it easier to consume. We want a low bearer of entry
    • The majority of this will be handled in a separate ticket but we need to be conscious of this point
  • We dont need to worry about the source config files changing. Future effort to handle live reloading of the configs

Test Strategy/Script

  • Create a downstream project with:
mvn archetype:generate -U -DarchetypeGroupId=com.boozallen.aissemble \
  -DarchetypeArtifactId=foundation-archetype \
  -DarchetypeVersion=1.8.0-SNAPSHOT \
  -DgroupId=com.boozallen.aissemble.test \
  -DartifactId=test-issue-config-store \
  -DprojectGitUrl=git.example.com/test-issue-config-store \
  -DprojectName="Issue Test"
  • Copy the src directory from the attached folder and put it into the root of the projects
    • If you are on a WSL instance and do not have the project on a path the Rancher instance can reach then save the src file somewhere on your C drive and make note of the path
  • Add to the fermenter-mda plugin executions in test-issue-config-store-deploy/pom.xml
<execution>
    <id>configuration-store</id>
    <phase>generate-sources</phase>
    <goals>
        <goal>generate-sources</goal>
    </goals>
    <configuration>
        <basePackage>com.boozallen.aissemble.test</basePackage>
        <profile>configuration-store-deploy-v2</profile>
        <!-- The property variables below are passed to the Generation Context and utilized
             to customize the deployment artifacts. -->
        <propertyVariables>
            <appName>configuration-store</appName>
        </propertyVariables>
    </configuration>
</execution>
  • Add the config-store-service to tilt with:
# For WSL users, the configuration files need to be in an accessible path. Update the project path to the root file system. Example: '/mnt/c' or '/mnt/wsl/rancher-desktop'
project_path = os.path.abspath('.')
# Update configuration_files_path to match the path of the config files to be loaded into the configuration store. Example 'my-project-deploy/src/main/resources/config'
configuration_files_path = 'src/main/resources/configurations'

load('ext://helm_resource', 'helm_resource')
helm_resource(
    name='configuration-store',
    release_name='configuration-store',
    chart='test-issue-config-store-deploy/src/main/resources/apps/configuration-store',
    namespace='config-store-ns',
    flags=['--values=test-issue-config-store-deploy/src/main/resources/apps/configuration-store/values.yaml',
           '--values=test-issue-config-store-deploy/src/main/resources/apps/configuration-store/values-dev.yaml',
           '--set=aissemble-configuration-store-chart.aissemble-quarkus-chart.deployment.supplementalVolumes[0].hostPath.path=' + project_path + '/' + configuration_files_path,
           '--create-namespace']
)
  • For wsl users change the following
project_path='/mnt/c/Users/YOUR_USER/PATH/TO/217-helper`
configuration_files_path = 'src/main/resources/configurations'
  • Build the project with mvn clean install
  • tilt up and wait for the configuration-store service to come up
  • Verify the propertyDaoClass is Krausening and the intial config loading was skipped by seeing these logs
[main] INFO  com.boozallen.aissemble.configuration.ConfigStoreInit.init():57 - Using property Dao class: com.boozallen.aissemble.configuration.dao.KrauseningPropertyDao 
[main] INFO  com.boozallen.aissemble.configuration.ConfigStoreInit.init():86 - Skipping config loading on initialization 
  • Verify you can retrieve the property info from another pod
  • ssh into the kafka pod - kubectl exec -it {kafka-pod} bash
  • run curl http://configuration-store.config-store-ns.svc:8083/aissemble-properties/aws-credentials/AWS_SECRET_ACCESS_KEY
{
  "groupName": "aws-credentials",
  "name": "AWS_SECRET_ACCESS_KEY",
  "value": "env-secret-access-key"
} 
  • Delete the newly created file src/main/resources/configurations/base/load-status.properties
  • Switch to using an the memory storage option by adding this into test-issue-config-store-deploy/src/main/resources/apps/configuration-store/values.yaml
- name: STORAGE_CLASS
  value: inMemory
  • Restart the tilt deployment
  • Verify the propertyDaoClass is in memory and the config intial loading was performed by viewing these logs
[main] INFO  com.boozallen.aissemble.configuration.ConfigStoreInit.init():57 - Using property Dao class: com.boozallen.aissemble.configuration.dao.InMemoryPropertyDao
...
[main] INFO  com.boozallen.aissemble.configuration.store.ConfigLoader.loadPropertiesURI():122 - Loading: aws-credentials.properties
...
[main] INFO  com.boozallen.aissemble.configuration.ConfigStoreInit.init():91 - Successfully initialized store configuration properties and policies.

References/Additional Context

@cwoods-cpointe cwoods-cpointe added the enhancement New feature or request label Jul 18, 2024
@cwoods-cpointe cwoods-cpointe self-assigned this Jul 18, 2024
cwoods-cpointe added a commit that referenced this issue Jul 23, 2024
 #217 leverage users desired property dao class
cwoods-cpointe added a commit that referenced this issue Jul 24, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 24, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 25, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 25, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 25, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 25, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 25, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 25, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 30, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 30, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Jul 30, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Aug 1, 2024
Leverage Krausening file watching. No need to pre load all the config on
server init. Use env var to dictate which storage option to use

 #217 refactor universal config vault storage
cwoods-cpointe added a commit that referenced this issue Aug 1, 2024
 #217 implement krausening as a light weight config store
cwoods-cpointe added a commit that referenced this issue Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant