reload service registration configuration on SIGHUP (#17598)

* add reloading service configuration

* add changelog entry

* add tests

* fix typo

* check if config.ServiceRegistration is nil before signaling

* add changes for deregistering service on nil config with failing tests

* fix tests by decreasing reconcile_timeout + setting consul agent tokens

* fix races

* add comments in test

---------

Co-authored-by: Marc Boudreau <marc.boudreau@hashicorp.com>
This commit is contained in:
Kevin Schoonover
2024-05-09 14:13:14 -07:00
committed by GitHub
parent 077c70fc1f
commit c0ea7b1a35
7 changed files with 288 additions and 114 deletions

View File

@@ -1685,6 +1685,15 @@ func (c *ServerCommand) Run(args []string) int {
}
}
// notify ServiceRegistration that a configuration reload has occurred
if sr := coreConfig.GetServiceRegistration(); sr != nil {
var srConfig *map[string]string
if config.ServiceRegistration != nil {
srConfig = &config.ServiceRegistration.Config
}
sr.NotifyConfigurationReload(srConfig)
}
if err := core.ReloadCensus(); err != nil {
c.UI.Error(err.Error())
}