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

Cleaning up relations #1348

Open
alesstimec opened this issue Sep 4, 2024 · 2 comments
Open

Cleaning up relations #1348

alesstimec opened this issue Sep 4, 2024 · 2 comments

Comments

@alesstimec
Copy link
Contributor

When we destroy/remove resources via JIMM we do not clean up OpenFGA relations. In our staging JIMM we currently have a number of stale relations referring to resources that no longer exist.

@kian99
Copy link
Contributor

kian99 commented Sep 4, 2024

I noticed this recently when testing JIMM with Terraform. I think there's 2 issues.

  1. There's a relevant comment about this in internal/jimm/model.go

// NOTE (alesstimec) If we remove OpenFGA relation now, the user
// will no longer be authorised to check for model status (which
// will show the model as dying for a bit, until the Juju controller
// completes the model destuction).

We need to add some logic to the watcher code where we do the final cleanup of a model in the DB to also delete OpenFGA tuples.

  1. Additionally, we need to think about removing all relations to the destroyed resource not just for the owner.

This applies to models, application offers, etc.

@alesstimec
Copy link
Contributor Author

We could also just have a worker that lists all relations, tries to parse all tags, if we cannot parse a tag (usually because we cannot fetch the corresponding resource data from the db) we remove the relation..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants