Skip to content

RFC-0001 · P2 · cli — offboarding: client delete + --uninstall (R12; the k3d rebuild-orphan cure) #129

Description

@saadqbal

Context

There is no inverse of install. Nothing stops the heartbeat, de-registers the box, or clears local state — so every retired or rebuilt cluster becomes an orphan (RFC-0001 R12, and the R3 rebuild-orphan it feeds).

The sharp edge, hit in practice: the RFC anchors client identity on the kube-system namespace UID (§7.2 / backend#883). Tear down and recreate a cluster — k3d cluster delete tracebloc then re-create + re-run setup — and the fresh cluster gets a new kube-system UID. Re-provision therefore sees a different cluster, mints a duplicate client, and leaves the old one stranded: it stops heartbeating and lingers in the account forever with no way to remove it from the CLI. For a dev/test loop that rebuilds k3d constantly this manufactures an orphan on every cycle.

client delete doesn't exist yet — client.go wires only create / list / use. RFC-0001 §7.4 already specifies the delete semantics.

Recovery model (decided)

Honor the RFC: a rebuilt cluster = a new client. Re-attach is deliberately out of scope — §9 (RFC line 770) rejects a cluster_id change on an already-set client, and R3 states "rebuilt cluster = new client" is intended, with the reaper as the cure. So this ticket does not try to re-point an old client at a new cluster; it makes the orphan visible, cleanly removable, and non-silent.

Tasks

  • client delete <id> (§7.4).
    • Confirms (the one justified interactive prompt — destructive; D1's "no prompts" is about setup, not destruction).
    • Refuses/warns if the client is online (recent heartbeat), holds datasets, or has a running experiment / training job; --force to override. (Heartbeat guard is advisory → gate on live job state too, so a delete mid-run doesn't silently lose work.)
    • Checks RBAC (write 403 → "ask an admin", reuse askAnAdmin).
    • Clears the stale active pointer afterward (§7.5) if it pointed at the deleted client.
  • Delete must work when the cluster is already gone. The headline case (k3d cluster delete first) means there is no reachable cluster and no live Helm release to tear down. client delete / --uninstall must degrade gracefully: skip the Helm teardown, still de-register the backend EdgeDevice + clear local state. Don't require a reachable cluster to remove a zombie client.
  • --uninstall (R12). When the cluster is reachable: tear down the local Helm release for the active client, de-register the EdgeDevice, clear the relevant ~/.tracebloc state. Coordinate with the installer's inverse (install-k8s.sh --uninstall).
  • Warn on rebuild-mint (make the orphan non-silent). In client create, when about to mint because the cluster's UID doesn't match any client, but a same-name/same-derived-namespace client exists and is offline, surface it: "looks like a rebuilt cluster — client X is now orphaned; remove it with tracebloc client delete X." Today the orphan is created silently.

Related

Part of tracebloc/backend#830.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions