Cleanup remotedialer tunnel logs

pull/629/head
Erik Wilson 2019-07-10 14:50:23 -07:00
parent c18e896ab9
commit 034a863696
1 changed files with 9 additions and 6 deletions

View File

@ -91,7 +91,7 @@ func Setup(config *config.Node) error {
FieldSelector: fields.Set{"metadata.name": "kubernetes"}.String(), FieldSelector: fields.Set{"metadata.name": "kubernetes"}.String(),
}) })
if err != nil { if err != nil {
logrus.Errorf("Unable to watch for endpoints: %v", err) logrus.Errorf("Unable to watch for tunnel endpoints: %v", err)
time.Sleep(5 * time.Second) time.Sleep(5 * time.Second)
continue connect continue connect
} }
@ -100,21 +100,24 @@ func Setup(config *config.Node) error {
select { select {
case ev, ok := <-watch.ResultChan(): case ev, ok := <-watch.ResultChan():
if !ok { if !ok {
logrus.Error("endpoint watch channel closed") logrus.Error("Tunnel endpoint watch channel closed")
continue connect continue connect
} }
endpoint, ok := ev.Object.(*v1.Endpoints) endpoint, ok := ev.Object.(*v1.Endpoints)
if !ok { if !ok {
logrus.Error("could not case event object to endpoint") logrus.Error("Tunnel could not case event object to endpoint")
continue watching continue watching
} }
validEndpoint := map[string]bool{}
var addresses = getAddresses(endpoint) var addresses = getAddresses(endpoint)
logrus.Infof("Tunnel endpoint watch event: %v", addresses)
validEndpoint := map[string]bool{}
for _, address := range addresses { for _, address := range addresses {
validEndpoint[address] = true validEndpoint[address] = true
if _, ok := disconnect[address]; !ok { if _, ok := disconnect[address]; !ok {
disconnect[address] = connect(wg, address, config, transportConfig) disconnect[address] = connect(nil, address, config, transportConfig)
} }
} }
@ -173,7 +176,7 @@ func connect(waitGroup *sync.WaitGroup, address string, config *config.Node, tra
}) })
if ctx.Err() != nil { if ctx.Err() != nil {
logrus.Infof("Stopping tunnel to %s", wsURL) logrus.Infof("Stopped tunnel to %s", wsURL)
return return
} }
} }