Skip to content

Reap orphan CF Access apps on CP startup #149

@posix4e

Description

@posix4e

Parked work from closed PR #146.

Problem

CF Access dashboard accumulates dead `dd-*` self-hosted apps every time a tunnel gets torn down outside the collector's orphan-GC path: force-deleted preview VMs, apps from old naming schemes, the tail of long preview cycles. Dozens of stale apps pile up over time.

Shape

New `cf::reap_orphan_access_apps(env)`:

  1. List every `dd-{env}-*` Access app.
  2. For each, extract the base hostname from `domain` (strip any `/path`).
  3. Look up that hostname's CNAME → target tunnel id (`.cfargotunnel.com`).
  4. Cross-reference against the live `cf::list` tunnel set.
  5. Delete apps whose target tunnel is gone or whose CNAME no longer exists.

CNAME lookups cache per base hostname (many apps share a host via path-scoped bypasses). Best-effort: delete failures log and continue.

CP's `run()` spawns it 10s after startup as a fire-and-forget task so a slow CF API call doesn't block the collector or agent registration. Every CP deploy becomes a cleanup pass.

Why we closed the PR

Noise-to-value ratio for reviewing it right now wasn't worth it. Re-open when the CF dashboard clutter becomes annoying enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions