Skip to content

Commit

Permalink
fix(notready): condition failed
Browse files Browse the repository at this point in the history
  • Loading branch information
redref committed Aug 18, 2023
1 parent f512cc5 commit 8b095a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controllers/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,11 @@ func (r *NodeReconciler) skipLv(ctx context.Context, lv carinav1.LogicVolume) (b
podList := &corev1.PodList{}
err := r.Client.List(ctx, podList, client.MatchingFields{"combinedIndex": fmt.Sprintf("%s-%s", carina.CarinaSchedule, lv.Spec.NodeName)})
if err != nil {
return false, err
return true, err
}
for _, p := range podList.Items {
for _, vol := range p.Spec.Volumes {
log.Debugf("skipLv process %s %s %s", p.ObjectMeta.Namespace, p.ObjectMeta.Name, vol.PersistentVolumeClaim.ClaimName)
if vol.PersistentVolumeClaim == nil {
continue
}
Expand All @@ -371,9 +372,11 @@ func (r *NodeReconciler) skipLv(ctx context.Context, lv carinav1.LogicVolume) (b
// check annotation carina.storage.io/allow-pod-migration-if-node-notready: true
if _, ok := p.Annotations[carina.AllowPodMigrationIfNodeNotready]; !ok || p.Annotations[carina.AllowPodMigrationIfNodeNotready] == "false" {
return true, nil
} else {
return false, nil
}

}
}
return false, nil
return true, fmt.Errorf("skipLv did not found pod, skip")
}

0 comments on commit 8b095a1

Please sign in to comment.