// init ServiceEntryStore
// register handler for SE and WE
**serviceentry.NewServiceDiscovery()-->**
ServiceEntryStore()
configController.RegisterEventHandler(s.serviceEntryHandler)-->
// serviceEntryHandler()
// convert serviceEntry to services based on hosts and ports
convertServices()
addedSvcs, deletedSvcs, updatedSvcs, unchangedSvcs = servicesDiff(os, cs)
s.XdsUpdater.SvcUpdate() // add/update/delete
s.edsUpdate(instances, true)
s.XdsUpdater.ConfigUpdate(pushReq)
configController.RegisterEventHandler()-->
convertWorkloadEntryToWorkloadInstance() // workloadInstance: addr+portMap
h(si, event) -->
// handler is registerred in pilot/pkg/serviceregistry/kube/controller/controller.go:WorkloadInstanceHandler
// WorkloadInstanceHandler()
// Allow selecting workload entries from k8s services (#23683)
getPodServices()
c.xdsUpdater.EDSUpdate(c.clusterID, string(service.Hostname), service.Attributes.Namespace, endpoints)
// compute delta and update map cache
s.edsUpdate()
s.XdsUpdater.ProxyUpdate()
s.XdsUpdater.ConfigUpdate()
serviceControllers.AddRegistry(s.serviceEntryStore)
**s.initKubeRegistry()-->**
// TODO: Resync time was configured to 0, resetting to 30
kubecontroller.NewMulticluster()
// initialize the "main" cluster
mc.AddMemberCluster()-->
kubeRegistry := [NewController(client, options)](<https://cncamp.notion.site/NewController-client-options-8e772cfd71364ad99264321ec0b6d8b6>)-->
m.serviceController.AddRegistry(kubeRegistry)
kubeRegistry.AppendServiceHandler(func(svc *model.Service, ev model.Event) { m.updateHandler(svc) })-->
m.XDSUpdater.ConfigUpdate(req)
kubeRegistry.AppendWorkloadHandler(m.serviceEntryStore.WorkloadInstanceHandler)
NewNamespaceController(m.fetchCaRoot, client)
// Patch validation webhook cert
go validationWebhookController.Start(clusterStopCh)
kube.RunAndWait()-->
c.kubeInformer.Start(stop)
c.dynamicInformer.Start(stop)
c.metadataInformer.Start(stop)
c.istioInformer.Start(stop)
c.gatewayapiInformer.Start(stop)
// start remote cluster controllers
s.addStartFunc(func(stop <-chan struct{}) error {
mc.InitSecretController(stop)
return nil
})
s.multicluster = mc
NewController(client, options)