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

improve informer creation when same resources are watched #17

Closed
viktorpergjoka opened this issue Jan 18, 2025 · 0 comments · Fixed by #19
Closed

improve informer creation when same resources are watched #17

viktorpergjoka opened this issue Jan 18, 2025 · 0 comments · Fixed by #19
Assignees
Labels
enhancement New feature or request

Comments

@viktorpergjoka
Copy link
Owner

viktorpergjoka commented Jan 18, 2025

Every @Watch annotated methods creates one informer, because every resource needs its own informer.

for example:

@Informer 
public class Test {

    @Watch(event = EventType.ADD, resource = Pod.class)
    public void added(Pod pod){ 
    }

    @Watch(event = EventType.UPDATE, resource = Pod.class)
    public void updated(Pod pod, Pod pod2){
    }

    @Watch(event = EventType.DELETE, resource = Pod.class)
    public void deleted(Pod pod){}
}

This creates 3 informer. But since all 3 Watches are watching the same resource (in this case a Pod), one informer is sufficient.

Another example:

@Informer
public class Test {

    @Watch(event = EventType.ADD, resource = Pod.class)
    public void added(Pod pod){ 
    }

    @Watch(event = EventType.UPDATE, resource = Pod.class)
    public void updated(Pod pod, Pod pod2){
    }

    @Watch(event = EventType.DELETE, resource = Secret.class)
    public void deleted(Secret secret){}
}

This creates also 3 informers. 2 are at a minimum needed because we have 2 different resources (Pod and Secret).
The 2 Watch annotated methods for the Pods could also be created in one informer.

@viktorpergjoka viktorpergjoka added the enhancement New feature or request label Jan 18, 2025
@viktorpergjoka viktorpergjoka self-assigned this Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant