Files
agentmon/deploy/k8s/base/db/postgres-init-job.yaml
William Valentin 256b841cbf feat: scaffold agentmon services and k8s deploy
Adds Go microservices (ingest-gateway, event-processor, query-api, web-ui), NATS+Postgres wiring, initial schema/init job, ingress manifests for LAN+tailnet, and a multi-arch image build script.
2026-01-17 01:06:57 -08:00

59 lines
1.5 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-init-sql
namespace: agentmon
data:
init.sql: |
-- applied by init job
create table if not exists events (
event_id text primary key,
ts timestamptz not null,
type text not null,
session_id text null,
run_id text null,
trace_id text null,
span_id text null,
parent_span_id text null,
source_framework text null,
client_id text null,
payload jsonb not null
);
create index if not exists events_ts_idx on events (ts);
create index if not exists events_session_idx on events (session_id);
create index if not exists events_run_idx on events (run_id);
create index if not exists events_type_ts_idx on events (type, ts);
---
apiVersion: batch/v1
kind: Job
metadata:
name: postgres-init
namespace: agentmon
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: psql
image: postgres:16
env:
- name: PGPASSWORD
value: agentmon
command:
- bash
- -lc
- |
until pg_isready -h postgres -p 5432 -U agentmon; do
echo "waiting for postgres";
sleep 2;
done
psql -h postgres -p 5432 -U agentmon -d agentmon -f /sql/init.sql
volumeMounts:
- name: sql
mountPath: /sql
volumes:
- name: sql
configMap:
name: postgres-init-sql