|
@@ -309,20 +309,17 @@ func (r *remote) monitorConnection(monitor *containerd.Client) {
|
|
}
|
|
}
|
|
<-r.daemonWaitCh
|
|
<-r.daemonWaitCh
|
|
|
|
|
|
- monitor.Close()
|
|
|
|
os.Remove(r.GRPC.Address)
|
|
os.Remove(r.GRPC.Address)
|
|
if err := r.startContainerd(); err != nil {
|
|
if err := r.startContainerd(); err != nil {
|
|
r.logger.WithError(err).Error("failed restarting containerd")
|
|
r.logger.WithError(err).Error("failed restarting containerd")
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
- newMonitor, err := containerd.New(r.GRPC.Address)
|
|
|
|
- if err != nil {
|
|
|
|
|
|
+ if err := monitor.Reconnect(); err != nil {
|
|
r.logger.WithError(err).Error("failed connect to containerd")
|
|
r.logger.WithError(err).Error("failed connect to containerd")
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
- monitor = newMonitor
|
|
|
|
var wg sync.WaitGroup
|
|
var wg sync.WaitGroup
|
|
|
|
|
|
for _, c := range r.clients {
|
|
for _, c := range r.clients {
|
|
@@ -331,18 +328,12 @@ func (r *remote) monitorConnection(monitor *containerd.Client) {
|
|
go func(c *client) {
|
|
go func(c *client) {
|
|
defer wg.Done()
|
|
defer wg.Done()
|
|
c.logger.WithField("namespace", c.namespace).Debug("creating new containerd remote client")
|
|
c.logger.WithField("namespace", c.namespace).Debug("creating new containerd remote client")
|
|
- c.remote.Close()
|
|
|
|
-
|
|
|
|
- remote, err := containerd.New(r.GRPC.Address, containerd.WithDefaultNamespace(c.namespace))
|
|
|
|
- if err != nil {
|
|
|
|
|
|
+ if err := c.reconnect(); err != nil {
|
|
r.logger.WithError(err).Error("failed to connect to containerd")
|
|
r.logger.WithError(err).Error("failed to connect to containerd")
|
|
// TODO: Better way to handle this?
|
|
// TODO: Better way to handle this?
|
|
// This *shouldn't* happen, but this could wind up where the daemon
|
|
// This *shouldn't* happen, but this could wind up where the daemon
|
|
// is not able to communicate with an eventually up containerd
|
|
// is not able to communicate with an eventually up containerd
|
|
- return
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- c.setRemote(remote)
|
|
|
|
}(c)
|
|
}(c)
|
|
|
|
|
|
wg.Wait()
|
|
wg.Wait()
|