Skip to content

Commit 86bf44f

Browse files
authored
Merge pull request #1850 from marquiz/release-0.16
[release-0.16] nfd-master: proper shutdown of nfd api informers
2 parents 77fb7be + 335b305 commit 86bf44f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pkg/nfd-master/nfd-api-controller.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ func (c *nfdController) updateOneNode(typ string, obj metav1.Object) {
187187
klog.ErrorS(err, "failed to determine node name for object", "type", typ, "object", klog.KObj(obj))
188188
return
189189
}
190-
c.updateOneNodeChan <- nodeName
190+
select {
191+
case c.updateOneNodeChan <- nodeName:
192+
case <-c.stopChan:
193+
}
191194
}
192195

193196
func (c *nfdController) updateAllNodes() {
@@ -198,7 +201,10 @@ func (c *nfdController) updateAllNodes() {
198201
}
199202

200203
func (c *nfdController) updateNodeFeatureGroup(nodeFeatureGroup string) {
201-
c.updateNodeFeatureGroupChan <- nodeFeatureGroup
204+
select {
205+
case c.updateNodeFeatureGroupChan <- nodeFeatureGroup:
206+
case <-c.stopChan:
207+
}
202208
}
203209

204210
func (c *nfdController) updateAllNodeFeatureGroups() {

pkg/nfd-master/nfd-master.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func (m *nfdMaster) Run() error {
393393

394394
// Update all nodes when the configuration changes
395395
if m.nfdController != nil && nfdfeatures.NFDFeatureGate.Enabled(nfdfeatures.NodeFeatureAPI) && m.args.EnableNodeFeatureApi {
396-
m.nfdController.updateAllNodesChan <- struct{}{}
396+
m.nfdController.updateAllNodes()
397397
}
398398

399399
case <-m.stop:

0 commit comments

Comments
 (0)