Skip to content

Commit

Permalink
Add support for DNS config hot-reload (#4875)
Browse files Browse the repository at this point in the history
The DNS config parameters `recursors` and `dns_config.*` are now hot
reloaded on SIGHUP or `consul reload` and do not need an agent restart
to be modified.
Config is stored in an atomic.Value and loaded at the beginning of each
request. Reloading only affects requests that start _after_ the
reload. Ongoing requests are not affected. To match the current
behavior the recursor handler is loaded and unloaded as needed on config
reload.
  • Loading branch information
Aestek authored and mkeeler committed Apr 24, 2019
1 parent b186c30 commit f669bb7
Show file tree
Hide file tree
Showing 4 changed files with 404 additions and 171 deletions.
6 changes: 6 additions & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -3579,6 +3579,12 @@ func (a *Agent) ReloadConfig(newCfg *config.RuntimeConfig) error {

a.loadLimits(newCfg)

for _, s := range a.dnsServers {
if err := s.ReloadConfig(newCfg); err != nil {
return fmt.Errorf("Failed reloading dns config : %v", err)
}
}

// create the config for the rpc server/client
consulCfg, err := a.consulConfig()
if err != nil {
Expand Down
Loading

0 comments on commit f669bb7

Please sign in to comment.