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

Add filtering of watched resources #2378

Closed
vadimeisenbergibm opened this issue Jan 9, 2020 · 7 comments
Closed

Add filtering of watched resources #2378

vadimeisenbergibm opened this issue Jan 9, 2020 · 7 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. language/ansible Issue is related to an Ansible operator project
Milestone

Comments

@vadimeisenbergibm
Copy link

Feature Request

Is your feature request related to a problem? Please describe.
I would like my Ansible operator to watch some resources, for example pods, and I want it to run only on some specific pods, for example pods with some label.

Describe the solution you'd like
I would like to be able to add selectors in watches.yaml to specify selectors of the watched resources, e.g. labels.

@camilamacedo86 camilamacedo86 added language/ansible Issue is related to an Ansible operator project kind/feature Categorizes issue or PR as related to a new feature. labels Jan 9, 2020
@camilamacedo86
Copy link
Contributor

@fabianvf would be great have your input here?

@fabianvf
Copy link
Member

Yeah this makes a ton of sense, especially if you've got a cluster-wide watch on something like secrets. If it's already easy to establish a watch with a selector in controller-runtime this would be as simple as adding a field to the ansible Watch struct and passing it through when we establish the watch. Might be a good first issue for someone to pick up

@estroz estroz added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Mar 23, 2020
@estroz estroz added this to the Backlog milestone Mar 23, 2020
@dmvolod
Copy link
Contributor

dmvolod commented May 1, 2020

/assign @dmvolod

@joelanford
Copy link
Member

This isn't as simple as it seems unfortunately. See kubernetes-sigs/controller-runtime#244.

A naive workaround now would be to do the filtering client-side using a predicate. The obvious problem is that if your operator is watching chatty resources cluster-wide, there's going to be a lot of unnecessary traffic.

@dmvolod
Copy link
Contributor

dmvolod commented May 2, 2020

/unassign @dmvolod

@fabianvf
Copy link
Member

fabianvf commented Jun 9, 2020

@joelanford that's a shame, though we can at least add the config option and add a predicate that will filter based on the config, which will at least save users from needing to do a full python + ansible initialization before skipping the event. In the future when controller-runtime supports it we can replace the predicate with a more proper implementation.

@asmacdo
Copy link
Member

asmacdo commented Aug 25, 2020

Looks like this is done.

@asmacdo asmacdo closed this as completed Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature. language/ansible Issue is related to an Ansible operator project
Projects
None yet
Development

No branches or pull requests

7 participants