Enable TCP Keep Alive for Marathon Client and make value configurable (#784)
* Resolve rebase conflicts * Fix imports that VSCode messed up
This commit is contained in:
parent
15732269da
commit
567387aee0
4 changed files with 18 additions and 2 deletions
|
@ -35,6 +35,7 @@ type Marathon struct {
|
|||
MarathonLBCompatibility bool `description:"Add compatibility with marathon-lb labels"`
|
||||
TLS *ClientTLS `description:"Enable Docker TLS support"`
|
||||
DialerTimeout time.Duration `description:"Set a non-default connection timeout for Marathon"`
|
||||
KeepAlive time.Duration `description:"Set a non-default TCP Keep Alive time in seconds"`
|
||||
Basic *MarathonBasic
|
||||
marathonClient marathon.Marathon
|
||||
}
|
||||
|
@ -71,10 +72,11 @@ func (provider *Marathon) Provide(configurationChan chan<- types.ConfigMessage,
|
|||
}
|
||||
config.HTTPClient = &http.Client{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: TLSConfig,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: time.Second * provider.DialerTimeout,
|
||||
KeepAlive: provider.KeepAlive * time.Second,
|
||||
Timeout: time.Second * provider.DialerTimeout,
|
||||
}).DialContext,
|
||||
TLSClientConfig: TLSConfig,
|
||||
},
|
||||
}
|
||||
client, err := marathon.NewClient(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue