s.initStatusController()
status.NewController() // TODO: status controller client rate limit are here
controller.Start() // TODO: this function computes the status update ratio every 200 ms
s.initK8SConfigStore()
// configController is a ConfigCacheStore
configController := makeKubeConfigController()-->
crdclient.New()-->
// init istio client, istio object informer and reg handler
// TODO: all istio obj and service apis share same queue
NewForSchemas()-->
// queue element is a function which obj and registered handler as parameter
createCacheHandler()-->
cl.queue.Push(func() error {
return h.onEvent(nil, obj, model.EventAdd)
})
s.initInprocessAnalysisController(args)
s.RWConfigStore, err = configaggregate.MakeWriteableCache(s.ConfigStores, configController)
// NewController create a controller which manages workload lifecycle and health status.
s.XDSServer.WorkloadEntryController = workloadentry.NewController()
aggregateConfigController, err := configaggregate.MakeCache(s.ConfigStores)
s.configController = aggregateConfigController
s.environment.IstioConfigStore = model.MakeIstioStore(s.configController)
// Defer starting the controller until after the service is created.
s.addStartFunc(func(stop <-chan struct{}) error {
go s.configController.Run(stop)
return nil
})
// handler function cache_handler.go:onEvent()-->
//================================
// handler is registerred by server.go:initRegistryEventHandlers()
// which will call s.XDSServer.ConfigUpdate(pushReq)
for _, f := range h.handlers {
f(oldConfig, currConfig, event)
}
//================================