Skip to content

fix(k8s): volume move cannot copy many small files to an NFS claim #7532

Done

Description

@dan-petty

Problem Description

devops k8s volume move cannot move a claim of many small files to a ReadWriteMany volume of class longhorn, which Longhorn serves over NFS. Two parts fail:

  1. The copy of step 5 has a fixed bound, DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS (3600 s, src/devops_cli/config/defaults.py). It does not look at the progress of the copy, so a copy that still moves data stops at the bound.
  2. Before the second try, the move empties /dst with find. On the NFS volume this fails with Directory not empty, so the move cannot retry and undoes each step.

Evidence, 2026-11-28

The owner approved a Pod Security baseline window on devops, and the move ran from 02:42 to 04:02 UTC:

$ uv run devops k8s volume move devops/roadmap-service-home --storage-class longhorn --access-mode ReadWriteMany --size 10Gi
➔ The copy stopped (`the copy` did not end within 3600 s.). Empty /dst and copy one more time.
...
The move stopped at step 5: `kubectl exec roadmap-service-home-dst` exited 1: find: cannot delete '/dst/.data/roadmap/dan-petty/devops-cli/lanes/stage/openspec/changes/archive': Directory not empty

The claim holds about 3.5 GB in 313,327 entries, most of them in the git clones of the lanes. The undo worked: the old claim, its volume and deployment/roadmap-service are as before. Application devops stays OutOfSync on this claim (dan-petty/homelab#579), so no release of devops-cli reaches the cluster.

Expected Behavior

  • The copy has no fixed bound while it makes progress: it stops only when the bytes on /dst do not grow for a set time, or the bound is a setting.
  • The retry starts from an empty volume in a way that works on NFS, for example by deleting and making again the new claim, not by emptying it with find.

Acceptance Criteria

  • A test: a copy that still grows past the old bound goes on, and a copy that does not grow for the stall time stops.
  • A test: the retry of a copy to a ReadWriteMany claim does not run find -delete on it and starts from a new, empty claim.
  • Pending a person after the release: the move of devops/roadmap-service-home ends with no difference in step 6.

Related

Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: utkuozdemir/pv-migrate (https://github.com/utkuozdemir/pv-migrate), Apache-2.0, last activity 2026-11-26, maintained.
Reason: Searches surfaced pv-migrate, an actively maintained PVC migration tool that copies claim data with rsync and works to NFS/ReadWriteMany destinations, so it covers the copy itself; it does not cover this issue's in-repo stall-based timeout and NFS-safe retry fix.

Covers:

  • Rsync copy between two persistent volume claims
  • Mount, SSH and load-balancer migration strategies
  • Migration into ReadWriteMany or NFS destination claims

Lacks:

  • No progress-stall timeout wired into the move command
  • Does not implement the step 5 copy or its retry path
  • No step 6 no-difference verification of the move

Proposed design

Problem statement

devops k8s volume move stops the step 5 copy at the fixed bound DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS (3600 s). On 2026-11-28 the copy of the devops/roadmap-service-home claim still ran at that bound, with 3.5 GB in 313,327 entries. PR #7518 already replaced the custom copy, its find -delete retry and the step 6 digest compare with a pv-migrate run. Only the fixed bound remains. The change makes that bound the setting k8s.volume_move_copy_timeout_seconds, so an operator raises it for a slow copy with no code change.

Acceptance criteria

Requirement: Copy bound from a setting

The volume move SHALL take the bound of the step 5 copy from the setting k8s.volume_move_copy_timeout_seconds.

Scenario: A raised bound reaches the pv-migrate run

  • WHEN a test sets k8s.volume_move_copy_timeout_seconds to 7200 and runs the move with a stub of _run_pv_migrate
  • THEN the stub records a timeout of 7200 s

Requirement: Default copy bound

The setting k8s.volume_move_copy_timeout_seconds MUST default to DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS.

Scenario: No value in the config

  • WHEN a test loads the settings with no value for k8s.volume_move_copy_timeout_seconds
  • THEN the setting reads 3600 s

Requirement: The bound must be positive

The settings model MUST refuse a value of zero or less for k8s.volume_move_copy_timeout_seconds.

Scenario: A value of zero

  • WHEN a test loads the settings with k8s.volume_move_copy_timeout_seconds: 0
  • THEN the load fails with a validation error that names k8s.volume_move_copy_timeout_seconds

Requirement: Help names the setting

The help of devops k8s volume move MUST name the setting k8s.volume_move_copy_timeout_seconds.

Scenario: Help of the move command

  • WHEN a test renders the help of devops k8s volume move
  • THEN the help text holds k8s.volume_move_copy_timeout_seconds

Requirement: Pending a person after the merge

After the release, the move of devops/roadmap-service-home to a longhorn ReadWriteMany claim MUST end with exit code 0.

Scenario: Live move of the roadmap-service-home claim

  • WHEN a person sets k8s.volume_move_copy_timeout_seconds above the copy time and runs uv run devops k8s volume move devops/roadmap-service-home --storage-class longhorn --access-mode ReadWriteMany --size 10Gi on the released CLI
  • THEN the command exits 0

Existing Tool Considered

utkuozdemir/pv-migrate (Apache-2.0, last activity 2026-11-26), verdict in-use: the repository already uses it for the step 5 copy. The alternatives check of 2026-11-28 in the issue body records what the tool covers and lacks. The change adds the part that the check records as lacking: it wires the copy bound into the move command as the setting k8s.volume_move_copy_timeout_seconds, so the pv-migrate run gets the bound that the operator sets.

Key questions

  • Which bound ends the step 5 copy of the volume move?: The setting k8s.volume_move_copy_timeout_seconds sets the bound, and the move passes it to the pv-migrate run. Its default is DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS (3600 s). An operator raises it for a claim of many small files. (best practice) [sources: src/devops_cli/k8s/volume_move.py, src/devops_cli/config/defaults.py:1371, src/devops_cli/config/settings.py, tests/k8s/test_k8s_volume_move.py]
    • Chosen: A setting for the copy bound. The operator raises the bound with no code change, and the Expected Behavior of the issue accepts this result.
    • Rejected: Keep the constant DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS. The copy of 3.5 GB in 313,327 entries still ran at 3600 s on 2026-11-28, so a constant with no setting cannot deliver the move.
    • Rejected: Watch the size of the destination claim and stop on a stall. PR refactor(k8s): replace the volume move copy with pv-migrate #7518 removed the /dst copy pod, so the move has no reader of the destination size, and a new poll pod rebuilds the mechanism that refactor(k8s): replace the volume move copy with pv-migrate #7518 removed.
  • Which default does the setting hold?: The setting defaults to DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS, 3600 s. A small claim keeps its current bound, and the operator raises the value for the large claim. (best practice) [sources: src/devops_cli/config/defaults.py:1371]
    • Chosen: Keep the default at 3600 s. The bound of a small claim does not change, and the operator raises the value for the claim of many small files.
    • Rejected: Raise the default to 14400 s. The issue holds no measured copy time for a general default, and a larger default hides a hung copy for longer.
  • Does the move keep its own retry of the copy with find -delete?: No. PR refactor(k8s): replace the volume move copy with pv-migrate #7518 replaced the custom copy, the /dst copy pod, the find -delete retry and the step 6 digest compare with one pv-migrate run. The change adds no retry and no step 6 compare. [sources: src/devops_cli/k8s/volume_move.py]
  • Where does the copy bound live today?: The constant DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS is at src/devops_cli/config/defaults.py:1371. src/devops_cli/k8s/volume_move.py is its only caller, at the timeout argument of the pv-migrate run. [sources: src/devops_cli/config/defaults.py:1371, src/devops_cli/k8s/volume_move.py]
  • Does a value of zero or less remove the bound?: No. The settings model refuses a value of zero or less for k8s.volume_move_copy_timeout_seconds, so a stuck copy always ends at a bound. (best practice) [sources: src/devops_cli/config/settings.py]
    • Chosen: Refuse a value of zero or less. A bound always exists, so a stuck pv-migrate run ends and the move reports a failure.
    • Rejected: Let zero mean no bound. A stuck copy would then run with no end, and no output shows that it is stuck.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/bug
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/medium
    on Nov 28, 2026
  2. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor
    • Priority: The failure blocks the release of devops-cli to the cluster because the app stays OutOfSync.
    • Related: refactor(k8s): replace the volume move copy with pv-migrate #7498, which asks for a different change. Both target the volume move copy step, but #7498 replaces the copy with pv-migrate while this candidate fixes the existing copy's timeout and retry logic.
  3. added
    priority/p1-high
    on Nov 28, 2026
  4. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

  5. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (10)

    Tools considered:

    Searches run:

    • pv-migrate kubernetes persistent volume migration tool, results: 5
    • kubernetes PVC migration many small files NFS copy timeout retry, results: 5
    • pv-migrate github utkuozdemir rsync migration, results: 5
    • kubernetes volume migration tool rsync progress based timeout, results: 5
    • pv-migrate, results: 5
    • utkuozdemir pv-migrate, results: 5
    • pv-migrate rsync helm chart migration tool documentation, results: 5
    • github utkuozdemir pv-migrate rsync strategies retries, results: 5
    • pv-migrate docs strategies mount ssh rsync --delete retry, results: 5
    • "pv-migrate" kubernetes migrate PVC between storage classes, results: 5

    Sources:

  6. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  7. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  8. added
    owner/agent
    on Nov 28, 2026
  9. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor

    Cannot build #7532 as written on origin/main (48bac94): commit 2669c9e (PR #7518, #7498, included in v0.232.3 through v0.232.10) already replaced the custom step 5 copy, the /dst copy pod, the find -delete retry, and the step 6 digest compare in src/devops_cli/k8s/volume_move.py with pv-migrate (lines 1239-1276). The refined requirements still target the removed custom copy and retry and reject pv-migrate. Note that src/devops_cli/k8s/volume_move.py:1251 still passes fixed timeout=DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS (3600.0 s) to _run_pv_migrate, so please re-test devops/roadmap-service-home on v0.232.3+ and either re-scope #7532 for pv-migrate or close it as not planned.

  10. 3 remaining items

  11. added
    owner/agent
    on Nov 28, 2026
  12. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor

    Returning #7532 to refinement: PR #7518 (commit 2669c9e, merged 2026-11-28T03:17:18Z) already replaced the custom copy, retry loop, find -delete cleanup, and step 6 verification in src/devops_cli/k8s/volume_move.py with a single pv-migrate invocation (src/devops_cli/k8s/volume_move.py:1239-1276). The retry path and step 6 check named in the acceptance criteria no longer exist on origin/main; only the fixed timeout=DEFAULT_K8S_VOLUME_MOVE_COPY_TIMEOUT_SECONDS (3600s) on _run_pv_migrate remains if a slow pv-migrate transfer needs a progress/stall bound.

  13. added
    status/ready
    and removed
    status/new
    on Nov 29, 2026
  14. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See the section Proposed design of the body.

  15. added
    status/in-progress
    and removed
    status/ready
    on Nov 29, 2026
  16. added
    status/in-review
    and removed
    status/in-progress
    on Nov 29, 2026
  17. removed
    status/in-review
    owner/agent
    on Nov 29, 2026
  18. devops-cli-service commented on Nov 29, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-29 16:17 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p1-highscope/k8ssource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions