fix: Reload dnsmasq instead of restart to avoid DNS downtime
Use systemctl reload-or-restart instead of restart. dnsmasq supports SIGHUP to reload config without dropping DNS service, preventing transient DNS resolution failures during reconciliation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,14 +104,15 @@ func (g *ConfigGenerator) WriteConfig(cfg *config.GlobalConfig, clouds []config.
|
||||
return nil
|
||||
}
|
||||
|
||||
// RestartService restarts the dnsmasq service
|
||||
// RestartService reloads the dnsmasq service (SIGHUP — no downtime).
|
||||
// Falls back to restart if reload fails.
|
||||
func (g *ConfigGenerator) RestartService() error {
|
||||
cmd := exec.Command("systemctl", "restart", "dnsmasq.service")
|
||||
cmd := exec.Command("systemctl", "reload-or-restart", "dnsmasq.service")
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to restart dnsmasq: %w (output: %s)", err, string(output))
|
||||
return fmt.Errorf("failed to reload dnsmasq: %w (output: %s)", err, string(output))
|
||||
}
|
||||
slog.Info("dnsmasq service restarted", "component", "dnsmasq")
|
||||
slog.Info("dnsmasq service reloaded", "component", "dnsmasq")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user