mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Close tunnels after failed healthchecks.
This commit is contained in:
parent
860cae0933
commit
1fdb3ee902
@ -377,15 +377,18 @@ func (l *SSHTunnelList) healthCheck(e sshTunnelEntry) error {
|
|||||||
func (l *SSHTunnelList) removeAndReAdd(e sshTunnelEntry) {
|
func (l *SSHTunnelList) removeAndReAdd(e sshTunnelEntry) {
|
||||||
// Find the entry to replace.
|
// Find the entry to replace.
|
||||||
l.tunnelsLock.Lock()
|
l.tunnelsLock.Lock()
|
||||||
defer l.tunnelsLock.Unlock()
|
|
||||||
for i, entry := range l.entries {
|
for i, entry := range l.entries {
|
||||||
if entry.Tunnel == e.Tunnel {
|
if entry.Tunnel == e.Tunnel {
|
||||||
l.entries = append(l.entries[:i], l.entries[i+1:]...)
|
l.entries = append(l.entries[:i], l.entries[i+1:]...)
|
||||||
l.adding[e.Address] = true
|
l.adding[e.Address] = true
|
||||||
go l.createAndAddTunnel(e.Address)
|
break
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
l.tunnelsLock.Unlock()
|
||||||
|
if err := e.Tunnel.Close(); err != nil {
|
||||||
|
glog.Infof("Failed to close removed tunnel: %v", err)
|
||||||
|
}
|
||||||
|
go l.createAndAddTunnel(e.Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *SSHTunnelList) Dial(net, addr string) (net.Conn, error) {
|
func (l *SSHTunnelList) Dial(net, addr string) (net.Conn, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user