Repository navigation
Description
Problem
devops k8s volume move copies with one shell pipe of two kubectl exec streams through the API server. The end of the stream can get lost. A live move of monitoring/grafana on 2026-11-05 stopped at step 5: the copy and its one retry both failed with connection reset by peer, and the command undid its steps with no data loss. This blocks the moves of #2147.
Measured on 2026-11-05 with two temporary pods on the same two nodes, for a pipe of 100 MiB of random data, kubectl 1.37.1 and k3s 1.37.2:
| Variant | Complete copies | Exit 0 but short |
|---|---|---|
| The pipe that the command uses | 4 of 8 | 1 |
KUBECTL_REMOTE_COMMAND_WEBSOCKETS=false (SPDY) |
3 of 8 | 5 |
| The source process stays alive 20 s after it sends the data | 8 of 8 | 0 |
An earlier run of the same pipe gave 1 complete copy of 4, and one short copy had exit 0. A stream in one direction only had no failure in 8 of 8 runs out or 8 of 8 runs in, so the failure needs the two streams together. The likely cause: the destination is slower than the source, so data waits in buffers on the path, the source process exits, and its stream closes before that data arrives.
The digest comparison of step 6 stops a short copy that exits 0, so this causes a failed move and not a bad copy. Tests show this only for the pipe of the command, not for each path.
Expected
A copy through the API server gets all its data with no retry on a healthy cluster, also when the destination is slower than the source. The digest comparison stays.
Acceptance criteria
- The source side of the copy does not end before the destination has the data. Prefer a rule that depends on the destination, such as a source that holds until the destination ended, over a fixed wait. A fixed wait is acceptable only with a measure that states why its length is sufficient.
- The command still runs through
run_subprocess, and the plan, the dry run and the run list the same steps. - A live measure with temporary pods gives at least 20 complete copies of 20, with the numbers in the pull request.
-
openspec/specs/and the volume move section ofk8s/README.mdstate the rule.
Existing tool considered
pv-migrate v3.7.0. The change 2186-volume-move rejected it, and the reasons still hold: its pod-to-pod strategies need a NetworkPolicy opening in the perimeter, and its local strategy uses the same path as this copy. kubectl cp needs the whole volume on the workstation. SPDY in place of WebSocket does not help (table above). The fix is a small change to the existing command, so the build cost is about 200,000 tokens and 1 hour.
Related
Blocks #2147. Related: #3647, #3654.
Proposed design
Problem statement
devops k8s volume move copies with one shell pipe of two kubectl exec streams through the API server. The source process can exit before the destination receives all buffered data, so a live move fails with connection reset by peer. The move undoes its steps with no data loss, but the copy is unreliable. The fix makes the source hold until the destination ends and keeps the digest comparison.
Acceptance criteria
Requirement: Destination-driven source completion
The source side of the volume copy SHALL not end until the destination side has ended.
Scenario: Slow destination holds the source
- WHEN a destination stub reads slower than the source stub and does not exit
- THEN the source stub stays alive, and the copy completes only after the destination stub exits.
Requirement: Copy runs through run_subprocess
The volume move SHALL run its copy pipeline through run_subprocess.
Scenario: Plan, dry run and run share the step list
- WHEN a test runs
devops k8s volume move --planand--dry-runwith a mocked cluster - THEN the printed steps equal the steps of a run, and the copy uses
run_subprocessfor the pipeline.
Requirement: Digest comparison stops a short copy
The volume move SHALL compare the source and destination digests before the point of no return.
Scenario: Short copy with exit 0
- WHEN the destination holds fewer bytes than the source and the copy process exits 0
- THEN the command stops with a digest mismatch and does not continue to step 6.
Requirement: Connection reset keeps one retry
The volume move SHALL empty the destination and retry the copy once when the exec stream stops with connection reset by peer.
Scenario: Connection reset on first copy
- WHEN the first copy stream stops with
connection reset by peer - THEN the command empties the destination, copies one more time, and then compares the digests.
Requirement: Documentation states the destination rule
The volume move section of k8s/README.md and the relevant openspec/specs/ spec SHALL state that the source holds until the destination ends.
Scenario: Reader finds the rule
- WHEN a reader opens the volume move section
- THEN the section names the destination-completion rule and says a fixed wait is not the rule.
Existing Tool Considered
No alternatives check has run. The body considered pv-migrate v3.7.0 and rejected it: its pod-to-pod strategies need a NetworkPolicy opening in the perimeter, and its local strategy uses the same path as this copy. The change builds its own code at about 200,000 tokens and 1 hour.
Key questions
- How does the source side of the copy hold until the destination has the data?: Run the source copy in a wrapper that waits for a completion marker. The command creates the marker only after the destination copy process exits. Give the source pod a writable
emptyDirat/tmpfor the marker. (best practice) [sources: k8s/README.md, ARCHITECTURE.md:176]- Chosen: Completion marker after destination exit. The source holds until the destination ends, uses no fixed wait, and fits a shell pipeline run through
run_subprocess. - Rejected: Fixed sleep after source tar. No measure states a sufficient length, and the body rejects a fixed wait without one.
- Rejected: SPDY transport. The body's table shows 3 complete copies of 8 and 5 short copies.
- Rejected: Local relay with spool file. It adds local disk use and does not keep the source stream open.
- Chosen: Completion marker after destination exit. The source holds until the destination ends, uses no fixed wait, and fits a shell pipeline run through
- Does the copy still run through
run_subprocess, and do plan, dry run and run list the same steps?: Yes. The command runs the copy pipeline as onerun_subprocesscall, and plan, dry run and run share one step list. [sources: ARCHITECTURE.md:176, k8s/README.md] - Does the digest comparison stay after the copy?: Yes. Step 5 compares the entries, files, bytes, metadata digest and content digest, and stops at a difference before the point of no return. [sources: k8s/README.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 5, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(k8s)scope of the title gives the scope.It blocks #2147, which moves monitoring volumes off a near-full control-plane node.Unblocks reliable volume moves for Grafana, Prometheus, Loki, and Mattermost.The body states the fix is a small change costing about 200,000 tokens and 1 hour.Both concern k8s volume moves, but #2147 moves specific volumes while the candidate fixes the copy command that #2147 depends on.devops-cli-service commentedon Nov 5, 2026
Status set to Ready at f481be8 (see proposed design in issue body).
Moved to new items: #3701.
chore(main): release 0.64.0 (#3708)
devops-cli-service commentedon Nov 6, 2026
Released in v0.64.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.64.0
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 02:22 UTC
docs(openspec): plan #3701 Add the volume move copy reliability harne…
feat(k8s): Add the volume move copy reliability harness (#5920)