More flexible shutdown ordering machinery
See individual commits.
Relates to #616 (closed).
While working on the fix for the above issue, I realized that the current ModuleStartStopPhase
-based approach is not flexible enough to express what is necessary: kubernetes_api_server
depends on kas2agentk_tunnel_server
which depends on servers which depend on modules, etc. We cannot have correct shutdown just with two phases here. Hence, this refactoring removes phases and introduces a more explicit and more flexible mechanism. We now can have any ordering we want just by arranging the layers in the desired way.
This MR does not fix the bug, only sets the stage for the fix.
Edited by Mikhail Mazurskiy