Skip to content

fix(k8s): put new stateful volumes on local-path-retain #6341

Open

Description

@dan-petty

Update 2026-11-26 (infra move): the environment volumes go to dan-petty/homelab.

This issue keeps k8s/devops/roadmap-service/pvc.yaml and the documents. k8s/devops/renovate/pvc.yaml is gone: Renovate runs from homelab. The other claims and the ignoreDifferences entry of Application devops are homelab work; that entry merges before the claim change here. local-path-retain is a homelab class: check how a minikube deploy gets it.

Follow-up: dan-petty/homelab#311.


Problem or Motivation

The stateful workloads of devops-cli ask for the StorageClass local-path, which has reclaimPolicy: Delete. Each new volume thus needs a hand patch to Retain, else the deletion of a claim deletes its data.

dan-petty/homelab now has the StorageClass local-path-retain (provisioner rancher.io/local-path, reclaimPolicy: Retain, volumeBindingMode: WaitForFirstConsumer). It came from homelab #14 (PR dan-petty/homelab#52, merged). #1634 step 3 planned this: "A Retain StorageClass in the homelab manifest, and the stateful charts point at it". #1634 closed on 2026-10-24, before the class existed.

Evidence (2026-11-18):

  • kubectl get pv: 8 bound volumes of class local-path have the Delete policy (namespaces devops, llm, monitoring, otel and one demo namespace). The other bound volumes are Retain by hand patches.
  • storageClassName: local-path is in 11 places of k8s/: k8s/devops/renovate/pvc.yaml, k8s/devops/roadmap-service/pvc.yaml, k8s/gitea/values.yaml, k8s/llm/gateway-db.yaml, k8s/mattermost/database.yaml, k8s/mattermost/files-pvc.yaml, k8s/monitoring/grafana-values.yaml, k8s/monitoring/k8s-monitoring-values.yaml, k8s/monitoring/prometheus-values.yaml (2), k8s/monitoring/pyroscope-values.yaml and k8s/otel/tempo-values.yaml.

Proposed Solution & Architectural Design

Set local-path-retain for the stateful workloads of devops-cli, for new volumes only. A bound volume keeps its class.

Constraints to design for:

  • The API server refuses a change of storageClassName on a bound claim, and a change of the volumeClaimTemplates of a StatefulSet. A plain edit of the 11 places can thus break the Argo CD sync of the claims that exist. The change must keep that sync healthy, for example with the new class only where no claim exists yet, or with an ignoreDifferences entry for the field.
  • The reclaim policy of a bound PersistentVolume can change. A documented kubectl patch pv <name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' step for the 8 Delete volumes removes the risk of today.
  • Document the class in k8s/README.md and in docs/SERVICE_PATTERNS.md for each new stateful workload.

Target Subsystem

Kubernetes manifests and Helm values (k8s/).

Existing Tool Considered

The local-path-retain StorageClass of homelab and the reclaimPolicy of Kubernetes. No new tool.

Acceptance Criteria

  • Each stateful workload of k8s/ gets local-path-retain for a new volume, and the Argo CD sync of each existing claim stays healthy.
  • After the sync, kubectl get pv shows no bound volume of a devops-cli workload with the Delete policy.
  • k8s/README.md names the class for new stateful workloads.

Source: https://github.com/dan-petty/homelab/issues/14

Alternatives check of 2026-11-27: covers.
Tool: rancher/local-path-provisioner (https://github.com/rancher/local-path-provisioner), Apache-2.0, last activity 2026-11-27, maintained.
Reason: Searches found the local-path provisioner already in use as the provisioner behind the cluster's classes; the issue asks only for a StorageClass with Retain policy, which this tool serves, and no ADR rejects it.

Covers:

  • Dynamic hostPath or local PV provisioning on each node
  • Backs a StorageClass whose provisioner is rancher.io/local-path
  • Configurable node path map with setup and teardown scripts

Lacks:

  • Reclaim policy comes from the StorageClass and PV, not the provisioner
  • Cannot change storageClassName on an already bound claim
  • No capacity limit; bound Delete volumes need a separate patch

Proposed design

Problem statement

The product-base stateful claims under k8s/devops — the roadmap Service home volume and the valkey-roadmap data volume — name StorageClass local-path, whose reclaim policy is Delete, so deleting a claim deletes its data. The homelab cluster has local-path-retain, which keeps the data. This change points both claims at that class for a new volume, adds a k8s gate check that refuses local-path under k8s/devops, and documents the class and the minikube step. A bound claim keeps its class; #6752 patches the bound Delete volumes.

Acceptance criteria

Requirement: The roadmap Service claim uses the Retain class

The PersistentVolumeClaim k8s/devops/roadmap-service/pvc.yaml SHALL set spec.storageClassName to local-path-retain.

Scenario: The k8s row accepts the roadmap Service claim

  • WHEN A person runs uv run devops ci --check --only k8s.
  • THEN The row passes and its check_every_devops_claim_names_the_retain_class check reports the claim roadmap-service-home on local-path-retain.

Requirement: The valkey-roadmap claim uses the Retain class

The valkey-data PersistentVolumeClaim patch in k8s/devops/valkey-roadmap/kustomization.yaml SHALL set storageClassName to local-path-retain.

Scenario: The k8s row accepts the rendered valkey claim

  • WHEN A person runs uv run devops ci --check --only k8s.
  • THEN The row passes and its check_every_devops_claim_names_the_retain_class check reports the rendered valkey claim on local-path-retain.

Requirement: The k8s gate refuses local-path in a devops claim

The k8s row MUST fail when a PersistentVolumeClaim under k8s/devops/ names local-path.

Scenario: The gate fails on the old class

  • WHEN A person sets storageClassName: local-path in k8s/devops/roadmap-service/pvc.yaml and runs uv run devops ci --check --only k8s.
  • THEN The row fails and the check_every_devops_claim_names_the_retain_class check names k8s/devops/roadmap-service/pvc.yaml and local-path.

Requirement: The k8s README names the Retain class

k8s/README.md SHALL name local-path-retain as the class for a new stateful volume.

Scenario: The k8s row finds the class in the README

  • WHEN A person runs uv run devops ci --check --only k8s.
  • THEN The row passes and its check_the_k8s_readme_names_the_retain_class check finds local-path-retain in the storage prerequisite of k8s/README.md.

Requirement: The k8s README documents the minikube class

k8s/README.md SHALL give the kubectl apply step that creates local-path-retain on minikube with reclaimPolicy: Retain and volumeBindingMode: WaitForFirstConsumer.

Scenario: The k8s row finds the minikube step

  • WHEN A person runs uv run devops ci --check --only k8s.
  • THEN The row passes and its check_the_k8s_readme_names_the_retain_class check finds the kubectl apply step and both fields in the minikube part of k8s/README.md.

Requirement: The service pattern requires the Retain class

docs/SERVICE_PATTERNS.md SHALL require a StorageClass with reclaimPolicy: Retain for a new stateful workload and SHALL name local-path-retain as the class of the product base.

Scenario: The k8s row finds the service-pattern rule

  • WHEN A person runs uv run devops ci --check --only k8s.
  • THEN The row passes and its check_the_service_patterns_name_the_retain_class check finds the Retain rule and local-path-retain in docs/SERVICE_PATTERNS.md.

Requirement: The change stays in the product base

The branch MUST change no path under k8s/ outside k8s/devops/.

Scenario: The k8s row accepts the branch

  • WHEN A person runs uv run devops ci --check --only k8s.
  • THEN The row passes and its check_the_repository_tracks_no_environment_file check reports no tracked file under k8s/ outside k8s/devops/ and no non-Markdown file there.

Requirement: Pending a person after the merge

A person SHALL apply the documented StorageClass manifest on a minikube cluster before a deploy whose claims name local-path-retain.

Scenario: The minikube cluster serves the Retain class

  • WHEN After the merge, a person runs the kubectl apply step of k8s/README.md on minikube and then kubectl get storageclass local-path-retain -o jsonpath='{.reclaimPolicy} {.volumeBindingMode}'.
  • THEN The command prints Retain WaitForFirstConsumer.

Existing Tool Considered

The alternatives block of 2026-11-27 records the verdict covers for rancher/local-path-provisioner (Apache-2.0, maintained); its Lacks: list is the block for what the tool does not cover. The provisioner is the one behind the cluster's local-path and local-path-retain classes, so the change keeps it and builds no storage tool: it points the two product-base claims at the Retain class, adds the k8s gate check that refuses local-path under k8s/devops/, and documents the class and the minikube step. #6752 patches the bound Delete volumes, and the homelab change adds the Argo CD ignoreDifferences entry.

Key questions

  • The alternatives check found that https://github.com/rancher/local-path-provisioner covers this item. Adopt the tool, or keep the item and give the reason.: Keep the item and use the provisioner that the cluster's local-path and local-path-retain classes already run. The alternatives block records the verdict covers, and its Lacks: list holds what the tool does not do. The change adds no storage tool: it points the two product-base claims at the Retain class and adds the k8s gate check. (best practice) [sources: openspec/changes/archive/2026-11-06-2570-minikube-starts-with-no-local-path/proposal.md:52, k8s/README.md:34]
    • Chosen: Keep rancher/local-path-provisioner. The classes of the cluster run it, the alternatives block records covers, and the change needs only the Retain class and the gate check.
    • Rejected: Build a storage provisioner or a class controller. The open tool covers the need, so AGENTS.md rule 3 refuses the build.
    • Rejected: Replace it with another provisioner. No ADR or issue names one, and the cluster's classes use rancher.io/local-path.
  • Which StorageClass should a new stateful volume use?: Use local-path-retain. It has reclaimPolicy: Retain and volumeBindingMode: WaitForFirstConsumer. A new volume then keeps its data. (best practice) [sources: k8s/README.md:340]
    • Chosen: local-path-retain. The homelab class sets the Retain policy and the WaitForFirstConsumer binding.
    • Rejected: local-path. Its reclaim policy is Delete, which deletes the data with the claim; that is the defect that this change removes.
    • Rejected: longhorn. It is the replicated CSI class of the volume-move path, not the local class of these single-node volumes.
  • Which claims under k8s/devops does this repository hold?: This repository holds two claims under k8s/devops: the claim roadmap-service-home in k8s/devops/roadmap-service/pvc.yaml, and the valkey-data PersistentVolumeClaim that k8s/devops/valkey-roadmap/kustomization.yaml patches from the shared Valkey base. [sources: k8s/devops/roadmap-service/pvc.yaml:14, k8s/devops/valkey-roadmap/kustomization.yaml:81, docs/CLUSTER.md:306]
  • How does the Argo CD sync of a bound claim stay healthy when its manifest names a new class?: The homelab Application devops holds the ignoreDifferences entry for spec.storageClassName, and that entry merges before this change. The API server refuses the field on a bound claim, so the live claim keeps its class and the manifest applies to a new claim only. (best practice) [sources: k8s/README.md:134]
    • Chosen: ignoreDifferences in the homelab Application. The API server refuses the field on a bound claim, and the live claim keeps its class.
    • Rejected: Recreate the claim in this change. It is a live data step with downtime, and no manifest change can do it.
    • Rejected: Keep the claim on local-path. A new claim would still get a Delete volume.
  • How does a minikube deploy get local-path-retain?: The storage-provisioner-rancher addon provides only local-path. A person applies a StorageClass manifest named local-path-retain with provisioner rancher.io/local-path, reclaimPolicy: Retain and volumeBindingMode: WaitForFirstConsumer before the deploy. k8s/README.md gives the kubectl apply step. (best practice) [sources: k8s/README.md:34, docs/DEVCONTAINER_USAGE.md:451, openspec/changes/archive/2026-11-06-2570-minikube-starts-with-no-local-path/proposal.md:52]
    • Chosen: Document a one-time kubectl apply in k8s/README.md. The class is a homelab class, the product base owns no copy of it, and kubectl is the existing tool.
    • Rejected: Add the StorageClass to k8s/devops and deploy it with Application devops. It would give the homelab class a second owner and conflict with the class that dan-petty/homelab manages.
    • Rejected: Create the class in the minikube start command of devops-cli. It changes the product command for a class that the environment owns, and the issue targets the manifests and the documents.
  • Where do the documents go?: k8s/README.md names local-path-retain for a new stateful volume and gives the minikube kubectl apply step. docs/SERVICE_PATTERNS.md adds a state row that requires a Retain class for a new stateful workload and names local-path-retain as the class of the product base. (best practice) [sources: CONTEXT.md:309, openspec/changes/archive/2026-11-16-6059-service-patterns/design.md:5, docs/SERVICE_PATTERNS.md:82]
    • Chosen: Name the class in both documents. The issue asks for the class in both, and docs/SERVICE_PATTERNS.md is a project profile that names the workloads of this cluster.
    • Rejected: Put only a generic Retain rule in docs/SERVICE_PATTERNS.md. The issue asks to document the class there, and that file is not a guideline under docs/guidelines/, so it may name a class of this environment.
    • Rejected: Name the class only in k8s/README.md. The issue also names docs/SERVICE_PATTERNS.md.
  • Does the manifest change affect a bound volume?: No. The API server refuses a change of spec.storageClassName on a bound claim, so a bound volume keeps its class and reclaim policy. The change applies to a new claim only. The separate item fix(k8s): patch bound Delete volumes and recreate StatefulSets #6752 patches the bound Delete volumes. [sources: k8s/README.md:134, k8s/devops/roadmap-service/pvc.yaml:14, openspec/changes/archive/2026-11-23-6752-patch-bound-delete-volumes-and-recreate/proposal.md:7]
  • How does the change keep a new claim off local-path?: Add check_every_devops_claim_names_the_retain_class to the k8s row. It reads the render of k8s/devops and fails when a PersistentVolumeClaim names local-path. (best practice) [sources: AGENTS.md:17, tests/gate/k8s.py:4, docs/TESTING.md:61]
    • Chosen: Add a k8s gate check. AGENTS rule 11 asks for a check that fails if the problem returns, and the k8s row already checks the committed manifests.
    • Rejected: Rely on review only. A review rule does not fail a pull request.
    • Rejected: Add a pytest test that reads the manifest. docs/TESTING.md:61 refuses a test that asserts a value of a manifest; the k8s row is the place for that check.

Open questions

  • The alternatives check found that https://github.com/rancher/local-path-provisioner covers this item. Adopt the tool, or keep the item and give the reason. (a person decides)

Fit

Fits in one pull request.

Suspected block

The homelab pull request dan-petty/homelab#311 adds the ignoreDifferences entry for Application devops; it must merge before this claim change reaches the cluster.

Dependencies

None.

Moved to new items

#6752

Activity

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

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 18, 2026
  4. devops-cli-service commented on Nov 19, 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 22, 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 (5)

    Tools considered:

    Searches run:

    • rancher local-path-provisioner StorageClass reclaimPolicy Retain, results: 5
    • local-path-provisioner storage class reclaimPolicy Retain documentation, results: 5
    • Kubernetes StorageClass reclaimPolicy Retain WaitForFirstConsumer immutable storageClassName bound PVC, results: 5
    • rancher/local-path-provisioner github, results: 5
    • "local-path-retain", results: 5

    Sources:

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

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

  8. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 23, 2026
  9. dan-petty commented on Nov 23, 2026

    @dan-petty
    OwnerAuthor

    Since step 11 of docs/HOMELAB_REPO_SWITCH.md (#6820), Argo CD reads the homelab environment from dan-petty/homelab. The k8s/ paths outside k8s/devops are frozen and rejected by the k8s gate (check_the_branch_changes_no_environment_path). The stateful workload StorageClass changes and Argo CD ignoreDifferences belong in a pull request to dan-petty/homelab, while devops-cli only holds k8s/devops (renovate and roadmap-service).

  10. added
    status/new
    and removed
    status/in-progress
    on Nov 23, 2026
  11. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  12. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  13. 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: in-use, tool https://github.com/rancher/local-path-provisioner. A person decides what the new result means for the item.

    Searches (4)

    Tools considered:

    Searches run:

    • local-path-provisioner Kubernetes StorageClass reclaimPolicy Retain, results: 5
    • rancher local-path-provisioner storage class reclaim policy documentation, results: 5
    • "local-path-provisioner" StorageClass example yaml volumeBindingMode WaitForFirstConsumer, results: 5
    • Kubernetes StorageClass reclaimPolicy field persistentVolumeReclaimPolicy documentation, results: 5

    Sources:

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

    @devops-cli-service
    Contributor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

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/mediumowner/agentpriority/p2-mediumscope/k8ssource/agentstatus/newtype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions