Implement restic-backup for Gitea #46

Merged
Mathis merged 9 commits from restic-backup into main 2024-02-10 22:45:41 +00:00
12 changed files with 36 additions and 16 deletions
Showing only changes of commit 9311774b35 - Show all commits

View File

@ -7,23 +7,10 @@ resources:
- gitea-ingress.yaml - gitea-ingress.yaml
- runner-pvc.yaml - runner-pvc.yaml
- runner-deployment.yaml - runner-deployment.yaml
- restic-sa.yaml - ./restic
- restic-role.yaml
- restic-role-binding.yaml
- restic-pvc.yaml
- restic-debug-pod.yaml
- restic-cronjob.yaml
configMapGenerator:
- name: restic-backup-script
namespace: gitea
files:
- ./restic-backup.sh
generators: generators:
- secret-generator.yaml - secret-generator.yaml
# - configmap-generator.yaml
helmCharts: helmCharts:
- name: gitea - name: gitea

View File

@ -6,6 +6,8 @@ NC='\033[0m'
echo -e "\n${GREEN}`date` - Starting backup...${NC}\n" echo -e "\n${GREEN}`date` - Starting backup...${NC}\n"
restic unlock
# Gitea # Gitea
echo -e "\n${GREEN}`date` - Backing up Gitea...${NC}\n" echo -e "\n${GREEN}`date` - Backing up Gitea...${NC}\n"
gitea=$(kubectl get deploy -n gitea -l app=gitea -o name --no-headers=true) gitea=$(kubectl get deploy -n gitea -l app=gitea -o name --no-headers=true)

View File

@ -42,7 +42,7 @@ spec:
- name: restic-container - name: restic-container
image: git.namesny.com/cluster/restic:latest image: git.namesny.com/cluster/restic:latest
imagePullPolicy: Always imagePullPolicy: Always
command: ["/bin/sh", "/app/restic-backup.sh"] command: ["/bin/sh", "/app/backup.sh"]
envFrom: envFrom:
- secretRef: - secretRef:
name: restic-secret name: restic-secret

View File

@ -0,0 +1,21 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: gitea
resources:
- service-account.yaml
- role.yaml
- role-binding.yaml
- pvc.yaml
- debug-pod.yaml
- cronjob.yaml
generators:
- secret-generator.yaml
configMapGenerator:
- name: restic-backup-script
namespace: gitea
files:
- ./backup.sh

View File

@ -0,0 +1,11 @@
apiVersion: viaduct.ai/v1
kind: ksops
metadata:
name: restic-secret-generator
annotations:
config.kubernetes.io/function: |
exec:
path: ksops
files:
- ./secret.enc.yaml

View File

@ -10,5 +10,4 @@ files:
- ./gitea-admin-secret.enc.yaml - ./gitea-admin-secret.enc.yaml
- ./renovate-bot-secret.enc.yaml - ./renovate-bot-secret.enc.yaml
- ./runner-secret.enc.yaml - ./runner-secret.enc.yaml
- ./restic-secret.enc.yaml