addon-resizer/enhancements/5700-nanny-configuration-reload/README.md
Sure, here's the enhancement proposal in the requested format:
The proposed solution involves updating the addon-resizer with the following steps:
fsnotify under utils/fswatcher to watch nanny configurations' changes. It should run as a goroutine in the background.fswatcher trigger the reloading process when configuration changes are detected. Events should be sent in a channel.loadNannyConfiguration to apply the updated configuration to the addon-resizer.fswatcher under utils/fswatcher. It would contain the fswatcher struct and methods and unit-tests.
FsWatcher struct would look similar to this:type FsWatcher struct {
*fsnotify.Watcher
Events chan struct{}
ratelimit time.Duration
names []string
paths map[string]struct{}
}
CreateFsWatcher: Instantiates a new FsWatcher and start watching on file system.initWatcher: Initializes the fsnotify watcher and initialize the paths that would be watched.add: Adds a new file to watch.reset: Re-initializes the FsWatcher.watch: watches for the configured files.FsWatcher and then we wait in an infinite loop to receive events indicating
filesystem changes. Based on these changes, we re-execute loadNannyConfiguration function.Note: The expected configuration file format is YAML. It has the same structure as the NannyConfiguration CRD.
To ensure the proper functioning of the enhanced addon-resizer, the following test plan should be executed:
BaseMemory of 300Mi and then we change the BaseMemory to 100Mi. We should observer changes in the behavior of watched pod.