coryodaniel / bonny

The Elixir based Kubernetes Development Framework
MIT License
373 stars 27 forks source link

Add a reverse index of a CRDs resources #88

Open coryodaniel opened 4 years ago

coryodaniel commented 4 years ago

metadata.ownerReferences isn't a field that can be queried w/ field selectors, so to get all the items created by a CRD it would required polling all kinds/all resources which sucks.

The 'reverse index' or 'inventory' would include track all the resources created by this CRD. inspiration

spec:
  resources:
  - selfLink: "/v1/pods/namespace/default/foo"
  # or
  - name: foo
     namespace: default
     kind: Pod
     apiVersion: v1

This could be useful for looking up resources, not necessary for bonny itself, but it could be a nice helper for a controller that needed to find resources that it created.

This won't be needed for deletion once #49 is implemented, as garbage collection will be handled by k8s.

sleipnir commented 1 year ago

This still relevant ?

mruoss commented 1 year ago

What do you mean by "relevant"? There is no code in Bonny to manage a reverse index on the parent resource. It is relevant if people need it, right? But also, I don't see a simple solution to maintain such a reverse index. If a descendant is deleted, we'd need to update also the parent... A field selector would be nice but as far as I know, the only fields on CRDs which can be querried by field selectors are name and namespace. So no support there...

sleipnir commented 1 year ago

Yes it is relevant if people need it. But did anyone need it? It's just my curiosity.