mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 10:13:58 +00:00
Task 1 — ConfigMap + CNPG wiring:
- Add k8s/knoe/knoe-ekosystem-sql.yaml: ConfigMap embedding ekosystem.sql
and ekosystem_objects.sql for CNPG postInitApplicationSQLRefs
- Add scripts/gen-ekosystem-configmap.py: generation script to keep the
ConfigMap in sync with knoe-db/schema/ekosystem*.sql source files
- Add Makefile target: make k8s/knoe/knoe-ekosystem-sql.yaml
- Wire postInitApplicationSQLRefs into all three CNPG cluster manifests:
k8s/knoe/knoe-db.yaml (k3s / prole-service-context production)
deploy/gcp/gke/knoe-db.yaml (GKE)
deploy/opentofu/k3s/manifests/knoe/knoe-db.yaml (OpenTofu k3s)
- Add knoe-ekosystem-sql.yaml to k8s/knoe/kustomization.yaml
Task 3 — Python counterpart utility:
- Add knoe/ekosystem.py: thread-safe EkosystemID generator matching the
PostgreSQL bit layout [49:ts_ms|12:tenant|10:shard|11:seq], with
decode() and can_access() helpers
- Add tests/test_ekosystem.py: 23 tests covering base36 encoding,
round-trips, thread safety, can_access, and the spec round-trip assertion
Task 4 — knoe.user ekosystem_uuid column:
- Add ALTER TABLE knoe.user ADD COLUMN IF NOT EXISTS ekosystem_uuid text UNIQUE
to postInitSQL in all three CNPG manifests
Task 2 (register prole tenant) requires a live DB connection — manual step.
Task 5 (LDAP/AD reconciler) is design-only per spec.
Co-authored-by: Junie <junie@jetbrains.com>
38 lines
960 B
Python
38 lines
960 B
Python
#!/usr/bin/env python3
|
|
"""Generate k8s/knoe/knoe-ekosystem-sql.yaml from knoe-db/schema/ekosystem*.sql.
|
|
|
|
Run via: make k8s/knoe/knoe-ekosystem-sql.yaml
|
|
"""
|
|
import os
|
|
|
|
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
SCHEMA_DIR = os.path.join(ROOT, "knoe-db", "schema")
|
|
OUT = os.path.join(ROOT, "k8s", "knoe", "knoe-ekosystem-sql.yaml")
|
|
|
|
SQL_FILES = ["ekosystem.sql", "ekosystem_objects.sql"]
|
|
|
|
|
|
def indent(text, spaces=4):
|
|
pad = " " * spaces
|
|
return "\n".join((pad + line) if line else "" for line in text.splitlines())
|
|
|
|
|
|
lines = [
|
|
"apiVersion: v1",
|
|
"kind: ConfigMap",
|
|
"metadata:",
|
|
" name: knoe-ekosystem-sql",
|
|
" namespace: knoe-db",
|
|
"data:",
|
|
]
|
|
|
|
for fname in SQL_FILES:
|
|
sql = open(os.path.join(SCHEMA_DIR, fname)).read()
|
|
lines.append(f" {fname}: |")
|
|
lines.append(indent(sql, 4))
|
|
|
|
with open(OUT, "w") as f:
|
|
f.write("\n".join(lines) + "\n")
|
|
|
|
print(f"Wrote {OUT} ({os.path.getsize(OUT)} bytes)")
|