stack.basicstack.de/velero/restore-drill/00-serviceaccount-rbac.yaml
CTO (Paperclip Agent) ac9f36b1e7 feat(velero): monthly restore-drill CronJob for openwebui (DEV-575)
- CronJob at 0 4 1 * * restores the latest openwebui-manifests backup into
  a transient restore-test-<ts> namespace, diffs core resource-kind counts
  against the live openwebui namespace, and deletes the target namespace.
- ServiceAccount + ClusterRole scoped to velero.io + namespace + configmap
  ops. Script enforces the 'restore-test-' name prefix before deleting a
  namespace. Cluster-wide 'view' bound for the diff.
- Failure surfaces via kube_job_status_failed (DEV-574 alert stack) and via
  ConfigMap velero-restore-drill-last-result written on every run.
- Optional Paperclip webhook Secret is sealed but unreachable from Hetzner
  right now (home Paperclip is LAN-only); wired as optional secretKeyRef so
  the drill runs regardless. Connectivity is a follow-up.
- Argo Application velero-restore-drill points at velero/restore-drill/.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-09-12 18:03:37 +00:00

60 lines
1.7 KiB
YAML

apiVersion: v1
kind: ServiceAccount
metadata:
name: restore-drill
namespace: velero
labels:
app.kubernetes.io/part-of: velero-restore-drill
---
# Ops permissions: create/list/get/delete velero Backups+Restores, create+delete
# restore-test-* namespaces. Namespace verbs cannot be name-scoped in RBAC, so we
# accept cluster-wide namespace create/delete. Drill script enforces the
# 'restore-test-' name prefix before deleting.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: velero-restore-drill-ops
labels:
app.kubernetes.io/part-of: velero-restore-drill
rules:
- apiGroups: ["velero.io"]
resources: ["backups", "restores"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "create", "update", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: velero-restore-drill-ops
labels:
app.kubernetes.io/part-of: velero-restore-drill
subjects:
- kind: ServiceAccount
name: restore-drill
namespace: velero
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: velero-restore-drill-ops
---
# Read-only diff permissions: cluster-scoped read of the workload resources we
# compare between the source and restored namespaces.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: velero-restore-drill-view
labels:
app.kubernetes.io/part-of: velero-restore-drill
subjects:
- kind: ServiceAccount
name: restore-drill
namespace: velero
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view