mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-04 14:12:07 +09:00
Address the two blocking-class findings from the cozy-review pass on
this PR:
(1) Missing PackageSource dependency on cozystack.keycloak-operator
(MAJOR cold-install race).
Without this edge, the monitoring chart can reconcile before the
v1.edp.epam.com CRDs are registered on a fresh cluster — the
`.Capabilities.APIVersions.Has` guard in
templates/grafana/oidc-keycloak.yaml then silently drops all
Keycloak-side objects for mode: System, and Grafana's
auth.generic_oauth block points at a client Keycloak never
provisions. Add the ordering edge, plus a
sources_monitoring_application_dependson_test.yaml regression
guard so a future edit cannot drop it silently.
(2) allow_assign_grafana_admin driven by `.Release.Name ==
monitoring-system` (MINOR fragile coupling).
Replace the release-name sniff with an explicit
`oidc.grafanaAdmin: false` values field, and flip it on for the
platform Grafana release via
Package.spec.components["monitoring-system"].values.oidc.grafanaAdmin
in packages/core/platform/templates/bundles/system.yaml —
mirroring the pattern monitoring-agents already uses for
per-component overrides. Tenant Grafana releases inherit the
chart default false and stay at org-level Admin.
Two new helm-unittest cases in packages/system/monitoring/tests/
lock the values-driven behaviour on both sides
(grafanaAdmin=true → Admin uplift, default → tenant stays at org
Admin), plus bundles_monitoring_grafana_admin_test.yaml in
packages/core/platform/tests/ regression-guards the Package's
component override so the platform release keeps its uplift on
future edits.
Also document the mode-toggle group-membership loss in
docs/oidc-grafana.md — mode: System → CustomConfig/None deletes the
three chart-owned KeycloakRealmGroups; membership is not restored on
toggle-back. Not a bug, but the operator UX cost of the toggle
deserves a bullet in Failure modes.
Regenerated artifacts (cozyvalues-gen + hack/update-crd.sh):
packages/extra/monitoring/values.schema.json
packages/extra/monitoring/README.md
packages/system/monitoring-rd/cozyrds/monitoring.yaml
Test suites still green: packages/system/monitoring 23/23,
packages/core/platform 81/81.
Signed-off-by: Ivan Okhotnikov <xorokhotnikov@gmail.com>
218 lines
8.1 KiB
YAML
218 lines
8.1 KiB
YAML
## @section Common parameters
|
|
##
|
|
|
|
## @param {string} host - The hostname used to access Grafana externally (defaults to 'grafana' subdomain for the tenant host).
|
|
host: ""
|
|
|
|
##
|
|
## @section Metrics storage configuration
|
|
##
|
|
|
|
## @typedef {struct} Request - Minimum guaranteed resources.
|
|
## @field {quantity} [cpu] - CPU request.
|
|
## @field {quantity} [memory] - Memory request.
|
|
|
|
## @typedef {struct} Limit - Maximum allowed resources.
|
|
## @field {quantity} [cpu] - CPU limit.
|
|
## @field {quantity} [memory] - Memory limit.
|
|
|
|
## @typedef {struct} VMComponent - VictoriaMetrics component configuration.
|
|
## @field {Request} [minAllowed] - Minimum guaranteed resources.
|
|
## @field {Limit} [maxAllowed] - Maximum allowed resources.
|
|
|
|
## @typedef {struct} Resources - Combined resource configuration.
|
|
## @field {Request} [requests] - Resource requests.
|
|
## @field {Limit} [limits] - Resource limits.
|
|
|
|
## @typedef {struct} MetricsStorage - Configuration of metrics storage instance.
|
|
## @field {string} name - Name of the storage instance.
|
|
## @field {string} retentionPeriod - Retention period for metrics.
|
|
## @field {string} deduplicationInterval - Deduplication interval for metrics.
|
|
## @field {string} storage="10Gi" - Persistent volume size.
|
|
## @field {string} [storageClassName] - StorageClass used for the data.
|
|
## @field {VMComponent} [vminsert] - Configuration for vminsert.
|
|
## @field {VMComponent} [vmselect] - Configuration for vmselect.
|
|
## @field {VMComponent} [vmstorage] - Configuration for vmstorage.
|
|
|
|
## @param {[]MetricsStorage} metricsStorages - Configuration of metrics storage instances.
|
|
metricsStorages:
|
|
## Example:
|
|
## metricsStorages:
|
|
## - name: shortterm
|
|
## retentionPeriod: "3d"
|
|
## deduplicationInterval: "15s"
|
|
## storage: 10Gi
|
|
## storageClassName: ""
|
|
## vminsert:
|
|
## minAllowed:
|
|
## cpu: 200m
|
|
## memory: 512Mi
|
|
## maxAllowed:
|
|
## cpu: 1500m
|
|
## memory: 3Gi
|
|
## vmselect:
|
|
## minAllowed:
|
|
## cpu: 300m
|
|
## memory: 1Gi
|
|
## maxAllowed:
|
|
## cpu: 3500m
|
|
## memory: 6Gi
|
|
## vmstorage:
|
|
## minAllowed:
|
|
## cpu: 500m
|
|
## memory: 2Gi
|
|
## maxAllowed:
|
|
## cpu: 4000m
|
|
## memory: 8Gi
|
|
- name: shortterm
|
|
retentionPeriod: "3d"
|
|
deduplicationInterval: "15s"
|
|
storage: 10Gi
|
|
storageClassName: ""
|
|
- name: longterm
|
|
retentionPeriod: "14d"
|
|
deduplicationInterval: "5m"
|
|
storage: 10Gi
|
|
storageClassName: ""
|
|
|
|
##
|
|
## @section Logs storage configuration
|
|
##
|
|
|
|
## @typedef {struct} LogsStorage - Configuration of logs storage instance.
|
|
## @field {string} name - Name of the storage instance.
|
|
## @field {string} retentionPeriod="1" - Retention period for logs.
|
|
## @field {string} storage="10Gi" - Persistent volume size.
|
|
## @field {string} storageClassName="replicated" - StorageClass used to store the data.
|
|
|
|
## @param {[]LogsStorage} logsStorages - Configuration of logs storage instances.
|
|
logsStorages:
|
|
- name: generic
|
|
retentionPeriod: "1"
|
|
storage: 10Gi
|
|
storageClassName: replicated
|
|
|
|
##
|
|
## @section Alerta configuration
|
|
##
|
|
|
|
## @typedef {struct} TelegramAlerts - Telegram alert configuration.
|
|
## @field {string} token - Telegram bot token.
|
|
## @field {string} chatID - Telegram chat ID(s), separated by commas.
|
|
## @field {[]string} [disabledSeverity] - List of severities without alerts (e.g. ["informational","warning"]).
|
|
|
|
## @typedef {struct} SlackAlerts - Slack alert configuration.
|
|
## @field {string} url - Configuration uri for Slack alerts.
|
|
## @field {[]string} [disabledSeverity] - List of severities without alerts (e.g. ["informational","warning"]).
|
|
|
|
## @typedef {struct} Alerts - Alert routing configuration.
|
|
## @field {TelegramAlerts} [telegram] - Configuration for Telegram alerts.
|
|
## @field {SlackAlerts} [slack] - Configuration for Slack alerts.
|
|
|
|
## @typedef {struct} Alerta - Configuration for the Alerta service.
|
|
## @field {string} [storage] - Persistent volume size for the database.
|
|
## @field {string} [storageClassName] - StorageClass used for the database.
|
|
## @field {Resources} [resources] - Resource configuration.
|
|
## @field {Alerts} [alerts] - Alert routing configuration.
|
|
|
|
## @param {Alerta} alerta - Configuration for the Alerta service.
|
|
alerta:
|
|
storage: 10Gi
|
|
storageClassName: ""
|
|
resources:
|
|
limits:
|
|
cpu: "1"
|
|
memory: 1Gi
|
|
requests:
|
|
cpu: 100m
|
|
memory: 256Mi
|
|
alerts:
|
|
telegram:
|
|
token: ""
|
|
chatID: ""
|
|
disabledSeverity: []
|
|
slack:
|
|
url: ""
|
|
disabledSeverity: []
|
|
##
|
|
## @section Grafana configuration
|
|
##
|
|
|
|
## @typedef {struct} GrafanaDB - Grafana database configuration.
|
|
## @field {string} [size] - Persistent volume size for the database.
|
|
|
|
## @typedef {struct} Grafana - Grafana service configuration.
|
|
## @field {GrafanaDB} [db] - Database configuration.
|
|
## @field {Resources} [resources] - Resource configuration.
|
|
|
|
## @param {Grafana} grafana - Configuration for Grafana.
|
|
grafana:
|
|
db:
|
|
size: 10Gi
|
|
resources:
|
|
limits:
|
|
cpu: "1"
|
|
memory: 1Gi
|
|
requests:
|
|
cpu: 100m
|
|
memory: 256Mi
|
|
##
|
|
## @section Vmagent configuration
|
|
##
|
|
|
|
## @typedef {struct} VmagentRemoteWrite - Remote write configuration.
|
|
## @typedef {stringSlice} VmagentRemoteWriteURLs - List of remoteWrite endpoint URLs.
|
|
|
|
## @typedef {struct} VmagentExternalLabels - External labels for metrics.
|
|
## @field {string} [<key>] - Label value for the given key.
|
|
|
|
## @typedef {struct} Vmagent - VictoriaMetrics Agent configuration.
|
|
## @field {VmagentExternalLabels} [externalLabels] - External labels applied to all metrics.
|
|
## @field {VmagentRemoteWrite} [remoteWrite] - Remote write configuration.
|
|
|
|
## @param {Vmagent} vmagent - Configuration for VictoriaMetrics Agent.
|
|
vmagent:
|
|
externalLabels:
|
|
cluster: cozystack
|
|
remoteWrite:
|
|
urls:
|
|
- http://vminsert-shortterm:8480/insert/0/prometheus
|
|
- http://vminsert-longterm:8480/insert/0/prometheus
|
|
## inlineScrapeConfig: |
|
|
## - job_name: "custom"
|
|
## static_configs:
|
|
## - targets: ["my-service:9090"]
|
|
|
|
##
|
|
## @section OIDC authentication
|
|
##
|
|
|
|
## @enum {string} OIDCMode - Identity mode for the Grafana instance.
|
|
## @value None
|
|
## @value System
|
|
## @value CustomConfig
|
|
|
|
## @typedef {struct} OIDCSecretRef - Reference to a Secret carrying an `[auth.generic_oauth]` ini fragment.
|
|
## @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`.
|
|
|
|
## @typedef {struct} OIDCCustomConfigInline - Inline map of grafana.ini `[auth.generic_oauth]` keys.
|
|
## @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`).
|
|
|
|
## @typedef {struct} OIDCCustomConfig - Tenant-supplied AuthN payload; consumed only when `mode: CustomConfig`. Exactly one of `config` or `secretRef.name` must be set.
|
|
## @field {OIDCCustomConfigInline} [config] - Inline map of `[auth.generic_oauth]` keys. Written verbatim into the Grafana CR `spec.config`. Mutually exclusive with `secretRef.name`.
|
|
## @field {OIDCSecretRef} [secretRef] - Reference to a Secret holding an `auth.ini` fragment; mounted under `/etc/grafana/oidc` and loaded via `GF_PATHS_CUSTOM_INI`.
|
|
|
|
## @typedef {struct} OIDC - OIDC selector for the Grafana instance (Phase 1 — per-instance audience binding; no per-tenant Keycloak realm).
|
|
## @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.
|
|
## @field {OIDCCustomConfig} [customConfig] - Tenant-supplied `[auth.generic_oauth]` payload; consumed only when `mode: CustomConfig`.
|
|
## @field {bool} [grafanaAdmin] - Promote members of the `<clientId>-admin` group to server-level `GrafanaAdmin` (sets `allow_assign_grafana_admin: true` in `[auth.generic_oauth]`). Intended for the platform release; tenant Grafana keeps org-level Admin.
|
|
|
|
## @param {OIDC} oidc - OIDC authentication for the Grafana instance. See docs/oidc-grafana.md for the operator guide.
|
|
oidc:
|
|
mode: "None"
|
|
customConfig:
|
|
config: {}
|
|
secretRef:
|
|
name: ""
|
|
grafanaAdmin: false
|