Skip to content

Commit eef5fe6

Browse files
committed
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 <[email protected]>
1 parent 86d62bb commit eef5fe6

21 files changed

Lines changed: 296 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
suite: bucket renders with no platform values injected
2+
release:
3+
name: bucket
4+
namespace: cozy-bucket
5+
6+
# The platform injects _cluster and _namespace through the cozystack-values
7+
# Secret, so every case that sets them itself renders fine whether or not
8+
# values.yaml declares the keys. This case supplies neither. Drop the
9+
# _cluster declaration and the render dies on "index of untyped nil"; drop
10+
# the _namespace one and it dies on "nil pointer evaluating interface
11+
# {}.host". Both are what keep the chart renderable outside a cluster. No
12+
# suite-level `templates:` list here on purpose: it would narrow the render
13+
# to the listed files and let a later template reintroduce the same
14+
# breakage unseen.
15+
16+
tests:
17+
- it: still renders the ingress when _cluster and _namespace are absent
18+
asserts:
19+
- template: templates/ingress.yaml
20+
hasDocuments:
21+
count: 1

‎packages/system/bucket/values.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
# Injected by the platform from the cozystack-values Secret. The empty
2+
# defaults keep the chart renderable on its own, outside a cluster.
3+
_cluster: {}
4+
_namespace: {}
5+
16
bucketName: "cozystack"
27
users: {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
suite: cert-manager-issuers renders with no platform values injected
2+
release:
3+
name: cert-manager-issuers
4+
namespace: cozy-cert-manager
5+
6+
# The platform injects _cluster through the cozystack-values Secret, so every
7+
# case that sets it itself renders fine whether or not values.yaml declares
8+
# the key. This case supplies nothing. Drop the declaration from values.yaml
9+
# and the render dies on "index of untyped nil" before a single assert runs;
10+
# the declaration is the only thing keeping the chart renderable outside a
11+
# cluster. No suite-level `templates:` list here on purpose: it would narrow
12+
# the render to the listed files and let a later template reintroduce the
13+
# same breakage unseen.
14+
15+
tests:
16+
- it: still renders the cluster issuers when _cluster is absent
17+
asserts:
18+
- template: templates/cluster-issuers.yaml
19+
hasDocuments:
20+
count: 3
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
# Injected by the platform from the cozystack-values Secret. The empty
2+
# default keeps the chart renderable on its own, outside a cluster.
3+
_cluster: {}
4+
15
cert-manager:
26
installCRDs: true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
suite: cozystack-api renders with no platform values injected
2+
release:
3+
name: cozystack-api
4+
namespace: cozy-system
5+
6+
# The platform injects _cluster through the cozystack-values Secret, so every
7+
# case that sets it itself renders fine whether or not values.yaml declares
8+
# the key. This case supplies nothing. Drop the declaration from values.yaml
9+
# and the render dies on "index of untyped nil" before a single assert runs;
10+
# the declaration is the only thing keeping the chart renderable outside a
11+
# cluster. No suite-level `templates:` list here on purpose: it would narrow
12+
# the render to the listed files and let a later template reintroduce the
13+
# same breakage unseen.
14+
15+
tests:
16+
- it: exposes nothing when _cluster is absent
17+
asserts:
18+
- template: templates/api-ingress.yaml
19+
hasDocuments:
20+
count: 0
21+
- template: templates/api-tlsroute.yaml
22+
hasDocuments:
23+
count: 0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Injected by the platform from the cozystack-values Secret. The empty
2+
# default keeps the chart renderable on its own, outside a cluster.
3+
_cluster: {}
4+
15
cozystackAPI:
26
image: ghcr.io/cozystack/cozystack/cozystack-api:v1.6.0@sha256:c4d374a9bc5e6f6e66d24b29396f1eae9d7f06fd268ff767d05c45ca35e84e2e
37
replicas: 2
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
suite: dashboard renders with no platform values injected
2+
release:
3+
name: dashboard
4+
namespace: cozy-dashboard
5+
6+
# The platform injects _cluster through the cozystack-values Secret, so every
7+
# case that sets it itself renders fine whether or not values.yaml declares
8+
# the key. This case supplies nothing. Drop the declaration from values.yaml
9+
# and the render dies on "index of untyped nil" before a single assert runs;
10+
# the declaration is the only thing keeping the chart renderable outside a
11+
# cluster. No suite-level `templates:` list here on purpose: it would narrow
12+
# the render to the listed files and let a later template reintroduce the
13+
# same breakage unseen.
14+
15+
tests:
16+
- it: exposes nothing when _cluster is absent
17+
asserts:
18+
- template: templates/ingress.yaml
19+
hasDocuments:
20+
count: 0
21+
- template: templates/httproute.yaml
22+
hasDocuments:
23+
count: 0

‎packages/system/dashboard/values.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Injected by the platform from the cozystack-values Secret. The empty
2+
# default keeps the chart renderable on its own, outside a cluster.
3+
_cluster: {}
4+
15
console:
26
image: ghcr.io/cozystack/cozystack/cozystack-ui:v1.6.0@sha256:ad0e132ce506bbc9e0f6a5dfb94311c9bbc08da3d8eca84eb0e527ba6c1a8897
37
tokenProxy:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
suite: keycloak-configure renders with no platform values injected
2+
release:
3+
name: keycloak-configure
4+
namespace: cozy-keycloak
5+
6+
# The platform injects _cluster through the cozystack-values Secret, so every
7+
# case that sets it itself renders fine whether or not values.yaml declares
8+
# the key. This case supplies nothing. Drop the declaration from values.yaml
9+
# and the render dies on "index of untyped nil" before a single assert runs;
10+
# the declaration is the only thing keeping the chart renderable outside a
11+
# cluster. No suite-level `templates:` list here on purpose: it would narrow
12+
# the render to the listed files and let a later template reintroduce the
13+
# same breakage unseen.
14+
15+
tests:
16+
- it: still renders the realm objects when _cluster is absent
17+
asserts:
18+
- template: templates/configure-kk.yaml
19+
hasDocuments:
20+
count: 6

‎packages/system/keycloak-configure/values.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Injected by the platform from the cozystack-values Secret. The empty
2+
# default keeps the chart renderable on its own, outside a cluster.
3+
_cluster: {}
4+
15
# Keycloak image used by the one-shot admin-API job that enables the
26
# UPDATE_EMAIL required action. Only kcadm.sh is used, so it just needs
37
# to track the Keycloak server major version (packages/system/keycloak).

0 commit comments

Comments
 (0)