Repository navigation
Description
Friction
Since #1081, the homelab runs Gitea as a writable internal forge and container registry. Its repositories, packages and SQLite database are on one local-path volume (gitea/gitea-shared-storage) on one worker node. Repositories that exist only on Gitea (internal iteration that does not go to GitHub) and their images have no copy anywhere else: a lost disk or node loses them. The owner put backups out of scope on 2026-10-06 ("a NAS on the local network could hold the cluster's backups later, once there are production artifacts worth keeping outside GitHub"). This item holds the plan for that time.
What should happen
Gitea's data has a copy off its node on a schedule, made with Gitea's own gitea dump (or a reputable volume backup tool), and a documented restore that a person can run and check. The backup target is the bucket backups-gitea on the in-cluster SeaweedFS S3 gateway (owner, 2026-11-21). The store keeps 2 copies on 2 nodes, so the backup is off the Gitea node. The endpoint and the bucket are in-cluster names in git. The NAS is out. The copy outside the cluster comes with dan-petty/homelab#343, which is no dependency of this item.
Evidence
- feat(k8s): the homelab runs gitea under argo cd as a read-write internal forge, served in-cluster over http and to workstations at https://git.<domain> through the cloudflare tunnel, with its admin secret pushed from the keyring #1081 (2026-10-24): one
local-pathclaim, reclaim policy set to Retain by hand, no backup. - feat(k8s): the homelab runs gitea under argo cd as a read-write internal forge, served in-cluster over http and to workstations at https://git.<domain> through the cloudflare tunnel, with its admin secret pushed from the keyring #1081's consolidation comment (2026-10-03) names a push-secrets row
gitea/gitea-backupfor this.
Acceptance criteria
- A scheduled job writes a Gitea backup off the node, and its age is a Prometheus series with an alert when it is older than its limit.
- The README has a restore procedure, and a person ran it once on a scratch namespace.
Dependencies
- dan-petty/homelab#98 (the bucket
backups-gitea, its identity and the key Secret; feat(k8s): apply store buckets, keys and rules from git #4756 closed without them)
Source: #1081
Alternatives check of 2026-11-25: covers.
Tool: k8up-io/k8up (https://github.com/k8up-io/k8up), Apache-2.0, last activity 2026-11-24, maintained.
Reason: Searches and the k8up repository page show a maintained Kubernetes backup operator built on restic: scheduled PVC backups to S3, retention, restore and Prometheus metrics. The issue and the owner's reply already adopt it, so only the alert, annotations and restore docs remain.
Covers:
- Scheduled restic backup of annotated PVCs to an S3 bucket
- Retention with daily and weekly keep plus prune schedules
- Restore of a snapshot into a namespace
- Prometheus endpoint for job status and last success
Lacks:
- The GiteaBackupTooOld rule and its 26-hour threshold
- The
gitea dumpbackup command and.zipextension annotation - The restore procedure in the README and its scratch-namespace run
- The
backups-giteabucket, its identity and key Secret
Proposed design
Problem statement
The Gitea forge keeps its repositories, packages and SQLite database on one local-path claim on one node, and no copy exists. A lost node loses the internal work and the images that exist only there. This change installs k8up, runs a daily restic backup of the Gitea claim to the in-cluster SeaweedFS bucket backups-gitea, alerts when the last backup is too old, and documents a restore. The first live backup and restore run goes to a new issue, because it needs the deployed release, the bucket of dan-petty/homelab#98 and a person.
Acceptance criteria
Requirement: k8up release
The infra stack SHALL install the k8up Helm chart in namespace k8up under the restricted Pod Security Standard, SHALL install the chart CRDs and SHALL set skipWithoutAnnotation to true.
Scenario: k8s check passes for the k8up release
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: Argo CD admission of k8up
The homelab AppProject SHALL admit the k8up chart repository and the k8up namespace, and k8s/namespaces.yaml SHALL list the namespace with the restricted Pod Security Standard.
Scenario: k8s check passes for the Argo CD admission
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: Gitea backup Schedule
The change SHALL define a k8up Schedule in namespace gitea that backs up the annotated claims daily at 02:00, keeps 7 daily and 4 weekly snapshots, prunes weekly and runs a restic check once a week.
Scenario: k8s check passes for the Gitea Schedule
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: In-cluster target in the Schedule
The Schedule MUST name the in-cluster endpoint http://seaweedfs-s3.object-store.svc.cluster.local:8333 and the bucket backups-gitea in git, and MUST read the S3 keys and the restic password from Secrets in namespace gitea.
Scenario: k8s check passes for the Schedule backend
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: Gitea dump annotations
The Gitea pod template MUST carry the k8up.io/backupcommand annotation with a gitea dump command that writes only the archive to stdout, and the k8up.io/file-extension annotation with value .zip.
Scenario: k8s check passes for the Gitea dump annotations
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: PVC backup annotation
The gitea-shared-storage claim MUST carry the k8up.io/backup annotation with value true.
Scenario: k8s check passes for the PVC annotation
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: Backup age alert
The change SHALL add a warning alert rule GiteaBackupTooOld that fires when time() - k8up_jobs_last_successful_timestamp{job_type="backup"} is more than 93600 seconds, SHALL add that metric to SERVED_SERIES and SHALL add the row to the Alerting table of k8s/README.md.
Scenario: promtool test rules shows the backup-age alert fires
- WHEN I run
uv run pytest tests/prometheus/test_k8s_monitoring_alerting.py. - THEN The run exits 0, which shows the served-series check passes and the case of a last successful backup older than 93600 seconds fires
GiteaBackupTooOldwith severity warning.
Requirement: Restic password from cluster secrets
The restic password MUST come from the Secret that devops k8s push-secrets writes from a new cluster-secrets row of namespace gitea, and no password value SHALL appear in git.
Scenario: push-secrets plan names the restic password row
- WHEN I run
uv run devops k8s push-secrets --plan. - THEN The command exits 0 and names the restic password row of namespace
gitea.
Requirement: Restricted backup pod
The k8up PodConfig in namespace gitea SHALL run as user and group 1000 with fsGroup 1000, runAsNonRoot true, allowPrivilegeEscalation false, a read-only root filesystem, all capabilities dropped and the RuntimeDefault seccomp profile.
Scenario: k8s check passes for the PodConfig
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: Backup pod egress
Namespace gitea SHALL carry the label backup-client: "true", and a NetworkPolicy SHALL allow the k8up backup pods to reach the SeaweedFS S3 gateway on port 8333 and the API server on TCP 443 and 6443 only.
Scenario: k8s check passes for the backup egress
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: k8up operator perimeter
Namespace k8up SHALL deny all egress except DNS and the Kubernetes API server on TCP 443 and 6443.
Scenario: k8s check passes for the k8up perimeter
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: k8up metrics scrape
The change SHALL expose the k8up operator metrics on port 8080 through a ServiceMonitor and SHALL allow the scrape in the k8up and monitoring NetworkPolicies.
Scenario: k8s check passes for the k8up metrics scrape
- WHEN I run
uv run devops ci --check --only k8s. - THEN The command exits 0.
Requirement: Restore procedure
The Gitea section of k8s/README.md SHALL document a k8up restore into a scratch namespace with numbered steps, the S3 method, the folder fallback and a verification check, and SHALL remove the note that no backup exists.
Scenario: docs check passes with the restore procedure
- WHEN I run
uv run devops ci --check --only docs. - THEN The command exits 0.
Existing Tool Considered
k8up-io/k8up (https://github.com/k8up-io/k8up), Apache-2.0 and maintained, at the covers verdict of the alternatives check of 2026-11-18; the block of that check in the issue body holds what the tool covers and lacks. This change adds the parts that the block leaves to the project: the GiteaBackupTooOld rule with its 26-hour threshold and its promtool case file, the restore procedure in k8s/README.md, and the cluster-secrets row for the restic password. The copy outside the cluster stays with dan-petty/homelab#343.
Key questions
- The alternatives check found that
https://github.com/k8up-io/k8upcovers this item. Adopt the tool, or keep the item and give the reason.: Adoptk8up-io/k8upat thecoversverdict of the alternatives check in the issue body. The owner adopted it in the reply on the issue: the scope comment of 2026-11-11 chose k8up, and AGENTS.md rule 3 puts an open tool before code that the project builds. (best practice) [sources: AGENTS.md]- Chosen: Adopt k8up-io/k8up. The owner adopted the tool, and it covers the scheduled restic backup, the retention, the check, the metrics and the restore.
- Rejected: Keep the item and build the backup code. The project would build and keep the snapshot, retention, restore and metric code itself, against AGENTS.md rule 3.
- Rejected: Adopt velero-io/velero. The owner states that Velero file-system backup cannot read the hostPath volumes of this cluster.
- Where does the backup target live?: The bucket
backups-giteaon the in-cluster SeaweedFS S3 gateway athttp://seaweedfs-s3.object-store.svc.cluster.local:8333. The store keeps 2 copies on 2 nodes, so the copy is off the Gitea node. The NAS is out, and dan-petty/homelab#343 brings the copy outside the cluster. (best practice) [sources: k8s/README.md, docs/adr/0034-the-object-store-is-seaweedfs-with-its-operator.md]- Chosen: In-cluster SeaweedFS bucket backups-gitea. The owner chose it, SeaweedFS serves an S3 object store, and the store keeps 2 copies on 2 nodes.
- Rejected: NAS on the local network. The owner put the NAS out of scope.
- Rejected: A path on another node. It is not off the node, so it is no backup.
- When does the backup run, and what does it keep?: Run the backup daily at 02:00, keep 7 daily and 4 weekly snapshots, prune weekly and run a restic check once a week. The k8up Schedule holds the backup, check and prune schedules and the retention. (best practice) [sources: docs/guidelines/sre.md]
- Chosen: Daily at 02:00, 7 daily and 4 weekly. It bounds data loss to 24 hours, fits the small target and keeps a month of weekly snapshots.
- Rejected: Hourly. It multiplies storage and backup load for a forge with little change.
- Rejected: Weekly. It risks the loss of up to a week of internal work.
- How does the backup capture the live SQLite database consistently?: The Gitea pod template carries
k8up.io/backupcommand. The command sets TMPDIR under the writable/dataclaim, sends thegitea dumplog lines to stderr so stdout holds only the archive, removes the temporary file, andk8up.io/file-extensionsets.zip. The claim carriesk8up.io/backupwith valuetrue. Gitea stays online. (best practice) [sources: k8s/gitea/values.yaml, k8s/README.md]- Chosen: Application-aware command on the Gitea pod template. k8up runs the command and stores its stdout, so the dump is consistent while Gitea stays online.
- Rejected: File copy of the live database. A copy of a live SQLite file can be inconsistent and can fail to restore.
- Rejected: Stop Gitea for the backup. It adds downtime to every backup run.
- Which k8up install scope does the change use?: Install the k8up Helm chart in a new namespace
k8upthrough the infra stack. Register the release inHELM_RELEASES_BY_STACK, add its Argo CD Application, add the namespace tok8s/namespaces.yamlwith the restricted Pod Security Standard, and admit the chart repository and the namespace ink8s/argocd/apps/projects.yaml. Install the chart CRDs and setskipWithoutAnnotationto true. Install the release after theprometheus-operator-crdsrelease, which provides the ServiceMonitor CRD. (best practice) [sources: src/devops_cli/commands/k8s/stack_lifecycle.py, k8s/namespaces.yaml, k8s/argocd/apps/projects.yaml, k8s/README.md]- Chosen: Chart with skipWithoutAnnotation. The flag keeps the backup to the annotated Gitea claim and avoids a backup of every claim.
- Rejected: Name every claim to include. A new claim needs an edit, and a missed edit loses its backup.
- Rejected: Back up every claim. The cluster holds many claims that need no copy, and each copy adds load and storage.
- What is the backup-age alert threshold, and where does the rule live?: Warn when
time() - k8up_jobs_last_successful_timestamp{job_type="backup"}is more than 93600 seconds (26 hours). Put the rule in a new groupgitea-backupinserverFiles.alerting_rules.ymlofk8s/monitoring/prometheus-values.yaml. Add its case filetests/fixtures/prometheus_rules/gitea_backup_tests.yamland the pair toRULE_GROUP_TESTS. Add the metric name toSERVED_SERIES, and add the row to the Alerting table ofk8s/README.md. (best practice) [sources: k8s/monitoring/prometheus-values.yaml, tests/prometheus/test_k8s_monitoring_alerting.py, k8s/README.md, docs/guidelines/sre.md]- Chosen: 26 hours (93600 seconds). It allows one daily run plus a 2-hour grace and catches one missed run.
- Rejected: 48 hours. A missed run stays silent for two days.
- Rejected: 7 days. It is too late for a daily schedule.
- Which restore method does the README document?: Document a k8up Restore into a scratch namespace in the Gitea section of
k8s/README.md. Use the S3 method first, and name the folder method as the fallback for a snapshot that the S3 method cannot read. (best practice) [sources: k8s/README.md]- Chosen: S3 method with folder fallback. The S3 method reads the snapshot in place, and the fallback covers a snapshot that the S3 method cannot read.
- Rejected: Folder method only. It needs a full download of the snapshot before every restore.
- Rejected: Manual copy of the files. It has no check of the snapshot and no record of the restore.
- Which security context and egress do the k8up backup pods need?: A k8up PodConfig in namespace
giteasets runAsUser 1000, runAsGroup 1000 and fsGroup 1000 to match the Gitea pod that owns the/datafiles, runAsNonRoot true, allowPrivilegeEscalation false, readOnlyRootFilesystem true, drops ALL capabilities and sets seccomp RuntimeDefault. A NetworkPolicy allows the backup pods to reach the SeaweedFS S3 gateway in namespaceobject-storeon port 8333 and the API server on TCP 443 and 6443. Namespacegiteacarries the labelbackup-client: "true", which the store ingress rule requires. Thek8upnamespace gets its own default-deny perimeter. (best practice) [sources: k8s/gitea/values.yaml, k8s/namespaces.yaml, k8s/README.md, docs/adr/0034-the-object-store-is-seaweedfs-with-its-operator.md]- Chosen: Restricted PodConfig and a backup-pod NetworkPolicy. The gitea namespace enforces restricted, and only the backup pods need the S3 and API egress.
- Rejected: Privileged backup pod. It breaks the restricted standard of the namespace and adds no function.
- Rejected: Namespace-wide egress to every address. It would let the Gitea pod reach addresses it does not need.
- Who supplies the S3 endpoint, the bucket and the credentials, and when?: No person supplies the endpoint or the bucket: the Schedule names them in git. The bucket
backups-gitea, its S3 identity and the key Secret come withdan-petty/homelab#98. This item adds one cluster-secrets row for the restic password of namespacegitea.devops k8s push-secretsgenerates it, the owner pushes it from the branch, merges only when--planshowsunchanged, and then puts the password in the offline copy. No credential value goes into git. (best practice) [sources: src/devops_cli/k8s/cluster_secrets.py, k8s/README.md] - How is the README restore procedure verified in this change?: With
uv run devops ci --check --only docs, the validator for a documentation change. A test that asserts a value of a manifest or a config file is not allowed, and a live restore cannot gate the merge. (best practice) [sources: docs/TESTING.md, docs/adr/0004-ci-is-the-authoritative-gate.md]- Chosen: uv run devops ci --check --only docs. It is the validator for a documentation change, and it runs offline on the merge.
- Rejected: A documentation test that reads k8s/README.md. A test asserts no value of a manifest or a config file.
- Rejected: A live restore check. It needs the deployed release, the S3 target and keyring credentials, so it cannot gate the merge.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Moved to new items
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress
- StatusShow more project fieldsIn Progress
Activity
dan-petty commentedon Oct 24, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate deals with infrastructure related to backups and restores of Gitea data in Kubernetes.This is a medium priority item because it ensures data safety but does not block current development or operations.The change provides high value by ensuring data can be recovered in case of node loss or disk failure.Implementing scheduled backups and a tested restore procedure requires moderate effort to set up and test.feat(k8s): the homelab runs gitea under argo cd as a read-write inter…
dan-petty commentedon Oct 28, 2026
Refine cannot set this item to Ready at bb46660 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.
42 remaining items
devops-cli-service commentedon Nov 25, 2026
The draft pull request #7059 holds the final title and body. In mode
onofroadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.Spend: 109 model requests, 12274543 input tokens, 40479 output tokens.
devops-cli-service commentedon Nov 25, 2026
The runner Job devops-cli-implement-devops-cli-2144-750fba ended: succeeded.
Image digest: sha256:5bbe49e0f5028d17b1eedd2fdc6fd8ae8eed28bcb5808d3fefa215c63fc1e48b
The last lines of its log:
(no log: the Job has no pod)
Failure class:
ci_infra.Action taken: none.
Action left:
retry: run the item again.The Job left this item without a result. The item is Blocked. When a retry can fix the class of the stop, the Service starts a new Job in the next round. The limit is
roadmap.implement.continuations_per_item, and the comment of that round says so. If no continuation is left, fix the cause. Then commentimplement: retry. A new runner image also clears the stop. This holds only if a retry can fix the class of the stop. The limits ofroadmap.implement.digest_clears_per_classandroadmap.implement.digest_clears_per_itemmust also allow it.devops-cli-service commentedon Nov 25, 2026
Cleared the stop at job by the rule
continue: the runner Job devops-cli-implement-devops-cli-2144-750fba ended without a result. The classci_infraof the stop is one that a new attempt can fix. This is continuation 1 of 4 for this item. The item is Planned again. The Service takes it in the next round. The new Job takes the branch fromorigin, so it keeps the work that the run pushed there.devops-cli-service commentedon Nov 25, 2026
Stopped at pull request.
Failure class:
conflict.Action taken: none.
Action left:
repair: give the failure to a fix step.Reason:
The draft pull request #7059 has a merge conflict with the base branch
main.The item is Blocked: the implement Job ended at the draft, and no fix-checks Job takes this case. Fix the cause. Then comment
implement: retry.dan-petty commentedon Nov 25, 2026
Closing as not planned per
AGENTS.mdrule 2: environment manifests and alerts for Gitea moved todan-petty/homelab(#5134,tests/gate/k8s_checks/environment_freeze.py), and the k8up backup + alert + restore work now lives in https://github.com/dan-petty/homelab/issues/198.Summary of verification against PR
#7059(#7034implementation):dan-petty/homelabnordan-petty/infrainstallsk8upor defines the Gitea backupScheduleyet (onlydan-petty/homelab#98S3 credentials exist ink8s/gitea/store.yaml, anddan-petty/homelab#96holds the pending environmentcluster-secrets.tomlmigration).k8up_jobs_last_successful_timestamp{job_type="backup"}does not exist in upstreamk8upv2.16.1(operator/monitoring/prometheus.go), which usesjobTypeand does not expose a last-success timestamp gauge;prometheus-pushgatewayis alsoenabled: false.k8s/devops/monitoring/prometheus-rules-values.yamlis scoped todevops_cli_*and SLO rule groups (openspec/specs/product-monitoring-content/spec.md), not environment workloads (dan-petty/homelab/k8s/monitoring/prometheus-values.yaml).#7059was closed without merge, and#7022is superseded by https://github.com/dan-petty/homelab/issues/198.chore(roadmap): remove the change folders of items that are gone (#7355)