Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

If a CRD is deleted, stop it's watcher #117

Closed
bryanl opened this issue Aug 7, 2019 · 3 comments
Closed

If a CRD is deleted, stop it's watcher #117

bryanl opened this issue Aug 7, 2019 · 3 comments
Assignees
Labels
api bug Something isn't working

Comments

@bryanl
Copy link
Contributor

bryanl commented Aug 7, 2019

When a CRD is deleted, the following is printed to the stderr

E0807 07:41:24.186729   16120 reflector.go:125] k8s.io/client-go/dynamic/dynamicinformer/informer.go:90: Failed to list *unstructured.Unstructured: the server could not find the requested resource
@bryanl bryanl added the bug Something isn't working label Aug 7, 2019
@wwitzel3 wwitzel3 added the api label Aug 7, 2019
@wwitzel3
Copy link
Contributor

Right now in dynamic_cache.go, currentInformer we create all of the informers using the dc.stopCh. To enable this behavior octant will need to create and store a stop channel for each informer created for a given GVR.

Octant can then lookup the stop channel of an informer for a given GVR and then send the singnal to the stop channel.

@bryanl bryanl self-assigned this Sep 9, 2019
@bryanl
Copy link
Contributor Author

bryanl commented Sep 10, 2019

This is more complex than I originally thought: kubernetes/kubernetes#79610

The solution is going to have to work around this inability to remove event handlers from informers. Here is what I'm thinking now:

When a CRD is removed, we'll need to replace the informer. This is not currently possible because DynamicSharedInformerFactory doesn't have a method for this. The factory code isn't complex and could be replicated to include only the features we need (e.g. add and remove informers, start them at create time instead of using start). I haven't looked at the source closely enough to determine what will leak if informers are replaced, but hopefully it should not be a problem if their stop channel is invoked first.

@tedyu
Copy link

tedyu commented Oct 6, 2019

type SharedInformer interface {

It seems we can add a Stop func to the above interface where the stop channel is closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants