down() is now a five-phase recipe with each phase a single line:
namespaced cleanup, cluster-scoped PV cleanup, synchronous wait,
optional namespace delete, optional cluster destroy. Each helper
does one thing.
- Extract _stack_label_selector() and _namespace_exists() so down()
reads declaratively.
- Rename _delete_labeled_resources -> _delete_namespaced_labeled_
resources to match what it actually does (namespaced phase only).
- Extract _list_delete_namespaced() helper for the Services and
Endpoints list+delete pattern (k8s client lacks delete_collection
for those kinds).
- _wait_for_labeled_gone (renamed from _wait_for_labeled_deletions)
builds listers in clean append-style; DRY the poll/timeout
iterations via a local remaining() closure.
No behavior changes — same semantics, ~50 fewer lines.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>