mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-19 06:43:10 +00:00
nfd-master: stop node-updater pool before reconfiguring api-controller
Prevents potential race between node-updater pool and the api-controller when re-configuring nfd-master. Reconfiguration causes a new api-controller instance to be created so nfd api lister might change in the midst of processing a node update (if the pool was running). No actual issues related to this have been identified but races (like this) should still be avoided.
This commit is contained in:
parent
31a56acdd4
commit
ba4cebb29e
1 changed files with 8 additions and 3 deletions
|
@ -350,6 +350,11 @@ func (m *nfdMaster) Run() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop the nodeUpdaterPool so that no node updates are underway
|
||||||
|
// while we reconfigure the NFD API controller (including the
|
||||||
|
// listers) below
|
||||||
|
m.nodeUpdaterPool.stop()
|
||||||
|
|
||||||
// restart NFD API controller
|
// restart NFD API controller
|
||||||
if m.nfdController != nil {
|
if m.nfdController != nil {
|
||||||
klog.InfoS("stopping the nfd api controller")
|
klog.InfoS("stopping the nfd api controller")
|
||||||
|
@ -361,13 +366,13 @@ func (m *nfdMaster) Run() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Restart the nodeUpdaterPool
|
||||||
|
m.nodeUpdaterPool.start(m.config.NfdApiParallelism)
|
||||||
|
|
||||||
// Update all nodes when the configuration changes
|
// Update all nodes when the configuration changes
|
||||||
if m.nfdController != nil && features.NFDFeatureGate.Enabled(features.NodeFeatureAPI) {
|
if m.nfdController != nil && features.NFDFeatureGate.Enabled(features.NodeFeatureAPI) {
|
||||||
m.nfdController.updateAllNodesChan <- struct{}{}
|
m.nfdController.updateAllNodesChan <- struct{}{}
|
||||||
}
|
}
|
||||||
// Restart the node updater pool
|
|
||||||
m.nodeUpdaterPool.stop()
|
|
||||||
m.nodeUpdaterPool.start(m.config.NfdApiParallelism)
|
|
||||||
|
|
||||||
case <-m.stop:
|
case <-m.stop:
|
||||||
klog.InfoS("shutting down nfd-master")
|
klog.InfoS("shutting down nfd-master")
|
||||||
|
|
Loading…
Add table
Reference in a new issue