fix(forte-drop-pg-backup): upload with rclone, the mc image can no longer be pulled #64

Open
jorgen.stensrud wants to merge 2 commits from fix/forte-drop-pg-backup-rclone into main
Member

Why

The nightly Postgres backup of forte-drop uploads with quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z. MinIO made the mc repository private: that tag answers 401 on quay.io (checked 2026-11-24, also with an anonymous pull token). It is the cause 90b8e6f fixed for the Gitea backup; this job did not get the same change.

The last dump known to be in the bucket is _pgbackups/forte-drop-20260924T020008Z.sql.gz. Whether the job has failed every night since is not confirmed: I cannot see the pods or list the bucket. A node that still has the image cached would keep working.

What

apps/overlays/upc-dev/forte-drop-postgresql/resources/pg-backup-cronjob.yaml: the upload container uses rclone/rclone:1.75.2 (the version the Gitea job pins).

  • rclone copy /work s3:drops/_pgbackups/ --include "*.sql.gz" replaces mc cp.
  • rclone delete --min-age 30d --use-server-modtime s3:drops/_pgbackups/ replaces mc rm --older-than 30d. The prefix is fixed in the script: the bucket also holds every drop.
  • HOME=/work (writable for uid 65532 through fsGroup) replaces MC_CONFIG_DIR. RCLONE_S3_NO_CHECK_BUCKET=true as in the Gitea job.
  • Same secrets, schedule, dump container and security context.

Not tested

Not run anywhere: no cluster access and no Docker here. Please check after merge:

kubectl -n forte-drop create job --from=cronjob/forte-drop-pg-backup pg-backup-manual
kubectl -n forte-drop logs job/pg-backup-manual -c upload

and that a new forte-drop-<timestamp>.sql.gz is in _pgbackups/.

Not changed

RESTORE.md in the same folder still runs its listing and download pods with the mc image, so the restore runbook cannot run as written either. Left alone because I cannot test a rewrite; it needs the same swap.

Review

Codex review: no findings.

🤖 Generated with Claude Code

## Why The nightly Postgres backup of forte-drop uploads with `quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z`. MinIO made the `mc` repository private: that tag answers 401 on quay.io (checked 2026-11-24, also with an anonymous pull token). It is the cause 90b8e6f fixed for the Gitea backup; this job did not get the same change. The last dump known to be in the bucket is `_pgbackups/forte-drop-20260924T020008Z.sql.gz`. Whether the job has failed every night since is **not confirmed**: I cannot see the pods or list the bucket. A node that still has the image cached would keep working. ## What `apps/overlays/upc-dev/forte-drop-postgresql/resources/pg-backup-cronjob.yaml`: the upload container uses `rclone/rclone:1.75.2` (the version the Gitea job pins). - `rclone copy /work s3:drops/_pgbackups/ --include "*.sql.gz"` replaces `mc cp`. - `rclone delete --min-age 30d --use-server-modtime s3:drops/_pgbackups/` replaces `mc rm --older-than 30d`. The prefix is fixed in the script: the bucket also holds every drop. - `HOME=/work` (writable for uid 65532 through fsGroup) replaces `MC_CONFIG_DIR`. `RCLONE_S3_NO_CHECK_BUCKET=true` as in the Gitea job. - Same secrets, schedule, dump container and security context. ## Not tested Not run anywhere: no cluster access and no Docker here. Please check after merge: ``` kubectl -n forte-drop create job --from=cronjob/forte-drop-pg-backup pg-backup-manual kubectl -n forte-drop logs job/pg-backup-manual -c upload ``` and that a new `forte-drop-<timestamp>.sql.gz` is in `_pgbackups/`. ## Not changed `RESTORE.md` in the same folder still runs its listing and download pods with the `mc` image, so the restore runbook cannot run as written either. Left alone because I cannot test a rewrite; it needs the same swap. ## Review Codex review: no findings. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jorgen.stensrud added 1 commit 2026-11-24 09:47:47 +00:00
quay.io/minio/mc answers 401 for every tag since MinIO made the repository
private, so the upload container cannot be pulled. Same cause and fix as the
Gitea backup (90b8e6f): rclone/rclone:1.75.2, copy to s3:drops/_pgbackups/
and prune that prefix only with delete --min-age 30d.
ai_bot reviewed 2026-11-24 09:49:09 +00:00
ai_bot left a comment
Owner

🤖 AI Review · O1

⚠️ Findings present — 🔴 0 blocker · 🟠 1 medium · 🟡 0 low

📝 Assessment · O1-A

This PR replaces the upload container of the nightly forte-drop pg_dump CronJob. It drops the quay.io/minio/mc image, which can no longer be pulled, and uses rclone/rclone:1.75.2, the same fix already applied to cluster-resources/gitea-backup-cronjob.yaml.

Correctness of the swap. The new script matches the old behaviour, and in places it is stricter than the old one:

  • Remote configuration: the remote is set entirely through RCLONE_CONFIG_S3_* env vars, so no config file has to exist.
  • Upload: rclone copy /work "$DEST" --include "*.sql.gz" uploads only the dump. Anything rclone itself writes under HOME=/work is filtered out.
  • Retention: rclone delete --min-age 30d --use-server-modtime "$DEST" is scoped to s3:drops/_pgbackups/, just like the old mc rm --recursive --older-than 30d. The drop objects elsewhere in the bucket are not at risk. --use-server-modtime makes the age check use S3 LastModified without extra HEAD requests, which is right here.
  • Bucket check: RCLONE_S3_NO_CHECK_BUCKET=true avoids a CreateBucket call, the same as the Gitea job.
  • Writable home: HOME=/work works for uid 65532 because of fsGroup.
  • Unchanged parts: secrets, schedule, the dump container and the security context are the same. The rclone image is Alpine/busybox based, so set -euo pipefail in sh still works.

Pre-existing, not introduced here. The || true on the prune step still hides retention failures. There is also no activeDeadlineSeconds, which the Gitea job has. Both are optional hardening.

Main remaining risk. The change has not been run anywhere, and the author is open about that. Run the manual-job check from the description after merge. Separately, the restore runbook in the same folder still uses the unpullable mc image, which leaves the recovery path broken (see finding). This is not a blocker for merging the backup fix, but it should be done soon.


🔎 Findings · 1

🟠 MEDIUM · O1-F1 · Restore runbook still depends on the mc image that can no longer be pulled

Explanation

This PR fixes the backup writer. The documented read path in the same folder still uses quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z, which the PR says now answers 401:

  • the "List available backups" pod (RESTORE.md:33-35)
  • the recommended "2-pod" download step mc-get (RESTORE.md:87-90)
  • the mc mirror example (RESTORE.md:130)

The PR description says this was left alone on purpose. Still, a backup you cannot restore by following the runbook is only half fixed, and you will need the restore path during an incident, when nobody has time to rewrite it. The swap is mechanical. It uses the same image and the same env-var remote configuration this PR adds to the CronJob, so it can go in this PR or a quick follow-up.

Where

Impact

In a disaster-recovery situation, an operator following RESTORE.md hits ImagePullBackOff on both the listing step and the download step. They then have to work out an alternative under pressure.

Recommendation

Replace the mc pods with rclone and reuse the CronJob's env-based remote. For example, for listing:

kubectl -n forte-drop run rclone-list --rm -it --restart=Never \
  --image=rclone/rclone:1.75.2 \
  --overrides='{"spec":{"containers":[{"name":"rclone","image":"rclone/rclone:1.75.2","command":["sh","-c","export RCLONE_CONFIG_S3_TYPE=s3 RCLONE_CONFIG_S3_PROVIDER=Other RCLONE_CONFIG_S3_ENDPOINT=\"$S3_ENDPOINT\" RCLONE_CONFIG_S3_ACCESS_KEY_ID=\"$S3_KEY\" RCLONE_CONFIG_S3_SECRET_ACCESS_KEY=\"$S3_SECRET\" HOME=/tmp; rclone lsl s3:drops/_pgbackups/"],"envFrom":[{"secretRef":{"name":"forte-drop-secrets"}}]}]}}'

For the download step, use rclone cat s3:drops/_pgbackups/$DUMP in place of mc cat .... Use rclone sync in place of the mc mirror example. Test the listing command when you run the manual backup job after merge. If you defer this, at least open a tracking issue.


🧭 Coverage and limitations

Reviewed

  • apps/overlays/upc-dev/forte-drop-postgresql/resources/pg-backup-cronjob.yaml (full file and diff)
  • cluster-resources/gitea-backup-cronjob.yaml (the reference rclone setup)
  • apps/overlays/upc-dev/forte-drop-postgresql/RESTORE.md
  • A search for other rclone and mc usages under apps/

Not verified

I could not run the job or check cluster or bucket state. Whether rclone authenticates against UpCloud Object Storage with provider=Other and these credentials is inferred from the working Gitea job, not observed.


Agentic review by AI Git Bot

# 🤖 AI Review · O1 ⚠️ **Findings present** — 🔴 **0** blocker · 🟠 **1** medium · 🟡 **0** low ## 📝 Assessment · O1-A This PR replaces the upload container of the nightly forte-drop `pg_dump` CronJob. It drops the `quay.io/minio/mc` image, which can no longer be pulled, and uses `rclone/rclone:1.75.2`, the same fix already applied to `cluster-resources/gitea-backup-cronjob.yaml`. **Correctness of the swap.** The new script matches the old behaviour, and in places it is stricter than the old one: - **Remote configuration:** the remote is set entirely through `RCLONE_CONFIG_S3_*` env vars, so no config file has to exist. - **Upload:** `rclone copy /work "$DEST" --include "*.sql.gz"` uploads only the dump. Anything rclone itself writes under `HOME=/work` is filtered out. - **Retention:** `rclone delete --min-age 30d --use-server-modtime "$DEST"` is scoped to `s3:drops/_pgbackups/`, just like the old `mc rm --recursive --older-than 30d`. The drop objects elsewhere in the bucket are not at risk. `--use-server-modtime` makes the age check use S3 LastModified without extra HEAD requests, which is right here. - **Bucket check:** `RCLONE_S3_NO_CHECK_BUCKET=true` avoids a CreateBucket call, the same as the Gitea job. - **Writable home:** `HOME=/work` works for uid 65532 because of `fsGroup`. - **Unchanged parts:** secrets, schedule, the dump container and the security context are the same. The rclone image is Alpine/busybox based, so `set -euo pipefail` in `sh` still works. **Pre-existing, not introduced here.** The `|| true` on the prune step still hides retention failures. There is also no `activeDeadlineSeconds`, which the Gitea job has. Both are optional hardening. **Main remaining risk.** The change has not been run anywhere, and the author is open about that. Run the manual-job check from the description after merge. Separately, the restore runbook in the same folder still uses the unpullable mc image, which leaves the recovery path broken (see finding). This is not a blocker for merging the backup fix, but it should be done soon. --- ## 🔎 Findings · 1 ### 🟠 MEDIUM · `O1-F1` · Restore runbook still depends on the mc image that can no longer be pulled **Explanation** This PR fixes the backup writer. The documented read path in the same folder still uses `quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z`, which the PR says now answers 401: - the "List available backups" pod (RESTORE.md:33-35) - the recommended "2-pod" download step `mc-get` (RESTORE.md:87-90) - the `mc mirror` example (RESTORE.md:130) The PR description says this was left alone on purpose. Still, a backup you cannot restore by following the runbook is only half fixed, and you will need the restore path during an incident, when nobody has time to rewrite it. The swap is mechanical. It uses the same image and the same env-var remote configuration this PR adds to the CronJob, so it can go in this PR or a quick follow-up. **Where** - 📍 [`apps/overlays/upc-dev/forte-drop-postgresql/RESTORE.md:32–36`](https://git.forteapps.net/Forte/launchpad/src/commit/4513a319759212340b3a4679b60cd99fbd823872/apps/overlays/upc-dev/forte-drop-postgresql/RESTORE.md#L32-L36) · HEAD > Backup listing still runs the now-private mc image. - 📍 [`apps/overlays/upc-dev/forte-drop-postgresql/RESTORE.md:86–90`](https://git.forteapps.net/Forte/launchpad/src/commit/4513a319759212340b3a4679b60cd99fbd823872/apps/overlays/upc-dev/forte-drop-postgresql/RESTORE.md#L86-L90) · HEAD > Recommended restore download step still uses the mc image and `mc cat`. - 📍 [`apps/overlays/upc-dev/forte-drop-postgresql/resources/pg-backup-cronjob.yaml:79–99`](https://git.forteapps.net/Forte/launchpad/src/commit/4513a319759212340b3a4679b60cd99fbd823872/apps/overlays/upc-dev/forte-drop-postgresql/resources/pg-backup-cronjob.yaml#L79-L99) · HEAD > The rclone env-var remote configuration that can be reused in the runbook. **Impact** In a disaster-recovery situation, an operator following RESTORE.md hits ImagePullBackOff on both the listing step and the download step. They then have to work out an alternative under pressure. **Recommendation** Replace the mc pods with rclone and reuse the CronJob's env-based remote. For example, for listing: ```bash kubectl -n forte-drop run rclone-list --rm -it --restart=Never \ --image=rclone/rclone:1.75.2 \ --overrides='{"spec":{"containers":[{"name":"rclone","image":"rclone/rclone:1.75.2","command":["sh","-c","export RCLONE_CONFIG_S3_TYPE=s3 RCLONE_CONFIG_S3_PROVIDER=Other RCLONE_CONFIG_S3_ENDPOINT=\"$S3_ENDPOINT\" RCLONE_CONFIG_S3_ACCESS_KEY_ID=\"$S3_KEY\" RCLONE_CONFIG_S3_SECRET_ACCESS_KEY=\"$S3_SECRET\" HOME=/tmp; rclone lsl s3:drops/_pgbackups/"],"envFrom":[{"secretRef":{"name":"forte-drop-secrets"}}]}]}}' ``` For the download step, use `rclone cat s3:drops/_pgbackups/$DUMP` in place of `mc cat ...`. Use `rclone sync` in place of the `mc mirror` example. Test the listing command when you run the manual backup job after merge. If you defer this, at least open a tracking issue. --- ## 🧭 Coverage and limitations **Reviewed** - `apps/overlays/upc-dev/forte-drop-postgresql/resources/pg-backup-cronjob.yaml` (full file and diff) - `cluster-resources/gitea-backup-cronjob.yaml` (the reference rclone setup) - `apps/overlays/upc-dev/forte-drop-postgresql/RESTORE.md` - A search for other rclone and mc usages under `apps/` **Not verified** I could not run the job or check cluster or bucket state. Whether rclone authenticates against UpCloud Object Storage with `provider=Other` and these credentials is inferred from the working Gitea job, not observed. --- *Agentic review by [AI Git Bot](https://gitbot.eu)*
Author
Member

Confirmed in the cluster (read-only, 2026-11-24):

  • Last completed job: forte-drop-pg-backup-29836920, 2026-09-24T02:00:26Z. Nothing has completed since, 61 days.
  • The current job forte-drop-pg-backup-29923320 has been stuck for 23 h: the dump init container finished with exit 0, the upload container is in ImagePullBackOff on quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z ("failed to resolve reference … unexpected status from HEAD request to https://quay.io/v2/minio/mc/manifests/…").
  • The pod waits instead of failing and the job has concurrencyPolicy: Forbid, so a stuck job blocks the following nights; the three older jobs each hung for days before failing.
  • Several of the retried pods were evicted with DiskPressure on the node. All four nodes report DiskPressure=False now. Not part of this PR.

So what the description calls "not confirmed" is now confirmed. The new job itself has still not been run anywhere.

Confirmed in the cluster (read-only, 2026-11-24): - Last completed job: `forte-drop-pg-backup-29836920`, 2026-09-24T02:00:26Z. Nothing has completed since, 61 days. - The current job `forte-drop-pg-backup-29923320` has been stuck for 23 h: the `dump` init container finished with exit 0, the `upload` container is in `ImagePullBackOff` on `quay.io/minio/mc:RELEASE.2024-11-21T17-21-54Z` ("failed to resolve reference … unexpected status from HEAD request to https://quay.io/v2/minio/mc/manifests/…"). - The pod waits instead of failing and the job has `concurrencyPolicy: Forbid`, so a stuck job blocks the following nights; the three older jobs each hung for days before failing. - Several of the retried pods were evicted with `DiskPressure` on the node. All four nodes report `DiskPressure=False` now. Not part of this PR. So what the description calls "not confirmed" is now confirmed. The new job itself has still not been run anywhere.
Author
Member

Two updates, head on this branch now includes RESTORE.md.

Tested locally (Docker), with the script, image and env taken verbatim from the YAML in this PR:

Step Result
dump init container (only the hostname swapped), uid 65532, read-only root exit 0, forte-drop-<ts>.sql.gz in /work
upload container, rclone/rclone:1.75.2, uid 65532, read-only root, HOME=/work exit 0, the dump is in s3:drops/_pgbackups/
Prune with --min-age 30d nothing deleted (the older dump in the test bucket was minutes old)
The same prune with --min-age 1s everything under _pgbackups/ deleted, drops/abc-123/index.html untouched
Restore: `rclone cat … gunzip

The S3 server was adobe/s3mock, not UpCloud, so what is still unproven is rclone against UpCloud Object Storage with the app's credentials. The Gitea job does that with the same settings.

ai-review finding O1-F1 (restore runbook still used the mc image): fixed. RESTORE.md now lists and downloads with rclone/rclone:1.75.2 and the same env-var remote as the job, the placeholder single-pod variant is gone, and the mc mirror example is rclone sync. The rclone lsl / rclone cat commands are the ones from the local test; the kubectl run … --overrides wrappers around them have not been run in the cluster.

Not changed (pre-existing, from the review): || true on the prune, no activeDeadlineSeconds. The second one matters more than it looks: the current job has been stuck in ImagePullBackOff for a day and blocks the following nights (concurrencyPolicy: Forbid). Say if you want it in this PR.

After merge the stuck job forte-drop-pg-backup-29923320 has to be deleted, or the new spec will not run until it gives up.

Two updates, head on this branch now includes `RESTORE.md`. **Tested locally (Docker), with the script, image and env taken verbatim from the YAML in this PR:** | Step | Result | |---|---| | `dump` init container (only the hostname swapped), uid 65532, read-only root | exit 0, `forte-drop-<ts>.sql.gz` in `/work` | | `upload` container, `rclone/rclone:1.75.2`, uid 65532, read-only root, `HOME=/work` | exit 0, the dump is in `s3:drops/_pgbackups/` | | Prune with `--min-age 30d` | nothing deleted (the older dump in the test bucket was minutes old) | | The same prune with `--min-age 1s` | everything under `_pgbackups/` deleted, `drops/abc-123/index.html` untouched | | Restore: `rclone cat … | gunzip | psql` into an empty database | 500 rows, same checksum as the source | The S3 server was `adobe/s3mock`, not UpCloud, so what is still unproven is rclone against UpCloud Object Storage with the app's credentials. The Gitea job does that with the same settings. **ai-review finding O1-F1 (restore runbook still used the mc image): fixed.** `RESTORE.md` now lists and downloads with `rclone/rclone:1.75.2` and the same env-var remote as the job, the placeholder single-pod variant is gone, and the `mc mirror` example is `rclone sync`. The `rclone lsl` / `rclone cat` commands are the ones from the local test; the `kubectl run … --overrides` wrappers around them have not been run in the cluster. Not changed (pre-existing, from the review): `|| true` on the prune, no `activeDeadlineSeconds`. The second one matters more than it looks: the current job has been stuck in `ImagePullBackOff` for a day and blocks the following nights (`concurrencyPolicy: Forbid`). Say if you want it in this PR. After merge the stuck job `forte-drop-pg-backup-29923320` has to be deleted, or the new spec will not run until it gives up.
jorgen.stensrud requested review from danijel.simeunovic 2026-11-24 11:53:22 +00:00
jorgen.stensrud added 1 commit 2026-11-24 11:53:23 +00:00
The runbook ran its listing and download pods with the mc image that can no
longer be pulled, so the recovery path was broken too. Same image and env-var
remote as the backup job. From the ai-review on the PR.
danijel.simeunovic approved these changes 2026-11-24 15:03:55 +00:00
All checks were successful
scan.yaml / test (pull_request) Successful in 35s
Checking for merge conflicts…
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/forte-drop-pg-backup-rclone:fix/forte-drop-pg-backup-rclone
git checkout fix/forte-drop-pg-backup-rclone
Sign in to join this conversation.