mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
`mode: System` previously wrapped every Keycloak resource in the `Capabilities.APIVersions.Has "v1.edp.epam.com/v1"` guard, so a cluster where the Keycloak operator CRDs were not yet registered silently dropped the whole Keycloak side while Grafana still came up with an `auth.generic_oauth` block pointing at a client that never got provisioned. Login broke with an opaque OIDC error and no chart-side signal that the platform was misconfigured. Turn the missing CRD into an actionable render error. A new `monitoring.oidc.assertSystemKeycloakCRD` helper fails with a message that points at `cozystack.keycloak-operator`, called from both `templates/grafana/oidc-keycloak.yaml` (replacing the silent capability guard) and `templates/grafana/grafana.yaml` (symmetric defense-in-depth so a future refactor of oidc-keycloak.yaml cannot regress the invariant). For the platform `monitoring-system` release the oidc variant's `dependsOn: cozystack.keycloak-operator` already prevents the race; for tenant releases the assertion converts the misconfiguration into an operator-facing error instead of a broken login flow. Signed-off-by: Ivan Okhotnikov <xorokhotnikov@gmail.com>
39 lines
1.6 KiB
YAML
39 lines
1.6 KiB
YAML
suite: OIDC selector — Keycloak operator CRD missing (Phase 1)
|
|
# Split from oidc_test.yaml because the suite-level `capabilities`
|
|
# override in that file installs `v1.edp.epam.com/v1`, and per-test
|
|
# `capabilities` in helm-unittest v1.0.3 merges with the suite-level
|
|
# list instead of replacing it — so the CRD-missing fail-close guard
|
|
# needs its own suite where the capability list is empty at the top.
|
|
templates:
|
|
- templates/grafana/oidc-keycloak.yaml
|
|
- templates/grafana/grafana.yaml
|
|
|
|
release:
|
|
name: monitoring
|
|
namespace: tenant-root
|
|
|
|
set:
|
|
_cluster:
|
|
root-host: example.org
|
|
oidc-enabled: "true"
|
|
_namespace:
|
|
host: tenant-root.example.org
|
|
ingress: tenant-root
|
|
|
|
capabilities:
|
|
apiVersions: []
|
|
|
|
tests:
|
|
- it: mode=System hard-fails the render when the Keycloak operator CRD is missing
|
|
# oidc-keycloak.yaml fires the assertion first because helm renders all
|
|
# templates in one pass; grafana.yaml carries the same assertion as
|
|
# defense-in-depth so a future refactor that removes oidc-keycloak.yaml
|
|
# cannot bring Grafana up pointing at a client that never gets
|
|
# provisioned. See monitoring.oidc.assertSystemKeycloakCRD in _helpers.tpl.
|
|
template: templates/grafana/oidc-keycloak.yaml
|
|
set:
|
|
oidc.mode: System
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: "spec.oidc.mode: System requires the Keycloak operator CRDs (v1.edp.epam.com/v1). If cozystack.keycloak-operator is still bootstrapping this will resolve on the next reconcile; otherwise verify the keycloak-operator package is deployed and its CRDs are registered."
|