mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
plugin/kubernetes: implement HasSynced() (#1155)
* plugin/kubernetes: wait until api is ready Wait for HasSynced before allowing startup to avoid startup race. Also do a small refactor in findServices() to pull a check out of the loop - only needs to be done once. * sigh
This commit is contained in:
@@ -39,8 +39,14 @@ func setup(c *caddy.Controller) error {
|
||||
c.OnStartup(func() error {
|
||||
go kubernetes.APIConn.Run()
|
||||
if kubernetes.APIProxy != nil {
|
||||
go kubernetes.APIProxy.Run()
|
||||
kubernetes.APIProxy.Run()
|
||||
}
|
||||
synced := false
|
||||
for synced == false {
|
||||
synced = kubernetes.APIConn.HasSynced()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user