Files
cozystack/packages/system/cozystack-api/tests/standalone_render_test.yaml
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

24 lines
919 B
YAML

suite: cozystack-api renders with no platform values injected
release:
name: cozystack-api
namespace: cozy-system
# The platform injects _cluster through the cozystack-values Secret, so every
# case that sets it itself renders fine whether or not values.yaml declares
# the key. This case supplies nothing. Drop the declaration from values.yaml
# and the render dies on "index of untyped nil" before a single assert runs;
# the declaration is the only thing keeping 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: exposes nothing when _cluster is absent
asserts:
- template: templates/api-ingress.yaml
hasDocuments:
count: 0
- template: templates/api-tlsroute.yaml
hasDocuments:
count: 0