mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Let the kubernetes service reconciler timeout on shutdown
This commit is contained in:
parent
e3e31ecd40
commit
a2ef4735cd
@ -152,7 +152,22 @@ func (c *Controller) Stop() {
|
|||||||
c.runner.Stop()
|
c.runner.Stop()
|
||||||
}
|
}
|
||||||
endpointPorts := createEndpointPortSpec(c.PublicServicePort, "https", c.ExtraEndpointPorts)
|
endpointPorts := createEndpointPortSpec(c.PublicServicePort, "https", c.ExtraEndpointPorts)
|
||||||
c.EndpointReconciler.StopReconciling("kubernetes", c.PublicIP, endpointPorts)
|
finishedReconciling := make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
defer close(finishedReconciling)
|
||||||
|
glog.Infof("Shutting down kubernetes service endpoint reconciler")
|
||||||
|
if err := c.EndpointReconciler.StopReconciling("kubernetes", c.PublicIP, endpointPorts); err != nil {
|
||||||
|
glog.Error(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-finishedReconciling:
|
||||||
|
// done
|
||||||
|
case <-time.After(2 * c.EndpointInterval):
|
||||||
|
// don't block server shutdown forever if we can't reach etcd to remove ourselves
|
||||||
|
glog.Warning("StopReconciling() timed out")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunKubernetesNamespaces periodically makes sure that all internal namespaces exist
|
// RunKubernetesNamespaces periodically makes sure that all internal namespaces exist
|
||||||
|
Loading…
Reference in New Issue
Block a user