Skip to content

Commit

Permalink
Fix nil pointer dereference in shouldEvictReplica
Browse files Browse the repository at this point in the history
Longhorn 7475

Signed-off-by: Eric Weber <[email protected]>
  • Loading branch information
ejweber committed Jan 3, 2024
1 parent 30befe5 commit 3e485ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controller/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,9 @@ func (nc *NodeController) shouldEvictReplica(node *longhorn.Node, kubeNode *core
} else if isDownOrDeleted {
return false, longhorn.NodeConditionReasonKubernetesNodeNotReady, nil
}
if kubeNode == nil {
return false, longhorn.NodeConditionReasonKubernetesNodeGone, nil
}

if node.Spec.EvictionRequested || diskSpec.EvictionRequested {
return true, constant.EventReasonEvictionUserRequested, nil
Expand Down

0 comments on commit 3e485ea

Please sign in to comment.