Skip to content

Commit 8f15fa6

Browse files
committed
RHINENG-26546: run backfill job as admin user
1 parent b3e5d7c commit 8f15fa6

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

conf/workspace_backfill.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
LOG_LEVEL=info
22

3-
DB_USER=admin
4-
DB_PASSWD=passwd
5-
63
# Local Docker only: 1000 rows per job run (re-run job until complete). Production uses 50000 via WORKSPACE_BACKFILL_CONFIG.
74
POD_CONFIG=update_users;update_db_config;wait_for_db=empty;use_testing_db;workspace_backfill_batch_size=1000;workspace_backfill_max_rows_per_run=1000

deploy/clowdapp.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,6 @@ objects:
538538
- {name: LOG_LEVEL, value: '${LOG_LEVEL_JOBS}'}
539539
- {name: GIN_MODE, value: '${GIN_MODE}'}
540540
- {name: DB_DEBUG, value: '${DB_DEBUG_JOBS}'}
541-
- {name: DB_USER, value: vmaas_sync}
542-
- {name: DB_PASSWD, valueFrom: {secretKeyRef: {name: patchman-engine-database-passwords,
543-
key: vmaas-sync-database-password}}}
544541
- {name: PROMETHEUS_PUSHGATEWAY,value: '${PROMETHEUS_PUSHGATEWAY}'}
545542
- {name: POD_CONFIG, value: '${WORKSPACE_BACKFILL_CONFIG}'}
546543

dev/workspace_backfill.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ docker compose -f docker-compose.workspace-backfill.yml run --rm \
118118
workspace-backfill ./scripts/workspace_backfill_e2e.sh
119119
```
120120

121+
## Database user
122+
123+
The job connects as the **admin** user (`core.ConfigureAdminApp()`), same credentials as migrations (`database.adminUsername` / `adminPassword` from Clowder). That is required for `SET LOCAL session_replication_role = replica` and matches local testing via `cdappconfig.json`.
124+
121125
## Production
122126

123-
CronJob `workspace-backfill` in [`deploy/clowdapp.yaml`](../deploy/clowdapp.yaml) uses `WORKSPACE_BACKFILL_CONFIG` with `workspace_backfill_max_rows_per_run=50000` (suspended by default). Run on a schedule until pending rows are gone.
127+
CronJob `workspace-backfill` in [`deploy/clowdapp.yaml`](../deploy/clowdapp.yaml) uses `WORKSPACE_BACKFILL_CONFIG` with `workspace_backfill_max_rows_per_run=50000` (suspended by default). Run on a schedule until pending rows are gone. Admin DB credentials are provided by the platform (Clowder), not component secrets.

tasks/workspace_backfill/workspace_backfill.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ workspace_id IS NULL
5757
AND NOT (` + validWorkspacesJSONPredicate + `)`
5858

5959
func configure() {
60-
core.ConfigureApp()
60+
// Admin DB user (same as migrations): UPDATE on partitions and session_replication_role = replica.
61+
core.ConfigureAdminApp()
6162
}
6263

6364
// RunWorkspaceBackfill runs the batched workspace_id / workspace_name backfill job.

0 commit comments

Comments
 (0)