From 72a23b83037a3e77971e5cf8070b4079c10db421 Mon Sep 17 00:00:00 2001 From: hc-github-team-nomad-core <82989552+hc-github-team-nomad-core@users.noreply.github.com> Date: Thu, 6 Oct 2022 16:28:55 -0400 Subject: [PATCH] Backport of Invoke FingerprintManager's Reload() func during agent's SIGHUP (Fixes #14614) into release/1.4.x (#14836) This pull request was automerged via backport-assistant --- .changelog/14615.txt | 3 +++ client/client.go | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changelog/14615.txt diff --git a/.changelog/14615.txt b/.changelog/14615.txt new file mode 100644 index 00000000000..6d8bb481f8b --- /dev/null +++ b/.changelog/14615.txt @@ -0,0 +1,3 @@ +```release-note:bug +client: Fixed a bug where network fingerprinters were not reloaded when the client configuration was reloaded with SIGHUP +``` diff --git a/client/client.go b/client/client.go index 70eef92df2c..d9ce225e15a 100644 --- a/client/client.go +++ b/client/client.go @@ -298,6 +298,9 @@ type Client struct { endpoints rpcEndpoints streamingRpcs *structs.StreamingRpcRegistry + // fingerprintManager is the FingerprintManager registered by the client + fingerprintManager *FingerprintManager + // pluginManagers is the set of PluginManagers registered by the client pluginManagers *pluginmanager.PluginGroup @@ -441,14 +444,14 @@ func NewClient(cfg *config.Config, consulCatalog consul.CatalogAPI, consulProxie return nil, fmt.Errorf("node setup failed: %v", err) } - fingerprintManager := NewFingerprintManager( + c.fingerprintManager = NewFingerprintManager( cfg.PluginSingletonLoader, c.GetConfig, cfg.Node, c.shutdownCh, c.updateNodeFromFingerprint, c.logger) c.pluginManagers = pluginmanager.New(c.logger) // Fingerprint the node and scan for drivers - if err := fingerprintManager.Run(); err != nil { + if err := c.fingerprintManager.Run(); err != nil { return nil, fmt.Errorf("fingerprinting failed: %v", err) } @@ -743,6 +746,8 @@ func (c *Client) Reload(newConfig *config.Config) error { return c.reloadTLSConnections(newConfig.TLSConfig) } + c.fingerprintManager.Reload() + return nil }