Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to filters configmaps with 2 distincts selectors in the cache #3024

Closed
FloMedja opened this issue Nov 27, 2024 · 2 comments
Closed

How to filters configmaps with 2 distincts selectors in the cache #3024

FloMedja opened this issue Nov 27, 2024 · 2 comments

Comments

@FloMedja
Copy link

FloMedja commented Nov 27, 2024

I have configsmaps with 2 distincts labels lets say labelA=valueA and labelB=valueB.

I would like to filter the configMaps and only add the one with those 2 labels to my cache with the cache.Options. However It is not possible to add two times the same Object type to ByObect because support a map[client.Object]ByObject. Additionally the selector on a type of object in the map didn't support the OR operation on labels

Do someone have a tips on how to do this ? Thanks

@alvaroaleman
Copy link
Member

This is not possible because Kubernetes label selectors do not support OR directly: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

The best you can get to is to re-use the key and use a selector of the form label-key in (value1, value2)

@FloMedja
Copy link
Author

That's what I thought but I want to confirm anyway. I would look for another approach.
Thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants