Skip to content

fix(k8s): refuse a volume move under an ApplicationSet #7486

Done

Description

@dan-petty

Problem

devops k8s volume move pauses an Argo CD Application with spec.syncPolicy.automated.enabled: false. An Application that an ApplicationSet owns gets its spec back from the template of the ApplicationSet, so the pause does not hold. On 2026-11-27 the ApplicationSet service-workloads of the homelab set the automated sync of danielpetty-com back on within about 30 s of a pause (its ignoreApplicationDifferences covers only /spec/source/kustomize/images), and a new automated sync started at 23:18:54 UTC. A move under such a pause can meet a sync that makes the deleted claim again from git (as in dan-petty/homelab#472).

Change

The plan reads the owner references of each Application that it would pause. When an ApplicationSet owns one, the plan refuses the move, names the ApplicationSet, and says that it must leave /spec/syncPolicy of that Application alone (ignoreApplicationDifferences) before a pause can hold.

Acceptance criteria

  • A failing test first: the plan of a claim whose Application an ApplicationSet owns, with no ignore of /spec/syncPolicy for it, refuses and changes nothing.
  • devops ci checks pass.

Related: #7382, #7464, dan-petty/danielpetty.com#108.

Alternatives check of 2026-11-27: in-use.
The item already names this tool.
Tool: argoproj/argo-cd (https://github.com/argoproj/argo-cd), Apache-2.0, last activity 2026-11-27, maintained.
Reason: Searches found only Argo CD itself: its ApplicationSet controller defines ignoreApplicationDifferences and sets owner references, but it never refuses a volume move or checks that a pause survives reconciliation.

Covers:

  • ApplicationSet spec carries ignoreApplicationDifferences JSON pointer paths
  • Owner references on each Application name its ApplicationSet
  • API and CLI return Application and ApplicationSet as JSON

Lacks:

  • No refusal or dry-run guard for volume moves
  • No check that a pause survives ApplicationSet reconciliation
  • No volume or claim move command

Proposed design

Problem statement

devops k8s volume move pauses an Argo CD Application with spec.syncPolicy.automated.enabled: false. An ApplicationSet restores the Application spec from its template, so the pause does not hold and a new automated sync can recreate a deleted claim from git. The plan must read the owner reference of each Application that it would pause and the owning ApplicationSet's ignoreApplicationDifferences, and it must refuse the move before any change when no JSON pointer covers the pause field.

Acceptance criteria

Requirement: Refuse an owned Application with no pause ignore

The plan SHALL refuse a move when an ApplicationSet owns an Application that it would pause and no ignoreApplicationDifferences JSON pointer of the ApplicationSet covers /spec/syncPolicy/automated/enabled.

Scenario: Owned Application with no pause ignore

  • WHEN A unit test in tests/k8s/test_k8s_volume_move.py plans a claim move and fakes an Application that an ApplicationSet owns and whose ignoreApplicationDifferences has only the pointer /spec/source/kustomize/images.
  • THEN The plan raises VolumeMoveRefusedError whose problems name the ApplicationSet and say to ignore /spec/syncPolicy, and the fake cluster records no change.

Requirement: Allow a pause that the ApplicationSet ignores

The plan SHALL allow the move when an ignoreApplicationDifferences JSON pointer of the ApplicationSet covers the pause field.

Scenario: ApplicationSet with a covering ignore

  • WHEN A unit test plans the move and the ApplicationSet has one of the pointers /spec/syncPolicy and /spec/syncPolicy/automated/enabled for the Application.
  • THEN The plan pauses the Application and returns the move plan with no refusal.

Requirement: Keep unowned Applications unchanged

The plan SHALL pause and move an Application that no ApplicationSet owns as it did before.

Scenario: Application with no ApplicationSet owner

  • WHEN A unit test plans the move for an Application whose metadata.ownerReferences has no entry with kind: ApplicationSet.
  • THEN The plan pauses the Application and returns the move plan with no refusal.

Requirement: The refusal test fails before the fix

The change MUST add a test that fails on the base commit and passes with the guard.

Scenario: Fail-to-pass replay

  • WHEN A developer runs uv run pytest tests/k8s/test_k8s_volume_move.py -k applicationset_owned on the base commit and then on the head commit.
  • THEN The test fails on the base commit and passes on the head commit.

Requirement: CI checks pass

The change MUST pass the project CI checks.

Scenario: Project CI

  • WHEN A developer runs uv run devops ci.
  • THEN The command exits 0 and each check passes.

Existing Tool Considered

argoproj/argo-cd (https://github.com/argoproj/argo-cd), verdict in-use, because the item already names the tool. The alternatives check of 2026-11-27 in the issue body records what the tool covers and lacks. The change adds the refusal guard and the pause-survival pre-check in src/devops_cli/k8s/volume_move.py; it adds no move command, because PR #7518 replaces the copy with pv-migrate. The change builds its own code: about 8,000 tokens and 2 hours to build, and about 1,000 tokens per later fix; no new dependency for the guard.

Key questions

  • How does the plan identify the ApplicationSet that owns an Application?: The plan reads metadata.ownerReferences of each Application that it would pause, takes the entry with kind: ApplicationSet and apiVersion: argoproj.io/v1alpha1, and reads that ApplicationSet by name. The plan adds this read; it does not read owner references today. (best practice) [sources: src/devops_cli/k8s/volume_move.py, src/devops_cli/config/constants.py]
    • Chosen: metadata.ownerReferences. Kubernetes and Argo CD set the owner reference on the Application, and the reference names the ApplicationSet directly.
    • Rejected: ApplicationSet name from the Application name. A name can differ from the owner and is not proof of ownership.
    • Rejected: List each ApplicationSet and match its selectors. It needs the generator inputs, and it can match an ApplicationSet that does not own the Application.
  • How does the plan decide that an ApplicationSet leaves the pause field alone?: The plan reads spec.ignoreApplicationDifferences of the owning ApplicationSet and accepts a JSON pointer that equals /spec/syncPolicy/automated/enabled or is a path prefix of it, such as /spec/syncPolicy or /spec/syncPolicy/automated. It refuses when no pointer covers that field. (best practice) [sources: src/devops_cli/k8s/volume_move.py, src/devops_cli/infra/nodes.py]
    • Chosen: JSON pointer prefix cover. The pause writes spec.syncPolicy.automated.enabled, and a pointer to a parent path ignores its children.
    • Rejected: Exact /spec/syncPolicy only. It refuses a valid narrower ignore such as /spec/syncPolicy/automated/enabled.
    • Rejected: Any ignore entry. An ignore for /spec/source/kustomize/images does not keep the pause.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

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

    @dan-petty
    OwnerAuthor
    • Priority: A demonstrated failure where the pause does not hold, risking data corruption in a destructive move.
    • Related: fix(k8s): end a retrying Argo CD sync in volume move #7485, which asks for a different change. Both address the pause not holding for an ApplicationSet-owned Application, but #7485 ends a retrying sync while the candidate refuses the move.
  3. added
    value/high
    priority/p1-high
    on Nov 27, 2026
  4. devops-cli-service commented on Nov 27, 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:

    • Argo CD ApplicationSet ignoreApplicationDifferences syncPolicy, results: 5
    • Python client library Argo CD ApplicationSet API argocd, results: 5
    • argocd python package pypi ApplicationsApi, results: 5
    • "ignoreApplicationDifferences" ApplicationSet syncPolicy documentation, results: 5
    • argocd applicationset ignoreApplicationDifferences, results: 5
    • argocd python client github, results: 5
    • argo-cd python library pypi, results: 5
    • argocd-client python, results: 5
    • argocd appset get yaml ignoreApplicationDifferences, results: 5
    • kubernetes python client read ownerReferences custom resource, results: 5

    Sources:

  5. added
    status/ready
    and removed
    status/new
    on Nov 28, 2026
  6. 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.

  7. dan-petty commented on Nov 28, 2026

    @dan-petty
    OwnerAuthor

    Replacement check for #7498 (PR #7518, which replaces the volume move copy with pv-migrate): not fixed, and not in scope of the copy. pv-migrate does only the copy. The pause of Argo CD, the end of the running syncs and the plan stay in src/devops_cli/k8s/volume_move.py, unchanged in their logic, so the plan still does not read the owner references of an Application. The issue stays open.

  8. 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.

  9. added
    owner/agent
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 28, 2026
  10. removed
    status/in-review
    owner/agent
    on Nov 28, 2026
  11. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-28 06:56 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/lowpriority/p1-highscope/k8ssource/agenttype/bugvalue/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions