aws-greengrass / aws-greengrass-nucleus

The Greengrass nucleus component provides functionality for device side orchestration of deployments and lifecycle management for execution of Greengrass components and applications. This includes features such as starting, stopping, and monitoring execution of components and apps, interprocess communication server for communication between components, component installation and configuration management.
Apache License 2.0
108 stars 46 forks source link

Add additional update type which will not override existing configuration #1634

Open JElgar opened 4 months ago

JElgar commented 4 months ago

Feature Description From my understanding there are currently 2 available update types "reset" and "merge". Reset allows you to delete some config value and merge allows you to overwrite it.

I would like to be able to only update a key in the configuration if there is not an existing value.

Use Case

We are deploying greengrass components on behalf of ours users into their AWS accounts. Sometimes we want to be able to update our default configuration without overwriting any changes the user has made (appreciate this wont help with keys users have removed).

Proposed Solution

Add an additional update type similar to merge which only updates keys which do not currently exist in the config.

sameerzuberi commented 4 months ago

Hi, thank you for reaching out. This seems like a specific use case that would need to be implemented on the client side rather than within Greengrass. For example, you could "merge" a config value only if it matches its set default value, otherwise you would skip the update.

JElgar commented 4 months ago

I was looking at an approach along those lines although it doesn't seem like there's a sensible way to get the current configuration of a component in order to perform that merge. Even if there was pulling the config and doing the update outside of green grass could result in race conditions (config is updated after merge), although there might be existing solutions to that part?

sameerzuberi commented 4 months ago

The best approach would be to use the IPC. A component can use the IPC to get either its own config or the config of any other component, and it can also update its own config. This way each component can check if the user has made any changes to the default config, and update it if need be. Here are some docs for reference: https://docs.aws.amazon.com/greengrass/v2/developerguide/ipc-component-configuration.html#ipc-operation-updateconfiguration

alter-mage commented 3 months ago

Hi @JElgar, is this issue resolved or does this require further attention?