mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 10:13:58 +00:00
Bringing the long-running session-feature branch back into main in one deliberate sweep. The branch carried the cluster work that's been live for weeks (cross-cluster CNPG metrics, Grafana w/ Google OAuth, supabase oauth2-proxy, cluster recovery, pg.0.knoe.dev + per-engineer onboarding, GCS-backed CNPG backups via Workload Identity, the env-contamination guard, the Junie brief queue, the cnpg-grafana CSRF + memory-request fixes from today), while main accumulated Junie's parallel knoe-auth Phase 2 OIDC work (full provider surface: discovery, authorize, token, userinfo, JWKS, RS256 signing, code exchange, session services). Key decision: the two branches did COMPETING rebrands off the same starting point (5ba9b63, 2026-04-27): - claude branch (commit b355855, earlier): org.prole.authority.* → dev.knoe.auth.* (artifact renamed to knoe-auth.jar) - main (commit9daa94b, recent): org.prole.authority.* → dev.knoe.authority.* (kept "authority" artifact name) dev.knoe.auth wins: cluster runs from this name, the Maven artifact is already knoe-auth.jar, and the broader rename is the documented namespace direction (per ~/.claude/projects/-Users-chrisfu-dev-knoe-db/ memory/MEMORY.md). All of main's recent Phase 2 OIDC content was ported from authority/src/.../dev/knoe/authority/ into authority/src/.../dev/knoe/auth/ with package declarations rewritten. == File-level resolution summary == Textual conflicts (4): authority/pom.xml - Took our artifactId="auth" - Took our branch's removal of spring-security-kerberos-client (verified: Junie's Phase 2 OIDC code does not import it; the dep was already-dead config) docs/pipeline-phases.md - Took our branch's "Phase 1 not started" status. Main had a misplaced "✅ Complete" with a knoe-auth-Phase-1 commit ref in the autobuild Phase 1 section — different domain. docs/plans/knoe-auth-round-1.md - Took our branch's dev.knoe.auth file table (vs main's dev.knoe.authority listing). Pure rename mismatch. supabase/helm/knoe-supabase/templates/kong/config.yaml - Took our branch's onboard route + plain dashboard wiring. Main had an oauth2proxy.enabled toggle that put oauth2-proxy as a Kong upstream — but the deployed architecture (commit 25f1b2e) has oauth2-proxy in FRONT of Kong, not behind. Main's wrapper reflected an architecture that was never deployed. - Took our branch's removal of basic-auth from dashboard route (queue #15 brief still tracks the matching values.yaml / kong/deployment.yaml cleanup). Java tree reconciliation (44 file-pairs): 20 dual-path source files + 2 dual-path tests Body-identical between main's authority/ and our branch's auth/ after stripping package decls — main's commit9daa94bwas a pure rebrand. Took our branch's auth/ version for all 22. 8 main-only source files (Phase 2 OIDC), ported into auth/: web/JwksController.java web/OidcAuthorizeController.java web/OidcDiscoveryController.java web/OidcTokenController.java web/OidcUserInfoController.java session/OidcCodeService.java session/OidcTokenService.java session/SessionService.java 12 main-only test files, ported into auth/: HealthControllerTest.java enroll/EnrollValueTypesTest.java enroll/EnrollmentControllerTest.java enroll/TotpServiceTest.java kerberos/KadminClientTest.java kerberos/KerberosSpnegoResultTest.java web/LoginControllerTest.java admin/AdminControllerTest.java user/PrincipalNormalizerTest.java regression/IdentityRegressionTest.java session/OidcCodeServiceTest.java session/SessionServiceTest.java Port mechanics: read main:authority/...<file> via git show, then sed rewrite `package dev.knoe.authority` → `package dev.knoe.auth` and `import dev.knoe.authority` → `import dev.knoe.auth`. Body content unchanged. authority/src/main/java/dev/knoe/authority/ — DELETED (duplicate) authority/src/test/java/dev/knoe/authority/ — DELETED (duplicate) == Verification == - grep -rln '<<<<<<<' across .java/.md/.yaml/.yml/.sh/.xml/.tpl: clean - find authority/src -path '*/dev/knoe/authority*': empty (subtree gone) - grep 'package dev.knoe.authority' across repo: clean - bash -n install.sh deploy.sh etc/preflight_kubecontext.sh: clean - git ls-files -u | wc -l: 0 unmerged paths - helm lint supabase/helm/knoe-supabase: pre-existing failure on studioIngress.enabled undefined in values.yaml (introduced by Junie on main; unrelated to this merge — flagging as follow-up). == Followups (carried into TODO ranked queue or noted here) == - helm lint failure: studioIngress block in values.yaml is missing enable flag; templates/studio/{ingress,oauth2proxy-deployment, oauth2proxy-service}.yaml all reference studioIngress.enabled with no default. Pre-existing on main; not introduced by this merge. - The five Junie briefs filed on this branch are now reachable from main at docs/plans/junie/{02,06,07,13,15}-*.md. Junie can pick them up in any order. - knoe-auth Phase 2 OIDC source (now at dev.knoe.auth.*) is not yet deployed to the cluster. Deployment is its own task. - The branch claude/crazy-bose-fec256 stays in place (worktree at .claude/worktrees/crazy-bose-fec256 may have ongoing context for Claude Code sessions). Safe to delete once next session starts cleanly from main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
102 lines
5.3 KiB
YAML
102 lines
5.3 KiB
YAML
# Transform spec for the upstream cloudnative-pg Grafana dashboard.
|
|
#
|
|
# Re-applied on every run of `etc/sync_cnpg_grafana_dashboard.py`. The script
|
|
# fetches the upstream JSON, walks `transformations` in order, writes the
|
|
# result to `knoe-db/grafana-dashboard.json` (which is what
|
|
# `etc/init_monitoring.sh` packages into the
|
|
# `knoe-db-grafana-dashboard` ConfigMap on the app cluster).
|
|
#
|
|
# When upstream releases a new version of the dashboard, the workflow is:
|
|
#
|
|
# 1. Re-run the sync tool (any branch — runs in CI or as a background
|
|
# agent on its own schedule).
|
|
# 2. The tool fetches the new upstream, applies these transforms, and
|
|
# either writes the result + opens a diff/PR (default), OR applies
|
|
# to the live cluster directly (--apply).
|
|
# 3. If a transformation no longer matches (e.g. upstream renamed a key
|
|
# or removed a panel that we were patching), the tool emits a warning
|
|
# with the affected transformation's `name`. Update or remove that
|
|
# transformation entry here, re-run.
|
|
#
|
|
# Adding a new transformation: append to `transformations`. Each entry has
|
|
# a `name`, `description`, `type`, and per-type parameters. Currently
|
|
# supported types:
|
|
#
|
|
# - `regex_replace`: sed-style on the raw JSON string.
|
|
# pattern: <python regex> # use named groups for capture refs
|
|
# replacement: <python regex repl, supports \g<name>>
|
|
# expected_min: <int> # tool warns if fewer matches than this
|
|
# expected_max: <int> # tool warns if more matches than this
|
|
#
|
|
# Future types we may add:
|
|
#
|
|
# - `jsonpatch`: RFC 6902 operations against the parsed JSON tree
|
|
# - `panel_query_rewrite`: navigate `panels[*].targets[*].expr` specifically
|
|
#
|
|
# The current set is deliberately tiny — most of the cross-cluster CNPG
|
|
# observability stack is fixed via cluster-side config (Cluster.spec.monitoring
|
|
# podMonitorRelabelings, kps grafana.ini settings) rather than dashboard
|
|
# edits. Only edits that MUST live in the dashboard JSON go here.
|
|
|
|
source:
|
|
# Pinned to `main` because the upstream repo's dashboard versioning is loose.
|
|
# If reproducibility against a specific revision is needed, swap `main` for
|
|
# a commit SHA or release tag.
|
|
url: https://raw.githubusercontent.com/cloudnative-pg/grafana-dashboards/main/charts/cluster/grafana-dashboard.json
|
|
|
|
# The expected dashboard `uid` field. The tool will refuse to proceed if the
|
|
# upstream has changed UID (would silently break dashboard URLs).
|
|
expected_uid: cloudnative-pg
|
|
|
|
transformations:
|
|
|
|
- name: rate_interval_swap
|
|
description: |
|
|
Swap `[$__interval]` for `[$__rate_interval]` inside `rate()` and
|
|
`irate()` calls. Grafana's $__interval auto-shrinks below the scrape
|
|
interval at small dashboard time ranges (e.g. a 5-min view yields
|
|
~1-2s rate windows; our 15s scrape interval means 0 samples in any 2s
|
|
window, so rate() returns nothing). $__rate_interval is the rate-safe
|
|
equivalent that Grafana auto-computes from min step + scrape interval.
|
|
As of upstream commit at sync time, this affects 2 panels.
|
|
type: regex_replace
|
|
pattern: '(?P<fn>rate|irate)\((?P<inner>[^()]*)\[\$__interval\]\)'
|
|
replacement: '\g<fn>(\g<inner>[$__rate_interval])'
|
|
expected_min: 1 # at least one match — if zero, upstream may have switched away from $__interval
|
|
expected_max: 50 # if more than this, something's odd; flag for review
|
|
|
|
- name: ds_prometheus_default_to_cnpg
|
|
description: |
|
|
Pin the dashboard's DS_PROMETHEUS template variable to our
|
|
`cnpg-prometheus` datasource so panels render correctly on first load
|
|
without users needing to override via URL params or the variable picker.
|
|
|
|
Why: upstream ships the dashboard with `current.value: "prometheus"`
|
|
(the upstream-default Prometheus UID). On a kps install, the standard
|
|
Prometheus datasource has uid=prometheus (default), and our DB-cluster
|
|
Prometheus is at uid=cnpg-prometheus (a stable name we set in
|
|
monitoring/kps-values-gke.yaml's `additionalDataSources`). Without
|
|
this transform, the dashboard initially queries the LOCAL prometheus
|
|
(which has no CNPG metrics — they're only on the DB cluster), and
|
|
Grafana's panel-cache + datasource-variable-rerun quirks make it
|
|
hard to recover even after the user changes the picker.
|
|
type: set_template_variable_default
|
|
variable: DS_PROMETHEUS
|
|
# CAVEAT: this UID is the auto-generated one from the FIRST helm install
|
|
# of kps. We pinned `uid: cnpg-prometheus` in monitoring/kps-values-gke.yaml
|
|
# so a fresh helm install would get the stable name, but Grafana refuses
|
|
# to update the UID of an already-provisioned datasource (read-only via
|
|
# API; even rollout-restart doesn't pick it up). On the next clean kps
|
|
# re-install (or after deleting the auto-uid datasource via direct DB
|
|
# manipulation), update both this `value` and `text` to `cnpg-prometheus`.
|
|
# Tracked in docs/TODO.md as a follow-up.
|
|
value: P5531627C358300FE
|
|
text: cnpg-prometheus
|
|
selected: true
|
|
|
|
# (No further transformations needed at time of writing. Dashboard
|
|
# correctness for our cross-cluster setup comes mostly from server-side
|
|
# config: see `monitoring/kps-cnpg-values.yaml`,
|
|
# `monitoring/kps-values-gke.yaml`, and the
|
|
# `spec.monitoring.podMonitorRelabelings` in `deploy/gcp/gke/knoe-db.yaml`.)
|