Kubernetes metav1.ParseToLabelSelector Silently Drops Conflicting Equality Requirements
- Investigating(current)
- Trending(upcoming)
- Workaround available(upcoming)
- 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.
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]GitHub First reportmetav1.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
- First report on GitHub issue
metav1.ParseToLabelSelector silently drops conflicting equality requirements on the same key
Source