Skip to content

refactor(k8s): replace the volume move copy with pv-migrate #7498

Done

Description

@dan-petty

Problem

devops k8s volume-move copies the data of a claim with its own code. It runs tar over a pod socket, and it compares digests with its own Bash.

The code (lines at commit d0bc3dffa; #7490 and #7491 changed the file after it):

  • src/devops_cli/k8s/volume_move.py has 1,889 lines.
    • :369-412: the tar copy over a pod socket.
    • :339-352 and :1023-1048: the digest compare.
    • :295-307: the Argo CD pause patch. :315-327: the claimRef rebind.
    • :1064-1462: the undo in _MoveRun. :1478-1889: the dry-run plan.
  • volume_move_measure.py has 561 lines.
  • config/constants.py:4924-4980 holds the Bash bodies of the copy pods.
  • In all: 2,450 lines of Python and 79 tests.

The command moves data, so each bug can lose data. In 30 days:

Change

Replace the copy and the compare with pv-migrate.

Move to the tool:

  • The tar copy, the copy pods and their Bash bodies.
  • The digest compare. rsync checks each file that it sends.

Keep, because pv-migrate does not do these steps:

  • The Argo CD pause, the sync waits and the ApplicationSet refusal.
  • The scale-down and the undo.
  • The claimRef rebind. If the new claim name goes to git in place of the rebind, the Argo CD pause is no longer necessary. Decide this in the plan.

Delete:

  • The tar copy, the digest compare and the copy Bash bodies in config/constants.py.
  • The parts of volume_move_measure.py that only the custom copy uses.

Longhorn is the second path. It is already deployed in dan-petty/homelab (k8s/argocd/apps/longhorn.yaml). A Longhorn volume is not bound to a node, so it never needs a move. The plan lists the claims that can live on Longhorn. Those claims move to Longhorn one time, and the command no longer handles them.

Risk: the pv-migrate pods may fail Pod Security restricted, as the current copy pods do (#7449, #7451). Test this first in a restricted namespace, and set the securityContext values of the chart.

Existing tool considered

  • pv-migrate (Apache-2.0, v3.8.0). It does the copy only. It does not pause Argo CD, scale the workload down or undo a failed move.
  • Longhorn (deployed). It removes the need to move a claim between nodes. It does not help a claim that must stay on local-path.
  • Velero (Apache-2.0, v1.19.0, 2026-11-23). It can back up and restore with a changed storage class. It is more than a copy of one claim needs.
  • VolSync is not an option, because it is AGPL-3.0.

Done when

  • The custom tar copy, the copy Bash bodies and the custom digest compare are deleted.
  • devops k8s volume-move calls pv-migrate for the copy.
  • A test proves that the command builds the pv-migrate call with the source claim, the target claim and the securityContext values.
  • One live move of a test claim in a restricted namespace passes, and the data on the new claim matches the source.
  • The plan lists the claims that can move to Longhorn.

Source

Source: https://github.com/dan-petty/devops-cli/blob/d0bc3dffa781951f7b49935ba545cad82b2ecfaf/src/devops_cli/k8s/volume_move.py

Activity

  1. added
    type/refactor
    scope/k8s
    source/agent
    status/new
    value/medium
    effort/high
    priority/p2-medium
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 28, 2026
  2. added a commit that references this issue on Nov 28, 2026
  3. added
    status/in-review
    and removed
    status/in-progress
    on Nov 28, 2026
  4. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  5. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 05:01 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/highpriority/p2-mediumscope/k8ssource/agenttype/refactorvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions