Skip to content

Commit 1970364

Browse files
committed
chore(monitoring): move OIDC schema source to packages/extra + regenerate
The Monitoring public API surface (openAPISchema in monitoring-rd cozyrds) is generated from packages/extra/monitoring/values.yaml by cozyvalues-gen + hack/update-crd.sh — the foundation commit (1862390) instead wrote it by hand in packages/system/monitoring-rd/cozyrds/monitoring.yaml, which the pre-commit hook then reverts against every push. Move the oidc annotations into packages/extra/monitoring/values.yaml (matching the pattern used by the rest of the top-level fields) and run `make generate` in that directory. That regenerates: - packages/extra/monitoring/values.schema.json - packages/extra/monitoring/README.md - packages/system/monitoring-rd/cozyrds/monitoring.yaml (openAPISchema + keysOrder, both including the new oidc keys) No behaviour change — the values.yaml under packages/system/monitoring still carries the same oidc defaults so `helm template` works stand-alone, and helm-unittest keeps passing (22/22). Signed-off-by: Ivan Okhotnikov <[email protected]>
1 parent ddfebeb commit 1970364

4 files changed

Lines changed: 88 additions & 1 deletion

File tree

‎packages/extra/monitoring/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,15 @@
101101
| `vmagent.externalLabels` | External labels applied to all metrics. | `object` | `{}` |
102102
| `vmagent.remoteWrite` | Remote write configuration. | `object` | `{}` |
103103

104+
105+
### OIDC authentication
106+
107+
| Name | Description | Type | Value |
108+
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------ |
109+
| `oidc` | OIDC authentication for the Grafana instance. See docs/oidc-grafana.md for the operator guide. | `object` | `{}` |
110+
| `oidc.mode` | Identity mode. `None`: no OIDC, only the `grafana-admin-password` Secret works. `System`: trust the platform `cozy` realm via a per-instance confidential client and audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path. | `string` | `None` |
111+
| `oidc.customConfig` | Tenant-supplied `[auth.generic_oauth]` payload; consumed only when `mode: CustomConfig`. | `object` | `{}` |
112+
| `oidc.customConfig.config` | Inline map of `[auth.generic_oauth]` keys. Written verbatim into the Grafana CR `spec.config`. Mutually exclusive with `secretRef.name`. | `object` | `{}` |
113+
| `oidc.customConfig.secretRef` | Reference to a Secret holding an `auth.ini` fragment; mounted under `/etc/grafana/oidc` and loaded via `GF_PATHS_CUSTOM_INI`. | `object` | `{}` |
114+
| `oidc.customConfig.secretRef.name` | Name of an existing Secret in the release namespace whose `auth.ini` key holds a ready-made `[auth.generic_oauth]` block. Mutually exclusive with `customConfig.config`. | `string` | `""` |
115+

‎packages/extra/monitoring/values.schema.json‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,50 @@
595595
}
596596
}
597597
}
598+
},
599+
"oidc": {
600+
"description": "OIDC authentication for the Grafana instance. See docs/oidc-grafana.md for the operator guide.",
601+
"type": "object",
602+
"default": {},
603+
"required": [
604+
"mode"
605+
],
606+
"properties": {
607+
"customConfig": {
608+
"description": "Tenant-supplied `[auth.generic_oauth]` payload; consumed only when `mode: CustomConfig`.",
609+
"type": "object",
610+
"default": {},
611+
"properties": {
612+
"config": {
613+
"description": "Inline map of `[auth.generic_oauth]` keys. Written verbatim into the Grafana CR `spec.config`. Mutually exclusive with `secretRef.name`.",
614+
"type": "object",
615+
"default": {}
616+
},
617+
"secretRef": {
618+
"description": "Reference to a Secret holding an `auth.ini` fragment; mounted under `/etc/grafana/oidc` and loaded via `GF_PATHS_CUSTOM_INI`.",
619+
"type": "object",
620+
"default": {},
621+
"properties": {
622+
"name": {
623+
"description": "Name of an existing Secret in the release namespace whose `auth.ini` key holds a ready-made `[auth.generic_oauth]` block. Mutually exclusive with `customConfig.config`.",
624+
"type": "string",
625+
"default": ""
626+
}
627+
}
628+
}
629+
}
630+
},
631+
"mode": {
632+
"description": "Identity mode. `None`: no OIDC, only the `grafana-admin-password` Secret works. `System`: trust the platform `cozy` realm via a per-instance confidential client and audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.",
633+
"type": "string",
634+
"default": "None",
635+
"enum": [
636+
"None",
637+
"System",
638+
"CustomConfig"
639+
]
640+
}
641+
}
598642
}
599643
}
600644
}

‎packages/extra/monitoring/values.yaml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,34 @@ vmagent:
182182
## - job_name: "custom"
183183
## static_configs:
184184
## - targets: ["my-service:9090"]
185+
186+
##
187+
## @section OIDC authentication
188+
##
189+
190+
## @enum {string} OIDCMode - Identity mode for the Grafana instance.
191+
## @value None
192+
## @value System
193+
## @value CustomConfig
194+
195+
## @typedef {struct} OIDCSecretRef - Reference to a Secret carrying an `[auth.generic_oauth]` ini fragment.
196+
## @field {string} [name] - Name of an existing Secret in the release namespace whose `auth.ini` key holds a ready-made `[auth.generic_oauth]` block. Mutually exclusive with `customConfig.config`.
197+
198+
## @typedef {struct} OIDCCustomConfigInline - Inline map of grafana.ini `[auth.generic_oauth]` keys.
199+
## @field {string} [<key>] - Value for the generic_oauth key (e.g. `client_id`, `client_secret`, `auth_url`, `token_url`, `api_url`, `scopes`, `role_attribute_path`).
200+
201+
## @typedef {struct} OIDCCustomConfig - Tenant-supplied AuthN payload; consumed only when `mode: CustomConfig`. Exactly one of `config` or `secretRef.name` must be set.
202+
## @field {OIDCCustomConfigInline} [config] - Inline map of `[auth.generic_oauth]` keys. Written verbatim into the Grafana CR `spec.config`. Mutually exclusive with `secretRef.name`.
203+
## @field {OIDCSecretRef} [secretRef] - Reference to a Secret holding an `auth.ini` fragment; mounted under `/etc/grafana/oidc` and loaded via `GF_PATHS_CUSTOM_INI`.
204+
205+
## @typedef {struct} OIDC - OIDC selector for the Grafana instance (Phase 1 — per-instance audience binding; no per-tenant Keycloak realm).
206+
## @field {OIDCMode} mode - Identity mode. `None`: no OIDC, only the `grafana-admin-password` Secret works. `System`: trust the platform `cozy` realm via a per-instance confidential client and audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.
207+
## @field {OIDCCustomConfig} [customConfig] - Tenant-supplied `[auth.generic_oauth]` payload; consumed only when `mode: CustomConfig`.
208+
209+
## @param {OIDC} oidc - OIDC authentication for the Grafana instance. See docs/oidc-grafana.md for the operator guide.
210+
oidc:
211+
mode: "None"
212+
customConfig:
213+
config: {}
214+
secretRef:
215+
name: ""

0 commit comments

Comments
 (0)