From 6796d3ef06b76500466c44db6d519abec84cd2f9 Mon Sep 17 00:00:00 2001 From: Alex Lebens Date: Mon, 10 Mar 2025 18:36:05 -0500 Subject: [PATCH] split containers --- clusters/cl01tl/platform/gitea/values.yaml | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/clusters/cl01tl/platform/gitea/values.yaml b/clusters/cl01tl/platform/gitea/values.yaml index c82c1fc39..86f8b5567 100644 --- a/clusters/cl01tl/platform/gitea/values.yaml +++ b/clusters/cl01tl/platform/gitea/values.yaml @@ -140,7 +140,7 @@ backup: cpu: 100m memory: 128Mi containers: - s3: + s3-backup: image: repository: d3fk/s3cmd tag: latest@sha256:19792558807828017ca8d40a814b2e6850c2e46828e67ac32b6c28612ca4adfe @@ -152,8 +152,30 @@ backup: - | s3cmd put --no-check-md5 --no-check-certificate /opt/backup/gitea-backup.zip s3://gitea-backups-8ba8dae3674a2f53354c600e/cl01tl/cl01tl-gitea-backups/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; - apk add --update coreutils - s3cmd ls s3://gitea-backups-8ba8dae3674a2f53354c600e/cl01tl/cl01tl-gitea-backups/ | awk '$1 < "'$(date -d "7 days ago" +%Y-%m-%d\ %H:%M:%S)'" {print $4}' | while read file; do s3cmd del "s3://gitea-backups-8ba8dae3674a2f53354c600e/cl01tl/cl01tl-gitea-backups/$file"; done + envFrom: + - secretRef: + name: gitea-backup-s3 + resources: + requests: + cpu: 100m + memory: 128Mi + s3-prune: + image: + repository: d3fk/s3cmd + tag: latest@sha256:19792558807828017ca8d40a814b2e6850c2e46828e67ac32b6c28612ca4adfe + pullPolicy: IfNotPresent + command: + - /bin/sh + args: + - -ec + - | + export WEEK_AGO=$(date -d @$(( $(date +%s) - 604800 )) +%Y-%m-%d\ %H:%M:%S); + + s3cmd ls s3://gitea-backups-8ba8dae3674a2f53354c600e/cl01tl/cl01tl-gitea-backups/ | + awk -v week_ago="$WEEK_AGO" '$1 < week_ago {print $4}' | + while read file; + do s3cmd del "s3://gitea-backups-8ba8dae3674a2f53354c600e/cl01tl/cl01tl-gitea-backups/$file"; + done; envFrom: - secretRef: name: gitea-backup-s3 @@ -168,7 +190,7 @@ backup: existingClaim: gitea-nfs-storage-backup advancedMounts: backup: - s3: + s3-backup: - path: /opt/backup readOnly: false s3cmd-config: @@ -177,7 +199,12 @@ backup: name: gitea-s3cmd-config advancedMounts: backup: - s3: + s3-backup: + - path: /root/.s3cfg + readOnly: true + mountPropagation: None + subPath: .s3cfg + s3-prune: - path: /root/.s3cfg readOnly: true mountPropagation: None