Skip to content

fix(aws): stamp CreatedBy=isvtest on volumes, CSI, and VPC fixtures - #559

Open
abegnoche wants to merge 2 commits into
NVIDIA:mainfrom
abegnoche:fix/resource-ownership-tags
Open

fix(aws): stamp CreatedBy=isvtest on volumes, CSI, and VPC fixtures#559
abegnoche wants to merge 2 commits into
NVIDIA:mainfrom
abegnoche:fix/resource-ownership-tags

Conversation

@abegnoche

@abegnoche abegnoche commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Tag root EBS volumes at RunInstances time (instance tags are not copied to volumes), and surface failed old-root deletes from bare-metal reinstall in JSON
  • Stamp CreatedBy=isvtest on FSx Lustre SGs, static CSI volumes, dynamic EBS CSI volumes (tagSpecification_1), and EKS Terraform default/local tags
  • Apply ownership tags atomically via TagSpecifications in create_vpc.py so interrupted network setup cannot leave untagged shared VPCs

Test plan

  • make lint / uvx pre-commit run -a
  • make test (prior commit) and targeted AWS provider tests for ownership tagging / network scripts
  • Confirm a fresh vm/bare_metal launch shows CreatedBy=isvtest on the root volume
  • Confirm network suite create_network VPC/subnets/SG carry CreatedBy=isvtest at create time
  • Confirm EKS gp3 StorageClass provisions volumes with CreatedBy=isvtest

Summary by CodeRabbit

  • Improvements

    • AWS resources are now consistently tagged with ownership and name information during creation.
    • Added platform tagging for bare-metal instances.
    • Improved cleanup reporting after bare-metal reinstalls, including failed volume deletions.
    • EBS volumes created through EKS workflows now include ownership tags.
    • Dynamically provisioned EBS volumes receive consistent ownership metadata.
  • Tests

    • Added coverage for resource tagging across networking, instance, volume, and reuse workflows.

Orphaned EBS volumes were invisible to the CreatedBy=isvtest cleanup
sweeps because the tag was never applied to them. RunInstances does not
copy instance tags onto the root volume, and the EBS CSI driver only
stamps its own kubernetes.io/* tags, so a detached root volume or a PVC
whose PV outlived its cluster billed indefinitely with no way to
attribute it to the suite.

Tag the volume resource type alongside the instance via a shared
owned_tag_specifications helper, stamp CreatedBy onto dynamically
provisioned CSI volumes and the static CSI volume, add the tag to the
FSx Lustre security group and the EKS Terraform stack, and surface a
failed old-root-volume delete in the reinstall JSON instead of only on
stderr.

Signed-off-by: Alexandre Begnoche <abegnoche@nvidia.com>
Post-create tagging left a window where an interrupted network setup
could orphan a VPC with only a Name tag. Apply ownership via
TagSpecifications on create so cleanup sweeps can always find them.

Signed-off-by: Alexandre Begnoche <abegnoche@nvidia.com>
@abegnoche
abegnoche requested a review from a team as a code owner July 27, 2026 19:21
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

AWS resource creation and launch paths now apply consistent CreatedBy ownership tags, shared helpers support instance and volume specifications, and bare-metal reinstall cleanup reports failed volume deletion attempts.

Changes

AWS ownership tracking

Layer / File(s) Summary
Ownership tag helpers and validation
isvctl/configs/providers/aws/scripts/common/ec2.py, isvctl/configs/providers/aws/scripts/network/create_vpc.py, isvctl/tests/providers/aws/*
Shared tag helpers generate Name and CreatedBy specifications, with tests covering resource types, extra tags, and independent tag lists.
Creation-time network resource tagging
isvctl/configs/providers/aws/scripts/network/create_vpc.py, isvctl/configs/providers/aws/scripts/common/fsx.py
Network and FSx security-group creation now passes ownership tags directly through AWS creation calls.
Compute and volume ownership tagging
isvctl/configs/providers/aws/scripts/{vm,bare_metal}/launch_instance.py, isvctl/configs/providers/aws/scripts/eks/*
Instance, bare-metal, static CSI, Terraform-managed, and dynamically provisioned EBS resources receive ownership tags; bare-metal instances also receive Platform=bare-metal.
Bare-metal reinstall cleanup reporting
isvctl/configs/providers/aws/scripts/bare_metal/reinstall_instance.py
Old root-volume deletion uses retry handling and records failures in cleanup_errors in the JSON result.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: daluz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main AWS tagging changes across volumes, CSI, and VPC-related fixtures.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-07-27 19:22:56 UTC | Commit: cf38508

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@isvctl/configs/providers/aws/scripts/bare_metal/reinstall_instance.py`:
- Around line 481-494: Update the post-success cleanup branch in the reinstall
flow around delete_with_retry so a failed old-volume deletion sets
result["success"] to false, causing the command to return exit code 1. Introduce
and use a dedicated swap_completed state to ensure failure cleanup does not
delete new_volume_id, which is already the active root volume.

In `@isvctl/configs/providers/aws/scripts/network/create_vpc.py`:
- Around line 121-126: The strict fake create_subnet method in
test_aws_network_scripts.py must accept the TagSpecifications keyword used by
create_vpc. Update that test double to capture and assert the creation-time
subnet tag specification, while preserving its existing subnet behavior and
validations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d8bc744c-9d79-4e69-8da5-be8cabce2317

📥 Commits

Reviewing files that changed from the base of the PR and between 18a050a and cf38508.

📒 Files selected for processing (10)
  • isvctl/configs/providers/aws/scripts/bare_metal/launch_instance.py
  • isvctl/configs/providers/aws/scripts/bare_metal/reinstall_instance.py
  • isvctl/configs/providers/aws/scripts/common/ec2.py
  • isvctl/configs/providers/aws/scripts/common/fsx.py
  • isvctl/configs/providers/aws/scripts/eks/setup.sh
  • isvctl/configs/providers/aws/scripts/eks/terraform/main.tf
  • isvctl/configs/providers/aws/scripts/network/create_vpc.py
  • isvctl/configs/providers/aws/scripts/vm/launch_instance.py
  • isvctl/tests/providers/aws/test_aws_network_scripts.py
  • isvctl/tests/providers/aws/test_aws_verified_reuse.py

Comment thread isvctl/configs/providers/aws/scripts/network/create_vpc.py
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