add client logic to determine whether TLS RPC connections should reload

This commit is contained in:
Chelsea Holland Komlo 2018-06-08 14:38:58 -04:00
parent de03ce8070
commit f74e74b22d
1 changed files with 11 additions and 1 deletions

View File

@ -432,7 +432,17 @@ func (c *Client) reloadTLSConnections(newConfig *nconfig.TLSConfig) error {
// Reload allows a client to reload its configuration on the fly
func (c *Client) Reload(newConfig *config.Config) error {
return c.reloadTLSConnections(newConfig.TLSConfig)
shouldReloadTLS, err := tlsutil.ShouldReloadRPCConnections(c.config.TLSConfig, newConfig.TLSConfig)
if err != nil {
c.logger.Printf("[ERR] nomad: error parsing server TLS configuration: %s", err)
return err
}
if shouldReloadTLS {
return c.reloadTLSConnections(newConfig.TLSConfig)
}
return nil
}
// Leave is used to prepare the client to leave the cluster