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 <eric.weber@suse.com>
  • Loading branch information
ejweber authored and David Ko committed Jan 4, 2024
1 parent 1ccf63d commit 3921faf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controller/node_controller.go
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 3921faf

Please sign in to comment.