From 5a439bd99ed8c0627bd7717bf7815803feaff391 Mon Sep 17 00:00:00 2001
From: CalebSargeant <4991715+CalebSargeant@users.noreply.github.com>
Date: Fri, 23 Oct 2026 16:43:39 +0200
Subject: [PATCH 1/8] feat: snapshot, restore and clone CloudNativePG databases
Each action is a Job in the database's namespace that connects as the owner role; a production restore waits for a second person. The chart's admission policy keeps those Jobs to what the server builds.
---
.dockerignore | 13 +
.github/workflows/ci.yml | 133 ++
CLAUDE.md | 33 +
Dockerfile | 53 +
README.md | 247 +++-
charts/databases-ui/.helmignore | 4 +
charts/databases-ui/Chart.yaml | 36 +
charts/databases-ui/ci/default-values.yaml | 51 +
charts/databases-ui/ci/sas-values.yaml | 16 +
charts/databases-ui/templates/NOTES.txt | 17 +
charts/databases-ui/templates/_helpers.tpl | 153 ++
charts/databases-ui/templates/configmap.yaml | 12 +
charts/databases-ui/templates/deployment.yaml | 165 +++
charts/databases-ui/templates/ingress.yaml | 34 +
charts/databases-ui/templates/jobpolicy.yaml | 82 ++
.../databases-ui/templates/networkpolicy.yaml | 55 +
charts/databases-ui/templates/pdb.yaml | 14 +
charts/databases-ui/templates/rbac.yaml | 119 ++
charts/databases-ui/templates/secret.yaml | 15 +
charts/databases-ui/templates/service.yaml | 16 +
.../templates/serviceaccount.yaml | 15 +
charts/databases-ui/values.yaml | 153 ++
docker-bake.hcl | 33 +
e2e/fixtures.yaml | 193 +++
e2e/run.py | 401 +++++
examples/catalog.yaml | 44 +
frontend/index.html | 15 +
frontend/package-lock.json | 1295 +++++++++++++++++
frontend/package.json | 22 +
frontend/public/favicon.svg | 1 +
frontend/public/theme.css | 1 +
frontend/src/App.tsx | 229 +++
frontend/src/api.ts | 123 ++
frontend/src/components/Dialog.tsx | 60 +
frontend/src/components/Menu.tsx | 52 +
frontend/src/components/ui.tsx | 52 +
frontend/src/format.ts | 34 +
frontend/src/main.tsx | 10 +
frontend/src/styles.css | 863 +++++++++++
frontend/src/views/Activity.tsx | 132 ++
frontend/src/views/Audit.tsx | 70 +
frontend/src/views/DatabaseView.tsx | 364 +++++
frontend/src/views/Databases.tsx | 63 +
frontend/tsconfig.json | 17 +
frontend/vite.config.ts | 14 +
pyproject.toml | 30 +
src/databases_ui/__init__.py | 1 +
src/databases_ui/__main__.py | 90 ++
src/databases_ui/app.py | 352 +++++
src/databases_ui/audit.py | 43 +
src/databases_ui/blob.py | 168 +++
src/databases_ui/catalog.py | 224 +++
src/databases_ui/config.py | 204 +++
src/databases_ui/entra.py | 107 ++
src/databases_ui/jobs.py | 188 +++
src/databases_ui/kube.py | 91 ++
src/databases_ui/oidc.py | 167 +++
src/databases_ui/runner.py | 228 +++
src/databases_ui/service.py | 393 +++++
src/databases_ui/session.py | 99 ++
tests/conftest.py | 366 +++++
tests/test_api.py | 327 +++++
tests/test_auth.py | 73 +
tests/test_catalog.py | 68 +
tests/test_config.py | 69 +
tests/test_runner.py | 149 ++
uv.lock | 733 ++++++++++
67 files changed, 9693 insertions(+), 1 deletion(-)
create mode 100644 .dockerignore
create mode 100644 .github/workflows/ci.yml
create mode 100644 CLAUDE.md
create mode 100644 Dockerfile
create mode 100644 charts/databases-ui/.helmignore
create mode 100644 charts/databases-ui/Chart.yaml
create mode 100644 charts/databases-ui/ci/default-values.yaml
create mode 100644 charts/databases-ui/ci/sas-values.yaml
create mode 100644 charts/databases-ui/templates/NOTES.txt
create mode 100644 charts/databases-ui/templates/_helpers.tpl
create mode 100644 charts/databases-ui/templates/configmap.yaml
create mode 100644 charts/databases-ui/templates/deployment.yaml
create mode 100644 charts/databases-ui/templates/ingress.yaml
create mode 100644 charts/databases-ui/templates/jobpolicy.yaml
create mode 100644 charts/databases-ui/templates/networkpolicy.yaml
create mode 100644 charts/databases-ui/templates/pdb.yaml
create mode 100644 charts/databases-ui/templates/rbac.yaml
create mode 100644 charts/databases-ui/templates/secret.yaml
create mode 100644 charts/databases-ui/templates/service.yaml
create mode 100644 charts/databases-ui/templates/serviceaccount.yaml
create mode 100644 charts/databases-ui/values.yaml
create mode 100644 docker-bake.hcl
create mode 100644 e2e/fixtures.yaml
create mode 100644 e2e/run.py
create mode 100644 examples/catalog.yaml
create mode 100644 frontend/index.html
create mode 100644 frontend/package-lock.json
create mode 100644 frontend/package.json
create mode 100644 frontend/public/favicon.svg
create mode 100644 frontend/public/theme.css
create mode 100644 frontend/src/App.tsx
create mode 100644 frontend/src/api.ts
create mode 100644 frontend/src/components/Dialog.tsx
create mode 100644 frontend/src/components/Menu.tsx
create mode 100644 frontend/src/components/ui.tsx
create mode 100644 frontend/src/format.ts
create mode 100644 frontend/src/main.tsx
create mode 100644 frontend/src/styles.css
create mode 100644 frontend/src/views/Activity.tsx
create mode 100644 frontend/src/views/Audit.tsx
create mode 100644 frontend/src/views/DatabaseView.tsx
create mode 100644 frontend/src/views/Databases.tsx
create mode 100644 frontend/tsconfig.json
create mode 100644 frontend/vite.config.ts
create mode 100644 pyproject.toml
create mode 100644 src/databases_ui/__init__.py
create mode 100644 src/databases_ui/__main__.py
create mode 100644 src/databases_ui/app.py
create mode 100644 src/databases_ui/audit.py
create mode 100644 src/databases_ui/blob.py
create mode 100644 src/databases_ui/catalog.py
create mode 100644 src/databases_ui/config.py
create mode 100644 src/databases_ui/entra.py
create mode 100644 src/databases_ui/jobs.py
create mode 100644 src/databases_ui/kube.py
create mode 100644 src/databases_ui/oidc.py
create mode 100644 src/databases_ui/runner.py
create mode 100644 src/databases_ui/service.py
create mode 100644 src/databases_ui/session.py
create mode 100644 tests/conftest.py
create mode 100644 tests/test_api.py
create mode 100644 tests/test_auth.py
create mode 100644 tests/test_catalog.py
create mode 100644 tests/test_config.py
create mode 100644 tests/test_runner.py
create mode 100644 uv.lock
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..6238be4
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,13 @@
+.git
+.github
+.venv
+.pytest_cache
+.coverage
+**/__pycache__
+tests
+e2e
+examples
+charts
+docker-bake.hcl
+frontend/node_modules
+frontend/dist
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..1a28f7d
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,133 @@
+# Backend tests, the frontend's typecheck and build, the chart's lint and schema checks, the
+# example catalog, and the whole thing end to end on a kind cluster with CloudNativePG.
+#
+# Its own file, not a step in release.yml, security.yml or quality.yml: those are rewritten
+# from org-wide templates by Caldrith provisioning.
+#
+# All actions are SHA-pinned; the trailing comment is the tag each SHA corresponds to.
+name: CI
+
+on:
+ pull_request:
+ push:
+ branches: [main]
+ paths-ignore: ['**/*.md', 'LICENSE', '.gitignore']
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ backend:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
+ with:
+ python-version: '3.12'
+ - run: uv sync --locked
+ - run: uv run pytest -q
+
+ frontend:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
+ with:
+ node-version: '24'
+ cache: npm
+ cache-dependency-path: frontend/package-lock.json
+ - name: Typecheck and build
+ working-directory: frontend
+ run: |
+ npm ci --ignore-scripts --no-audit --no-fund
+ npm run build
+ # The CSP allows no inline script or style, so the built page must carry none.
+ - name: No inline code in the page
+ run: |
+ set -euo pipefail
+ if grep -qE '|