fix nil pointer cause longhorn-manager pods crushloopbackoff
fix nil pointer cause longhorn-manager pods crushloopbackoff to resolve ticket '[BUG] All longhorn-manager pods crushloopbackoff'
@@ -585,7 +585,8 @@ func (rc *ReplicaController) enqueueNodeChange(obj interface{}) {
// Add eviction requested replicas to the workqueue
for _, diskName := range evictionDisks {
- for replicaName := range node.Status.DiskStatus[diskName].ScheduledReplica {
+ if diskStatus, existed := node.Status.DiskStatus[diskName]; existed {
+ for replicaName := range diskStatus.ScheduledReplica {
replica, err := rc.ds.GetReplica(replicaName)
if err != nil {
return
@@ -593,6 +594,7 @@ func (rc *ReplicaController) enqueueNodeChange(obj interface{}) {
rc.enqueueReplica(replica)
}
}
+ }
return
}
