Skip to content

Refactor definition of a leader module (`IsRunnableConfiguration`)

Timo Furrer requested to merge refactor/leader-modules into master
  • Refactor definition of a leader module

Previously to this change set a leader module was implemented by implementing the modagent.LeaderModule interface. This interface had a special method IsRunnableConfiguration(*agentcfg.AgentConfiguration) that has been used in the leader module wrapper (part of the leader election machinery) to decide if a given configuration is "runnable". This method was the only specific thing of the LeaderModule interface (compared to the Module interface (which the former extended). However, the IsRunnableConfiguration concept and being a leader module don't have much in common. A non-leader module might as well not be runnable given a semantically invalid configuration. On the other side a leader-only module may not depend on the agent configuration at all (see the starboard vulnerability module) and just always run.

This refactor changes the leader module identification by leaving it up to the module factory to specify if it produces leader modules or not.

With that the leader election process also doesn't need to evaluate the agent configuration for the module before forwarding it or stopping the running module in case the configuration isn't runnable. It is now up to the module to stop whatever it is doing if a given configuration is not runnable or just continue to run with a new runnable configuration.

  • Allow agent worker manager to be stopped and restarted

Based on Refactor and fix the leader election in agentk (!1021 - merged)

Merge request reports

Loading