knative-extensions / eventing-natss

NATS streaming integration with Knative Eventing.
Apache License 2.0
40 stars 42 forks source link

Deleting the last `NatsJetStreamChannel` in a namespace when namespace-scoped can result in orphaned resources #544

Closed dan-j closed 6 days ago

dan-j commented 7 months ago

Describe the bug If you have a NatsJetStreamChannel in a namespace with the eventing.knative.dev/scope: namespace annotation set, a dispatcher is deployed to that namespace. If the channel is then deleted, the controller deletes the dispatcher deployment, but sometimes the dispatcher doesn't have time to delete the underlying stream and/or consumers.

We can't move the stream/consumer management to the controller, because the credentials to the NATS cluster are based on the dispatcher (and we have different credentials in different namespaces).

What we really need to do is have multiple finalizers on the channel, so the actual channel isn't deleted until both reconcilers have time to finalize the resource. Once all finalizers are removed, it will then be deleted and the controller can remove the dispatcher deployment.

Expected behavior Any underlying resources are cleaned up when a channel is deleted.

To Reproduce See above.

Knative release version Latest

Additional context I already have the start of this fix in a big WIP which includes #542 and #543

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.

astelmashenko commented 4 months ago

/remove-lifecycle stale

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Reopen the issue with /reopen. Mark the issue as fresh by adding the comment /remove-lifecycle stale.