-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Title: InitManager to support dependency based initialization
Description:
When refactoring ClusterManager to use InitManager, (please see PR #3700 for the reasons why such refactoring is needed), it will be much easier if InitManager supports dependency based initialization.
Cluster Manager has EDS cluster which may depends on other static clusters. Now it is using fairly complicated primary and secondary list to initialize.
With Added SDS (PR #3700), it become even more complicated. Even some static clusters may need SDS to download the client secrets and SDS may need another static cluster.
If InitManager supports dependency based initialization, this will be much easier. Each target can specify its dependencies, InitManager will initialize these targets based on the dependency.
Here is the detail design:
Target Interface: {
void initialize() PURE; // existing call
string name(); // the unique target name; for cluster, it can be cluster name.
vector depend_on(); // the depended target names
};
InitManager initialize() call will sort the targets based on the dependency and start to initialize them.
ClusterManager can use InitManager in following way: each cluster (as InitTarget) can find out if it is using any other clusters, if so, use "depends_on()" function to return the depended cluster names.