Files
cozystack/packages/system/monitoring/tests/standalone_render_test.yaml
T
Aleksei Sviridkin eef5fe6908 fix(platform): declare the injected _cluster values in system charts
Ten system charts cannot be rendered on their own. They read the
platform-injected _cluster channel, and two of them (bucket,
monitoring) also read _namespace, without declaring either key in
values.yaml. On a cluster the platform supplies both through the
cozystack-values Secret, so installs are unaffected, but rendering a
chart by itself dies before a single template is emitted: on "index of
untyped nil" for a missing _cluster, and on "nil pointer evaluating
interface {}.host" for a missing _namespace.

Declare the keys with empty defaults. Helm merges chart defaults under
the supplied values, so an injected _cluster still wins and rendered
output does not change. Each of the ten also gets a suite that renders
with nothing injected; drop a declaration again and that chart's suite
goes red.

This makes `helm template` succeed for all ten. `helm lint` also
reports a missing cozy-lib dependency on keycloak and monitoring,
which is a separate pre-existing defect and survives this change.

etcd-operator reads _cluster too and stays undeclared here: its single
call site already guards with `| default dict`, so the chart renders
standalone as it is.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-07 02:23:47 +03:00

25 lines
1005 B
YAML

suite: monitoring renders with no platform values injected
release:
name: monitoring
namespace: cozy-monitoring
# The platform injects _cluster and _namespace through the cozystack-values
# Secret, so every case that sets them itself renders fine whether or not
# values.yaml declares the keys. This case supplies neither. Drop the
# _cluster declaration and the render dies on "index of untyped nil"; drop
# the _namespace one and it dies on "nil pointer evaluating interface
# {}.host". Both are what keep the chart renderable outside a cluster. No
# suite-level `templates:` list here on purpose: it would narrow the render
# to the listed files and let a later template reintroduce the same
# breakage unseen.
tests:
- it: still renders grafana and no route when _cluster and _namespace are absent
asserts:
- template: templates/grafana/grafana.yaml
hasDocuments:
count: 1
- template: templates/grafana/httproute.yaml
hasDocuments:
count: 0