Compare commits
2 Commits
25c53eabfa
...
60bc313604
Author | SHA1 | Date | |
---|---|---|---|
60bc313604
|
|||
752f67f052 |
@@ -168,43 +168,6 @@ spec:
|
|||||||
metadataPolicy: None
|
metadataPolicy: None
|
||||||
property: id_rsa.pub
|
property: id_rsa.pub
|
||||||
|
|
||||||
---
|
|
||||||
apiVersion: external-secrets.io/v1
|
|
||||||
kind: ExternalSecret
|
|
||||||
metadata:
|
|
||||||
name: gitea-backup-s3
|
|
||||||
namespace: {{ .Release.Namespace }}
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/name: gitea-backup-s3
|
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
||||||
app.kubernetes.io/part-of: {{ .Release.Name }}
|
|
||||||
spec:
|
|
||||||
secretStoreRef:
|
|
||||||
kind: ClusterSecretStore
|
|
||||||
name: vault
|
|
||||||
data:
|
|
||||||
- secretKey: AWS_ACCESS_KEY_ID
|
|
||||||
remoteRef:
|
|
||||||
conversionStrategy: Default
|
|
||||||
decodingStrategy: None
|
|
||||||
key: /digital-ocean/home-infra/gitea-backup
|
|
||||||
metadataPolicy: None
|
|
||||||
property: AWS_ACCESS_KEY_ID
|
|
||||||
- secretKey: AWS_SECRET_ACCESS_KEY
|
|
||||||
remoteRef:
|
|
||||||
conversionStrategy: Default
|
|
||||||
decodingStrategy: None
|
|
||||||
key: /digital-ocean/home-infra/gitea-backup
|
|
||||||
metadataPolicy: None
|
|
||||||
property: AWS_SECRET_ACCESS_KEY
|
|
||||||
- secretKey: S3_REPOSITORY
|
|
||||||
remoteRef:
|
|
||||||
conversionStrategy: Default
|
|
||||||
decodingStrategy: None
|
|
||||||
key: /digital-ocean/home-infra/gitea-backup
|
|
||||||
metadataPolicy: None
|
|
||||||
property: S3_REPOSITORY
|
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: external-secrets.io/v1
|
apiVersion: external-secrets.io/v1
|
||||||
kind: ExternalSecret
|
kind: ExternalSecret
|
||||||
@@ -224,9 +187,16 @@ spec:
|
|||||||
remoteRef:
|
remoteRef:
|
||||||
conversionStrategy: Default
|
conversionStrategy: Default
|
||||||
decodingStrategy: None
|
decodingStrategy: None
|
||||||
key: /cl01tl/gitea/backup
|
key: /digital-ocean/home-infra/gitea-backup
|
||||||
metadataPolicy: None
|
metadataPolicy: None
|
||||||
property: s3cfg
|
property: s3cfg
|
||||||
|
- secretKey: BUCKET
|
||||||
|
remoteRef:
|
||||||
|
conversionStrategy: Default
|
||||||
|
decodingStrategy: None
|
||||||
|
key: /digital-ocean/home-infra/gitea-backup
|
||||||
|
metadataPolicy: None
|
||||||
|
property: BUCKET
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: external-secrets.io/v1
|
apiVersion: external-secrets.io/v1
|
||||||
|
@@ -200,12 +200,15 @@ backup:
|
|||||||
- -ec
|
- -ec
|
||||||
- |
|
- |
|
||||||
echo ">> Running S3 backup for Gitea"
|
echo ">> Running S3 backup for Gitea"
|
||||||
s3cmd put --no-check-md5 --no-check-certificate -v /opt/backup/gitea-backup.zip ${S3_REPOSITORY}/gitea-backup-$(date +"%Y%m%d-%H-%M").zip;
|
s3cmd put --no-check-md5 --no-check-certificate -v /opt/backup/gitea-backup.zip ${BUCKET}/cl01tl/gitea-backup-$(date +"%Y%m%d-%H-%M").zip;
|
||||||
mv /opt/backup/gitea-backup.zip /opt/backup/gitea-backup-$(date +"%Y%m%d-%H-%M").zip;
|
mv /opt/backup/gitea-backup.zip /opt/backup/gitea-backup-$(date +"%Y%m%d-%H-%M").zip;
|
||||||
echo ">> Completed S3 backup for Gitea"
|
echo ">> Completed S3 backup for Gitea"
|
||||||
envFrom:
|
env:
|
||||||
- secretRef:
|
- name: BUCKET
|
||||||
name: gitea-backup-s3
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: gitea-s3cmd-config
|
||||||
|
key: BUCKET
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
@@ -226,18 +229,21 @@ backup:
|
|||||||
echo ">> Running S3 prune for Gitea backup repository"
|
echo ">> Running S3 prune for Gitea backup repository"
|
||||||
echo ">> Backups prior to '$TIME_RANGE' will be removed"
|
echo ">> Backups prior to '$TIME_RANGE' will be removed"
|
||||||
echo ">> File list:"
|
echo ">> File list:"
|
||||||
s3cmd ls -v $S3_REPOSITORY
|
s3cmd ls -v ${BUCKET}/cl01tl/
|
||||||
echo ">> Deleting ..."
|
echo ">> Deleting ..."
|
||||||
s3cmd ls -v $S3_REPOSITORY |
|
s3cmd ls -v ${BUCKET}/cl01tl/ |
|
||||||
awk -v time_range="$TIME_RANGE" '$1 < time_range {print $4}' |
|
awk -v time_range="$TIME_RANGE" '$1 < time_range {print $4}' |
|
||||||
while read file;
|
while read file;
|
||||||
do s3cmd del -v "$file";
|
do s3cmd del -v "$file";
|
||||||
echo ">> Deleted $file";
|
echo ">> Deleted $file";
|
||||||
done;
|
done;
|
||||||
echo ">> Completed S3 prune for Gitea backup repository"
|
echo ">> Completed S3 prune for Gitea backup repository"
|
||||||
envFrom:
|
env:
|
||||||
- secretRef:
|
- name: BUCKET
|
||||||
name: gitea-backup-s3
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: gitea-s3cmd-config
|
||||||
|
key: BUCKET
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 100m
|
cpu: 100m
|
||||||
|
Reference in New Issue
Block a user