Skip to content

Building reflector for different kinds of resources (found by annotations) #1257

Answered by clux
aellwein asked this question in Q&A
Discussion options

You must be logged in to vote

Ah, apologies. The Kubernetes api can only return one type at a time, and the reflector is made to ensure data availability in the store for a that single ongoing list/watch call (even if the connection is temporarily lost), so it is typed to that item because of this.

We haven't seen a need to allow putting more things in one Store because you can put multiple reflectors in a struct:

struct MultiReflector {
    podstore: Store<Pod>,
    deploystore: Store<Deployment>,
}

and implement a lookup on this struct that directs to the correct store based on a dynamic type / object reference. you would still have to pull on all the associated watch streams, but you can simplify that by flattening…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@aellwein
Comment options

@clux
Comment options

clux Jul 21, 2023
Maintainer

Answer selected by aellwein
@aellwein
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants