Repository navigation
Description
Split from #6341.
The manifest change points new volumes at local-path-retain. It does not change a bound volume or a live StatefulSet. The API server refuses a change of storageClassName on a bound claim and a change of volumeClaimTemplates on a StatefulSet. The live cluster needs a patch of the 8 bound Delete volumes and a recreation of each live StatefulSet. The pull request cannot run these steps: they need cluster access and a maintenance window, and they change data-bearing resources. A person runs them after the manifest sync. Acceptance criteria: each bound PersistentVolume of a devops-cli workload with persistentVolumeReclaimPolicy: Delete gets Retain with `kubectl patch pv <name> -p '{% raw %}{
Proposed design
Problem statement
The manifest change in #6341 points new volumes at local-path-retain. The live cluster still has 8 bound PersistentVolumes with reclaim policy Delete and StatefulSets whose volumeClaimTemplates name local-path. Kubernetes refuses an in-place change of a bound claim's storageClassName and of a StatefulSet's volumeClaimTemplates. The pull request delivers the ordered runbook that a person runs in a maintenance window. The live execution is deferred to a new issue.
Acceptance criteria
Requirement: Retain migration section
The k8s/README.md SHALL include a Local-Path Retain Migration section that gives the ordered commands to patch bound PersistentVolumes and recreate StatefulSets.
Scenario: Section and order
- WHEN The new documentation test runs.
- THEN It passes and asserts the section holds the
kubectl patch pvstep before thekubectl delete statefulset --cascade=orphanstep.
Requirement: Patch command
The section SHALL give the exact kubectl patch pv <name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' command and a kubectl get pv listing command that filters on persistentVolumeReclaimPolicy: Delete.
Scenario: Exact patch command
- WHEN The new documentation test runs.
- THEN It passes and asserts both commands appear in the section.
Requirement: StatefulSet recreation command
The section SHALL give the exact kubectl delete statefulset <name> --cascade=orphan command and a verification command that waits for the StatefulSet and its pod to be Ready.
Scenario: Exact StatefulSet command
- WHEN The new documentation test runs.
- THEN It passes and asserts both commands appear in the section.
Requirement: Documentation check
The documentation change MUST pass the repository documentation check.
Scenario: Documentation check
- WHEN
uv run devops ci --check --only docsruns. - THEN The command exits 0.
Existing Tool Considered
No alternatives check has run. kubectl is the open, maintained tool that covers the need: it patches a PersistentVolume's reclaim policy and deletes a StatefulSet with --cascade=orphan. It lacks one ordered, guarded runbook for the 8 volumes and the StatefulSets; this proposal adds that runbook and its verification steps.
Key questions
- Where does the migration runbook live?: In
k8s/README.md. That file already holds the environment-specific local-path decisions and the StatefulSet recreation procedure. (best practice) [sources: CONTEXT.md, k8s/README.md:433, k8s/README.md:448]- Chosen: k8s/README.md. It holds the environment tree's cluster decisions and the existing StatefulSet recreation steps.
- Rejected: docs/commands/k8s.md. It is the command reference, not the runbook for one environment.
- Rejected: A new docs/runbooks/ page. The repository has no runbook folder, and the environment README already holds this procedure.
- Should the change add a new CLI command for the migration?: No.
kubectlcovers the patch and the orphan deletion. The migration is one-time and data-bearing, so the pull request adds a runbook, not code. (best practice) [sources: k8s/README.md:448, src/devops_cli/k8s/volume_move.py, docs/commands/k8s.md:1002]- Chosen: kubectl runbook. kubectl is the open, maintained tool for the two operations, and the migration runs once.
- Rejected: New devops k8s command. It adds code and tests to keep for a one-time, data-bearing procedure.
- Rejected: Kubernetes Job manifest. The issue says the pull request cannot run the data-bearing steps, and a person must choose the maintenance window.
- What order do the steps take?: Patch each bound PersistentVolume to
Retainfirst. Then delete each live StatefulSet with--cascade=orphan. Then let Argo CD or the operator recreate it. Then verify the claim and the pod. (best practice) [sources: k8s/README.md:433, k8s/README.md:448, k8s/README.md:516]- Chosen: Patch PVs before StatefulSet deletion. A deleted StatefulSet must not leave a
Deletevolume that the API server can remove. - Rejected: Delete StatefulSets first. It risks data loss if a claim still uses a
Deletevolume.
- Chosen: Patch PVs before StatefulSet deletion. A deleted StatefulSet must not leave a
- How does the runbook identify the 8 bound volumes?: It gives a
kubectl get pvcommand that filters onpersistentVolumeReclaimPolicy: Deleteand aclaimRefthat names a devops-cli workload. The exact names stay live. (best practice) [sources: k8s/README.md:35, k8s/README.md:433]- Chosen: List with kubectl. The bound volume names are live state and change with the cluster.
- Rejected: Commit the 8 names. The names are environment-specific and become stale.
- Does the migration need a rollback?: No. Setting
Retainis non-destructive. Deleting a StatefulSet with--cascade=orphankeeps the pods and the claims. The runbook verifies each step before the next. (best practice) [sources: k8s/README.md:433, k8s/README.md:448]- Chosen: No rollback. The steps keep the data and the pods, and the runbook verifies each step.
- Rejected: Add rollback to Delete. It would risk the data that the migration protects.
- Which check proves the runbook?: A new test
tests/k8s/test_k8s_retain_migration_docs.pyasserts the section holds the exact commands and their order. The repository documentation check also runs. (best practice) [sources: tests/k8s/test_k8s_volume_move.py, CONTEXT.md]- Chosen: New doc test plus docs check. The test asserts the commands and their order, and the docs check validates the document.
- Rejected: Only docs check. It does not assert that the exact commands are present.
- Rejected: Only manual review. It is not an offline check.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 22, 2026
Bound volumes with Delete reclaim policy risk data loss if a claim is deleted.Both move stateful volumes to local-path-retain; #6341 changes the manifest for new volumes, the candidate patches existing bound volumes and recreates live StatefulSets.devops-cli-service commentedon Nov 22, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
fix(k8s): add Local-Path Retain Migration runbook to k8s/README.md (#…
devops-cli-service commentedon Nov 23, 2026
Released in v0.203.5: https://github.com/dan-petty/devops-cli/releases/tag/v0.203.5