refactor(digital-ocean): Use tags to manage firewall and droplets - #6242
Conversation
Greptile SummaryThis PR refactors DigitalOcean droplet provisioning to use a tag-based firewall model: a new cluster-scoped tag (
Confidence Score: 3/5Not safe to merge as-is — the shared cluster tag causes series-specific firewalls to fan out to all cluster droplets, widening firewall rules beyond their intended scope. The tag-based approach is a sound idea, but using a single cluster-scoped tag means that provisioning any special-series machine (proxy, NAT) attaches that series' firewall to every other droplet in the cluster. This is a present security-rule scoping defect on the changed code path, warranting a P1 rating and a score below 4. press/press/doctype/virtual_machine/virtual_machine.py — specifically the tag naming strategy and the firewalls.add_tags loop. Important Files Changed
Sequence DiagramsequenceDiagram
participant P as _provision_digital_ocean
participant DO_Droplets as DO Droplets API
participant DO_Firewalls as DO Firewalls API
P->>DO_Firewalls: firewalls.list()
DO_Firewalls-->>P: all firewalls
P->>P: check cluster_firewall status (cluster.security_group_id)
P->>DO_Droplets: droplets.create({..., tags: [droplet_tag]})
DO_Droplets-->>P: droplet (instance_id)
loop for each group in get_security_groups()
Note over P: groups = [self.security_group_id,<br/>+ proxy_security_group_id (series=n)<br/>+ nat_security_group_id (series=nat)]
P->>DO_Firewalls: firewalls.add_tags(group, {tags: [droplet_tag]})
Note over DO_Firewalls: tag is cluster-scoped - ALL cluster droplets now inherit this firewall rule
DO_Firewalls-->>P: ok
end
P->>P: save() & db.commit()
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6242 +/- ##
==========================================
Coverage ? 55.93%
==========================================
Files ? 910
Lines ? 75758
Branches ? 524
==========================================
Hits ? 42373
Misses ? 33357
Partials ? 28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
refactor(digital-ocean): Use tags to manage firewall and droplets (backport #6242)
|
🎉 This PR is included in version 0.20.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Ensure we use tags to group and add multiple droplets to a firewall since, digital ocean caps number of droplets attached to a firewall to 10.