|
|
|
@ -52,7 +52,7 @@ func getAddresses(endpoint *v1.Endpoints) []string {
|
|
|
|
|
return serverAddresses |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Setup(config *config.Node) error { |
|
|
|
|
func Setup(ctx context.Context, config *config.Node) error { |
|
|
|
|
restConfig, err := clientcmd.BuildConfigFromFlags("", config.AgentConfig.KubeConfigNode) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
@ -133,7 +133,18 @@ func Setup(config *config.Node) error {
|
|
|
|
|
} |
|
|
|
|
}() |
|
|
|
|
|
|
|
|
|
wg.Wait() |
|
|
|
|
wait := make(chan int, 1) |
|
|
|
|
go func() { |
|
|
|
|
wg.Wait() |
|
|
|
|
wait <- 0 |
|
|
|
|
}() |
|
|
|
|
|
|
|
|
|
select { |
|
|
|
|
case <-ctx.Done(): |
|
|
|
|
logrus.Error("tunnel context canceled while waiting for connection") |
|
|
|
|
return ctx.Err() |
|
|
|
|
case <-wait: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|