Today's Trends
mediumInvestigatingKubernetes

Kubernetes metav1.ParseToLabelSelector Silently Drops Conflicting Equality Requirements

  1. Investigating(current)
  2. Trending(upcoming)
  3. Workaround available(upcoming)
  4. Resolved(upcoming)

Executive summary

The function metav1.ParseToLabelSelector silently drops conflicting equality requirements on the same key without throwing an error, returning a label selector that widens matches instead of identifying a contradiction.

No verified workaround yet

None of the linked reports describe a mitigation. Follow this incident to hear when one appears.

Technical root cause

The function keeps only the last provided equality requirement when duplicate keys are present, unlike labels.Parse which retains both.

Evidence

1 report · 1 GitHubShow
  1. [1]
    GitHub First report
    metav1.ParseToLabelSelector silently drops conflicting equality requirements on the same key(opens GitHub issue in a new tab)

    What happened? metav1.ParseToLabelSelector("tier=db,tier=web") returns MatchLabels{tier: web} with no error. Converted back via LabelSelectorAsSelector, that selector matches {tier: web}. labels.Parse("tier=db,tier=web") keeps both requirements, so the selector is a contradiction and matches nothing. The conversion therefore silently widens what the selector selects for. Reversing the input order (tier=web,tier=db) keeps tier=db instead — the survivor is whichever equality comes last. Why:…

    by Sun-Wukhan 0upvotes 2comments

Timeline

  1. First report on GitHub issue

    metav1.ParseToLabelSelector silently drops conflicting equality requirements on the same key

    Source