Skip to content

Commit 3bc62f4

Browse files
authored
Merge pull request #2130 from marquiz/devel/nfd-master-cleanup
nfd-master: cleanup nil checks
2 parents 37c0dc2 + 48f26ff commit 3bc62f4

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

pkg/nfd-master/nfd-master.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,10 @@ func (m *nfdMaster) Run() error {
304304
registerVersion(version.Get())
305305

306306
// Run updater that handles events from the nfd CRD API.
307-
if m.nfdController != nil {
308-
if m.args.EnableLeaderElection {
309-
go m.nfdAPIUpdateHandlerWithLeaderElection()
310-
} else {
311-
go m.nfdAPIUpdateHandler()
312-
}
307+
if m.args.EnableLeaderElection {
308+
go m.nfdAPIUpdateHandlerWithLeaderElection()
309+
} else {
310+
go m.nfdAPIUpdateHandler()
313311
}
314312

315313
// Register health probe (at this point we're "ready and live")
@@ -388,10 +386,7 @@ func (m *nfdMaster) nfdAPIUpdateHandler() {
388386

389387
// Stop NfdMaster
390388
func (m *nfdMaster) Stop() {
391-
if m.nfdController != nil {
392-
m.nfdController.stop()
393-
}
394-
389+
m.nfdController.stop()
395390
m.updaterPool.stop()
396391

397392
close(m.stop)
@@ -665,10 +660,6 @@ func (m *nfdMaster) isThirdPartyNodeFeature(nodeFeature nfdv1alpha1.NodeFeature,
665660
}
666661

667662
func (m *nfdMaster) nfdAPIUpdateOneNode(cli k8sclient.Interface, node *corev1.Node) error {
668-
if m.nfdController == nil || m.nfdController.featureLister == nil {
669-
return nil
670-
}
671-
672663
// Merge all NodeFeature objects into a single NodeFeatureSpec
673664
nodeFeatures, err := m.getAndMergeNodeFeatures(node.Name)
674665
if err != nil {
@@ -706,9 +697,6 @@ func (m *nfdMaster) nfdAPIUpdateAllNodeFeatureGroups() error {
706697

707698
func (m *nfdMaster) nfdAPIUpdateNodeFeatureGroup(nfdClient nfdclientset.Interface, nodeFeatureGroup *nfdv1alpha1.NodeFeatureGroup) error {
708699
klog.V(2).InfoS("evaluating NodeFeatureGroup", "nodeFeatureGroup", klog.KObj(nodeFeatureGroup))
709-
if m.nfdController == nil || m.nfdController.featureLister == nil {
710-
return nil
711-
}
712700

713701
// Get all Nodes
714702
nodes, err := getNodes(m.k8sClient)

0 commit comments

Comments
 (0)