Skip to content

Commit

Permalink
fix: handle errors in podsWithDeletingCachedImages
Browse files Browse the repository at this point in the history
  • Loading branch information
paullaffitte committed Oct 9, 2024
1 parent f2ecd80 commit 5f287de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/controller/core/pod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ func (r *PodReconciler) podsWithDeletingCachedImages(ctx context.Context, obj cl
}

var podList corev1.PodList
podRequirements, _ := labels.NewRequirement(LabelManagedName, selection.Equals, []string{"true"})
podRequirements, err := labels.NewRequirement(LabelManagedName, selection.Equals, []string{"true"})
if err != nil {
// errors cannot be handled in a better way for now (see https://github.com/kubernetes-sigs/controller-runtime/issues/1996)
// maybe we don't need to enqueue all Pods related to this CachedImage but only those in the status UsedBy
log.Error(err, "could not list pods")
return nil
}
selector := labels.NewSelector()
selector = selector.Add(*podRequirements)
if err := r.List(ctx, &podList, &client.ListOptions{
Expand Down

0 comments on commit 5f287de

Please sign in to comment.