Skip to content

Commit

Permalink
Fix nil pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jknipper committed Feb 28, 2023
1 parent 55b764d commit 47b9124
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kube-fip-controller/pkg/frameworks/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ func (k8s *K8sFramework) AddLabelsToNode(ctx context.Context, node *corev1.Node,

// GetNodeFromIndexerByKey returns a node by key from the informers indexer.
func (k8s *K8sFramework) GetNodeFromIndexerByKey(key string) (*corev1.Node, bool, error) {
obj, exists, err := k8s.nodeInformer.GetIndexer().GetByKey(key)
return obj.(*corev1.Node), exists, err
obj, _, err := k8s.nodeInformer.GetIndexer().GetByKey(key)
if err != nil || obj == nil {
return nil, false, err
}
return obj.(*corev1.Node), true, nil
}

// GetNodeInformerStore returns the Store of the node informer.
Expand Down

0 comments on commit 47b9124

Please sign in to comment.