From 1bb17e204a28bd19c251770356767b98f8ab959f Mon Sep 17 00:00:00 2001 From: Antigravity Date: Thu, 21 May 2026 16:33:24 -0400 Subject: [PATCH] refactor: extract gumbo schema migration to ArgoCD PreSync job --- agents/gumbo/gumbo/temporal/activities.py | 12 +------- agents/k8s/gumbo-schema-init.yaml | 35 +++++++++++++++++++++++ agents/k8s/kustomization.yaml | 1 + 3 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 agents/k8s/gumbo-schema-init.yaml diff --git a/agents/gumbo/gumbo/temporal/activities.py b/agents/gumbo/gumbo/temporal/activities.py index c08943f..c4dca01 100644 --- a/agents/gumbo/gumbo/temporal/activities.py +++ b/agents/gumbo/gumbo/temporal/activities.py @@ -23,17 +23,7 @@ async def persist_gumbo_summary(payload: dict[str, Any]) -> None: conn = await psycopg.AsyncConnection.connect(dsn) try: async with conn.cursor() as cur: - await cur.execute( - """ - CREATE TABLE IF NOT EXISTS gumbo_summaries ( - id bigserial PRIMARY KEY, - workflow_id text NOT NULL, - object_key text NOT NULL, - summary text NOT NULL, - created_at timestamptz NOT NULL DEFAULT now() - ); - """ - ) + await cur.execute( """ INSERT INTO gumbo_summaries (workflow_id, object_key, summary) diff --git a/agents/k8s/gumbo-schema-init.yaml b/agents/k8s/gumbo-schema-init.yaml new file mode 100644 index 0000000..2a39bfa --- /dev/null +++ b/agents/k8s/gumbo-schema-init.yaml @@ -0,0 +1,35 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: gumbo-schema-init + namespace: ai-agents-gumbo + annotations: + argocd.argoproj.io/hook: PreSync + argocd.argoproj.io/hook-delete-policy: HookSucceeded +spec: + template: + spec: + restartPolicy: OnFailure + containers: + - name: schema-init + image: postgres:16-alpine + command: + - sh + - -c + - | + psql "$PGURL" -c " + CREATE TABLE IF NOT EXISTS gumbo_summaries ( + id bigserial PRIMARY KEY, + workflow_id text NOT NULL, + object_key text NOT NULL, + summary text NOT NULL, + created_at timestamptz NOT NULL DEFAULT now() + );" + env: + - name: PGURL + valueFrom: + secretKeyRef: + name: gumbo-results-db + key: dsn + - name: PGDATABASE + value: gumbo diff --git a/agents/k8s/kustomization.yaml b/agents/k8s/kustomization.yaml index 21184bd..063e000 100644 --- a/agents/k8s/kustomization.yaml +++ b/agents/k8s/kustomization.yaml @@ -4,3 +4,4 @@ resources: - gumbo-externalsecrets.yaml - gumbo-job-template.yaml - static-demo.yaml + - gumbo-schema-init.yaml