Skip to content

"non-exact field matches are not supported by the cache" when using fieldSelector with not exact fields #612

Closed
@sarjeet2013

Description

@sarjeet2013

I am getting the following error when trying to get list of pods with their state filetered with fieldSelector.

"error":"non-exact field matches are not supported by the cache"

Here is the sample code:

fieldSelector, err := fields.ParseSelector("spec.nodeName=" + nodeName + ",status.phase!=" + string(corev1.PodSucceeded) + ",status.phase!=" + string(corev1.PodFailed))
activePodsList := &corev1.PodList{}
listOptions := &client.ListOptions{FieldSelector: fieldSelector}
if err := r.List(context.TODO(), listOptions, activePodsList); err != nil {
  return reconcile.Result{}, err
}

This look like a current limitation and not supported. See https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/cache/internal/cache_reader.go#L99

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/designCategorizes issue or PR as related to design.kind/featureCategorizes issue or PR as related to a new feature.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.priority/awaiting-more-evidenceLowest priority. Possibly useful, but not yet enough support to actually get it done.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions