Skip to content

Commit cd392d2

Browse files
committed
docs(monitoring): correct the release name the OIDC comment, guide and test fixture encode
The naming block in _helpers.tpl, the guide's opening paragraph and the oidc test fixture all describe the per-tenant Grafana as the release `monitoring`. Both instances are released as `monitoring-system` by the monitoring application and differ only by namespace: the platform one in `tenant-root`, a per-tenant one in each tenant namespace. Assisted-By: Claude <[email protected]> Signed-off-by: youdie006 <[email protected]>
1 parent 0592d0e commit cd392d2

3 files changed

Lines changed: 15 additions & 20 deletions

File tree

‎docs/oidc-grafana.md‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
# OIDC for the Grafana instance (Phase 1)
22

3-
Cozystack ships one Grafana codebase deployed twice: as
4-
`monitoring-system` in the platform's `cozy-monitoring` namespace and as
5-
`monitoring` in every tenant namespace. Both instances opt in to OIDC
6-
authentication through the same flat selector on the `Monitoring` CR.
7-
This document covers the operator-facing surface: what the modes mean,
8-
what the chart provisions, and how a user signs in.
3+
Cozystack ships one Grafana codebase deployed twice, both released as `monitoring-system` and differing only by namespace: the platform instance runs in `tenant-root` and a per-tenant instance runs in every tenant namespace. Both instances opt in to OIDC authentication through the same flat selector on the `Monitoring` CR. This document covers the operator-facing surface: what the modes mean, what the chart provisions, and how a user signs in.
94

105
The architectural rationale lives in
116
[cozystack/community#24](https://github.com/cozystack/community/pull/24)

‎packages/system/monitoring/templates/_helpers.tpl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
Naming — the identity unit is the Monitoring release, so the clientId
55
and the audience scope are `<namespace>-<release>` prefixed. That
66
gives:
7-
tenant-foo/monitoring (per-tenant Grafana in tenant-foo ns)
8-
cozy-monitoring/monitoring-system (platform Grafana in cozy-monitoring ns)
7+
tenant-foo/monitoring-system (per-tenant Grafana in tenant-foo ns)
8+
tenant-root/monitoring-system (platform Grafana in the tenant-root ns)
99
A token minted for one instance is rejected by the other's Grafana
1010
because the per-cluster audience scope binds `id_token.aud` to the
1111
clientId — same isolation primitive as the tenant kube-apiserver PR

‎packages/system/monitoring/tests/oidc_test.yaml‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ templates:
66
- templates/grafana/grafana.yaml
77

88
release:
9-
name: monitoring
9+
name: monitoring-system
1010
namespace: tenant-root
1111

1212
# Baseline `_cluster` / `_namespace` values wired by cozystack-basics
@@ -159,15 +159,15 @@ tests:
159159
documentIndex: 1
160160
- equal:
161161
path: spec.secret
162-
value: "$monitoring-oidc-client:client-secret"
162+
value: "$monitoring-system-oidc-client:client-secret"
163163
documentIndex: 1
164164
- equal:
165165
path: spec.redirectUris[0]
166166
value: "https://grafana.tenant-root.example.org/login/generic_oauth"
167167
documentIndex: 1
168168
- contains:
169169
path: spec.defaultClientScopes
170-
content: tenant-root-monitoring-audience
170+
content: tenant-root-monitoring-system-audience
171171
documentIndex: 1
172172
# `groups` scope is the platform-managed realm-default that emits
173173
# the caller's Keycloak groups into the token; must be listed
@@ -209,15 +209,15 @@ tests:
209209
asserts:
210210
- equal:
211211
path: metadata.name
212-
value: tenant-root-monitoring-audience
212+
value: tenant-root-monitoring-system-audience
213213
documentIndex: 0
214214
- equal:
215215
path: spec.protocolMappers[0].protocolMapper
216216
value: oidc-audience-mapper
217217
documentIndex: 0
218218
- equal:
219219
path: spec.protocolMappers[0].config["included.client.audience"]
220-
value: tenant-root-monitoring
220+
value: tenant-root-monitoring-system
221221
documentIndex: 0
222222

223223
- it: mode=System persists a random client-secret at install
@@ -233,7 +233,7 @@ tests:
233233
value: Secret
234234
- equal:
235235
path: metadata.name
236-
value: monitoring-oidc-client
236+
value: monitoring-system-oidc-client
237237
# 32 random alphanumeric chars base64-encoded → 44 chars (43 + '=' padding).
238238
- matchRegex:
239239
path: data["client-secret"]
@@ -253,7 +253,7 @@ tests:
253253
value: "true"
254254
- equal:
255255
path: spec.config["auth.generic_oauth"].client_id
256-
value: tenant-root-monitoring
256+
value: tenant-root-monitoring-system
257257
- equal:
258258
path: spec.config["auth.generic_oauth"].client_secret
259259
value: "${GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET}"
@@ -262,7 +262,7 @@ tests:
262262
value: "https://keycloak.example.org/realms/cozy/protocol/openid-connect/auth"
263263
- equal:
264264
path: spec.config["auth.generic_oauth"].scopes
265-
value: "openid email profile groups tenant-root-monitoring-audience"
265+
value: "openid email profile groups tenant-root-monitoring-system-audience"
266266
# Tenant-membership gate — unconditionally emitted in System mode
267267
# (chart-owned, not tied to spec.oidc.users). Rejects logins whose
268268
# token does not carry at least one of the release's tenant-scoped
@@ -338,7 +338,7 @@ tests:
338338
value: "groups"
339339
- equal:
340340
path: spec.config["auth.generic_oauth"].scopes
341-
value: "openid email profile groups tenant-root-monitoring-audience"
341+
value: "openid email profile groups tenant-root-monitoring-system-audience"
342342

343343
- it: mode=System allowed_groups uses the release namespace as tenant prefix (nested tenant)
344344
# Regression guard against a helper regression that would compute
@@ -349,7 +349,7 @@ tests:
349349
# every user of the release on a nested tenant.
350350
template: templates/grafana/grafana.yaml
351351
release:
352-
name: monitoring
352+
name: monitoring-system
353353
namespace: tenant-foo-bar
354354
set:
355355
_cluster:
@@ -388,7 +388,7 @@ tests:
388388
name: GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET
389389
valueFrom:
390390
secretKeyRef:
391-
name: monitoring-oidc-client
391+
name: monitoring-system-oidc-client
392392
key: client-secret
393393

394394
- it: mode=System keeps disable_login_form false so admin creds stay a break-glass path
@@ -419,7 +419,7 @@ tests:
419419
value: Job
420420
- equal:
421421
path: metadata.name
422-
value: monitoring-oidc-users
422+
value: monitoring-system-oidc-users
423423
- equal:
424424
path: metadata.annotations["helm.sh/hook"]
425425
value: post-install,post-upgrade

0 commit comments

Comments
 (0)