Skip to content

Feature: persist + reattach user home volumes across destroy/recreate (Option A) #6

Description

@espg

Currently tofu destroy (and the scripts/pre-destroy-drain.sh step) do not touch user home directories.

Current behavior

  • pre-destroy-drain.sh deletes only LoadBalancer Services and Ingresses (to clear ELB ENIs that block VPC deletion).
  • User home volumes are dynamically-provisioned PVCs created by KubeSpawner per user (EBS via the CSI driver). They are not owned by the daskhub Helm release.
  • tofu destroy deletes the EKS cluster/nodes directly. With the CSI controller gone, PVCs are never gracefully deleted, so the backing EBS volumes are left orphaned (each ~$0.08/GB-month) with no evacuation/backup of user data first.
  • This is invisible today only because cae-testing uses dummy auth and no one spawned a server. On cae-dev/prod with real users, a destroy would strand (and silently keep billing) every user home volume.

Gaps

  1. No pre-destroy evacuation/snapshot of user home data.
  2. No deletion of user PVCs, so EBS volumes orphan.
  3. verify-clean-teardown.sh has no authoritative EBS-volume check (name-based checks cover NAT/VPC/EIP/EKS/LB only).

Proposed fixes

  • Add an opt-in PVC-cleanup phase to pre-destroy-drain.sh (destructive to user data — guard behind an explicit flag / confirmation).
  • Optionally snapshot user PVCs to S3/EBS-snapshot before deletion (evacuation).
  • Add an authoritative EBS check to verify-clean-teardown.sh:
    aws ec2 describe-volumes --filters Name=tag:kubernetes.io/cluster/<cluster>,Values=owned → fail on any remaining available/in-use volume.

Context

Surfaced during teardown hardening (drain + verify) — the verify tag-index check was made advisory because resourcegroupstaggingapi lags ~1h; name-based checks are authoritative but do not yet cover EBS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions