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

#1413: Support automatic cleanups for NodeSchemas without a sub resource #1419

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

achantavy
Copy link
Contributor

@achantavy achantavy commented Dec 27, 2024

Summary

Describe your changes.

#1413

Removes a restriction so that cartography's data model can now automatically clean up NodeSchemas that don't have a tenant relationship.

In these cases, the nodes will not be deleted even if they are considered stale, but their stale relationships will be.

We do it this way because cartography syncs assets one tenant at a time, and stale nodes can only be safely deleted if they are tied to a tenant so that we do not erroneously delete nodes attached to other tenants.

Related issues or links

Include links to relevant issues or other pages.

We discussed this in the above issue but I'll summarize a bit here: in the case of GitHub, GitHubUsers don't have a true "tenant" relationship with their organization because they can exist independent of their organizations. In this case, it makes sense for a GitHubUser to have a node schema that does not have a tenant rel. If we want to list out all of the users in an organization, then we simply query for the organization and its attached users.

Checklist

Provide proof that this works (this makes reviews move faster). Please perform one or more of the following:

  • Update/add unit or integration tests.
  • Include a screenshot showing what the graph looked like before and after your changes.
  • Include console log trace showing what happened before and after your changes.

Signed-off-by: Alex Chantavy <chantavy@gmail.com>
@@ -161,12 +161,8 @@ CREATE INDEX IF NOT EXISTS FOR (n:GCPSubnet) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:GCPSubnet) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:GCPVpc) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:GCPVpc) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:GitHubOrganization) ON (n.id);
Copy link
Contributor Author

@achantavy achantavy Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed anymore because GitHubOrganizations and GitHubUsers have been migrated to use the data model. The data model automatically ensures the required indexes are created.

Signed-off-by: Alex Chantavy <chantavy@gmail.com>
@achantavy
Copy link
Contributor Author

cc: @danbrauer

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

Successfully merging this pull request may close these issues.

1 participant