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

#1210: EBSVolume => new data model, Allow node attr updates from multiple intel modules #1214

Merged
merged 4 commits into from
Jul 14, 2023

Conversation

achantavy
Copy link
Contributor

@achantavy achantavy commented Jul 14, 2023

See #1210 for full context.

#1154 tried to solve this problem by updating the querybuilder but this was too complex and would not generalize well.

This solution is simpler where we use different property classes for each API response so that we don't overwrite properties on a node set by another sync job.

This PR can be reviewed commit-by-commit:

  • c0d9ac4 shows a repro of the error with a failing integration test.
  • facb63b shows the solution using multiple classes.

Copy link
Collaborator

@ramonpetgrave64 ramonpetgrave64 left a comment

Choose a reason for hiding this comment

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

Looks great



@dataclass(frozen=True)
class EBSVolumeInstanceProperties(CartographyNodeProperties):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at the sample DESCRIBE_INSTANCES, the only properties about Volumes that are returned are just volumeid and deleteontermination, right?
https://github.com/lyft/cartography/blob/facb63bcbac6b68eec0fd2ea3f6b0550ac40eb10/tests/data/aws/ec2/instances.py#L390-L395

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, will update

(r['n1.id'], r['n2.id']) for r in result

# Assert that the account to volume rels exist
assert check_rels(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should maybe do this check after syncing instances, but before syncing the volumes

@achantavy achantavy merged commit fb3247a into master Jul 14, 2023
@achantavy achantavy deleted the ebsbug branch July 14, 2023 20:16
ramonpetgrave64 added a commit that referenced this pull request Aug 3, 2023
…iple intel modules (#1214)

See #1210 for full context.

#1154 tried to solve this problem by updating the querybuilder but this
was too complex and would not generalize well.

This solution is simpler where we use different property classes for
each API response so that we don't overwrite properties on a node set by
another sync job.

This PR can be reviewed commit-by-commit:
- c0d9ac4 shows a repro of the error
with a failing integration test.
- facb63b shows the solution using
multiple classes.

---------

Co-authored-by: Ramon Petgrave <[email protected]>
achantavy added a commit that referenced this pull request Sep 20, 2023
Refactors EC2 Network Interfaces and Private IPs to the cartography data
model. Fixes #1152 since the data model includes automatic cleanup jobs.

- Uses same technique as #1214 to represent Network Interfaces as known
by EC2 instances vs Network Interfaces known by
describe-network-interfaces.
- Also clearly marks that the Private IPs ingested here are known by
Network Interfaces and not another source.
chandanchowdhury pushed a commit to juju4/cartography that referenced this pull request Jun 26, 2024
…pdates from multiple intel modules (cartography-cncf#1214)

See cartography-cncf#1210 for full context.

cartography-cncf#1154 tried to solve this problem by updating the querybuilder but this
was too complex and would not generalize well.

This solution is simpler where we use different property classes for
each API response so that we don't overwrite properties on a node set by
another sync job.

This PR can be reviewed commit-by-commit:
- c0d9ac4 shows a repro of the error
with a failing integration test.
- facb63b shows the solution using
multiple classes.

---------

Co-authored-by: Ramon Petgrave <[email protected]>
chandanchowdhury pushed a commit to juju4/cartography that referenced this pull request Jun 26, 2024
…ork interface, private ip (cartography-cncf#1219)

Refactors EC2 Network Interfaces and Private IPs to the cartography data
model. Fixes cartography-cncf#1152 since the data model includes automatic cleanup jobs.

- Uses same technique as cartography-cncf#1214 to represent Network Interfaces as known
by EC2 instances vs Network Interfaces known by
describe-network-interfaces.
- Also clearly marks that the Private IPs ingested here are known by
Network Interfaces and not another source.
id: PropertyRef = PropertyRef('VolumeId')
volumeid: PropertyRef = PropertyRef('VolumeId', extra_index=True)
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
deleteontermination: PropertyRef = PropertyRef('DeleteOnTermination')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@serge-wq [comment 1 of 2] - ah here we go. Here an EBS volume as known by an EC2 instance has a deleteontermination field...

size: PropertyRef = PropertyRef('Size')
state: PropertyRef = PropertyRef('State')
outpostarn: PropertyRef = PropertyRef('OutpostArn')
snapshotid: PropertyRef = PropertyRef('SnapshotId')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@serge-wq [comment 2 of 2] - .. but the EBSVolume by itself doesn't have that field. It also has fields that are not known by the EBSVolumeInstance.

The description of this PR shows more details on this decision.

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.

2 participants