You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6823a5e
Browse filesBrowse the repository at this point in the historyBrowse files
docs(tenant-resource-metrics-api): resolve the open questions into decisions
Close each previously-open design point with a decision or a reasoned recommendation: rest.Connecter handler, raw PromQL passthrough with forced extra_filters, store selection by retention fit, GET-only, metrics-read coupled to app-read, tenant-wide aggregate deferred as a Tenant subresource, OIDC stated as a prerequisite, guest clusters out of scope.
Assisted-by: LLM
Signed-off-by: IvanHunters <[email protected]>
Copy file name to clipboardExpand all lines: design-proposals/tenant-resource-metrics-api/README.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,14 +169,16 @@ The real underlying work is proper per-tenant isolation of the metrics store. Co
169
169
170
170
## Open questions
171
171
172
-
- Handler mechanism: `rest.Connecter` (reverse-proxy, GET/POST, arbitrary body, closest to a passthrough) versus `GetterWithOptions` + `ResourceStreamer` (as the portal does); confirm the `Connecter` wiring works cleanly in `cozystack-api`'s assembler.
173
-
- Tenant-wide aggregate ("all my databases"): a top-level resource with the portal's `list` field-selector trick, or a `metrics` subresource on `Tenant`?
174
-
- Raw PromQL passthrough with cost limits, versus a small server-side allowlist of queries for tighter cost control.
175
-
- Which store to query for a given range when a tenant has both shortterm and longterm VMClusters.
176
-
- Prerequisite to confirm: the Layer 1 group-based authz assumes the management apiserver has OIDC enabled with a flat `groups` claim and no `oidc-groups-prefix` (set out-of-band via talm, the same assumption the existing tenant RBAC relies on); define the behavior on a cluster with a prefix or without OIDC.
177
-
- Request method: the normative path is GET (RBAC verb `get`); a POST query, common for large PromQL, maps to verb `create` on `<plural>/metrics` and would need a separate grant and authz, so the first cut restricts the proxy to GET.
178
-
- Whether metrics-read should be gateable separately from app-read: today it inherits the existing `apps.cozystack.io` wildcard `get` grant, so it cannot be gated independently without narrowing that wildcard.
179
-
- Confirm the guest-cluster (Kamaji) exclusion is acceptable, or scope a follow-up.
172
+
The points previously open are resolved below, as decisions, or as recommendations where the implementation will confirm the detail.
173
+
174
+
-**Handler mechanism: decided `rest.Connecter`.** The goal is a native Prometheus passthrough (GET, forward the `api/v1/query_range` tail, return the backend body unchanged), which is exactly what `Connecter` (the `pods/proxy` pattern) does. `GetterWithOptions` + `ResourceStreamer` is for a single self-produced stream, the right tool for logs, not for proxying a request and its response.
175
+
-**Tenant-wide aggregate ("all my databases"): deferred, as a `Tenant` subresource.** The first cut is per-object only. A tenant-wide view is a follow-up implemented as a `metrics` subresource on the `Tenant` (also `apps.cozystack.io`), which keeps the free RBAC and avoids the `list` field-selector quirk; a top-level resource is rejected for losing both.
176
+
-**Raw PromQL versus an allowlist: decided raw passthrough.** The forced `extra_filters` makes raw PromQL isolation-safe, and the query-cost limits plus the endpoint allowlist handle abuse; a query allowlist would cripple the dashboard for no isolation gain.
177
+
-**Store selection by range: decided by retention fit.** Route to the shortterm store when the whole requested range fits its retention (fresher, higher resolution), otherwise to longterm; default to shortterm for live graphs, since dashboards mostly show recent windows.
178
+
-**Request method: decided GET only.** GET maps to the verb `get` that the existing grant already covers. A POST path (verb `create`, for very large PromQL that overflows a URL) is deferred and would get its own explicit grant if the URL limit ever bites.
179
+
-**Separate gating of metrics-read: decided no, coupled to app-read.** "Can read the resource" implies "can read its consumption", the sensible default, and it needs zero new RBAC; gating separately would require narrowing the existing `apps.cozystack.io` wildcard, a larger change left out of scope.
180
+
-**OIDC: a stated prerequisite, not an open point.** The feature requires the management apiserver OIDC configured with a flat `groups` claim and no `oidc-groups-prefix`, the same assumption the existing tenant RBAC already depends on; where that does not hold, tenant RBAC itself does not work, so there is no additional behavior to define.
181
+
-**Guest clusters (Kamaji): decided out of scope.** Guest-internal resources use a per-user email RBAC model, a different authz path; a dedicated follow-up can address them.
0 commit comments