Commit 91bfe62
committed
webhook: improve nodeSelectorsOverlap to detect subset overlaps
Previously, nodeSelectorsOverlap only detected identical selectors
using string equality. This missed partial overlaps where one selector
is a subset of another, allowing conflicting rules to be created.
Fix by using sel.Matches() to check if one selector's matchLabels
satisfies the other selector, catching subset overlap cases.
Add test case for subset selector overlap scenario.
Add comment noting matchExpressions limitation.
Signed-off-by: Shreya2005-2005 <bhakatmistu@email.com>
Signed-off-by: Shreya2005-2005 <bhakatmistu2005@gmail.com>1 parent 7514218 commit 91bfe62
2 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
130 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
333 | 345 | | |
334 | 346 | | |
335 | 347 | | |
| |||
0 commit comments