Files
Backup_kube/Gitea/gitea_backup_repositories.cronjob.yaml
pi-ux-ce f8c5043c3e
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 13m4s
clean useless folder and add build option for bitwarden docker image
2024-10-25 10:19:53 +01:00

88 lines
1.7 KiB
YAML

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: backup-service-account
namespace: gitea
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: role:service-acc
namespace: gitea
rules:
- apiGroups: [""]
resources:
- pods
- pods/exec
verbs:
- create
- list
- apiGroups: ["apps"]
resources:
- deployments
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: rolebinding:service-acc
namespace: gitea
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: role:service-acc
subjects:
- kind: ServiceAccount
name: backup-service-account
namespace: gitea
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: gitea-documents-backup
namespace: gitea
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
ttlSecondsAfterFinished: 100
template:
spec:
serviceAccountName: "backup-service-account"
containers:
- name: export-attachements
command:
- "/bin/sh"
- "-c"
args: ['
echo "start the export";
kubectl exec -it deploy/gitea-webserver -- su -c "/app/gitea/gitea dump -c /data/gitea/conf/app.ini -f /backup/backup_$(date "+%Y-%m-%d_%Hh-%m").zip" git
echo "Export done"
']
image: "bitnami/kubectl:latest"
restartPolicy: Never
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: gitea-documents-backup
namespace: gitea
annotations:
fileType: Backup
spec:
storageClassName: nfs-storage-fastaccess
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi