A tenant Kubernetes cluster could only start once an ancestor Tenant had an etcd module turned on, which nobody creating a cluster may do, and every cluster below that tenant then shared one etcd, one CA and one disk. Anything that orders clusters on a tenant's behalf had to flip the tenant's etcd on first. A new cluster now renders its own EtcdCluster and DataStore, from the cozy-lib shapes the etcd chart uses, and is created and deleted with them. The awaiting-etcd state goes, since a datastore always exists. An existing cluster stays on the DataStore its live KamajiControlPlane names, and renders what it rendered before. Changing that name starts a Kamaji datastore migration, which freezes the tenant's writes and leaves every worker kubelet needing a restart, so no upgrade may do it. _namespace.etcd cannot decide this: tenant-root publishes one to every tenant whether or not an etcd runs behind it. On uninstall, Kamaji's datastore finalizer drops the tenant's role, prefix and user from an etcd this release deletes next, and it never completes while that etcd is down. The pre-delete hook therefore removes it from a TenantControlPlane on the cluster's own DataStore that outlives the wait, and deletes the etcd's PKI, which cert-manager issues without an owner. If the finalizer stays on, or the TenantControlPlane cannot be read, the hook fails before the PKI goes, so the uninstall is retried with the etcd still in place. A TenantControlPlane on a shared DataStore is left to Kamaji as before. A Cilium deny policy keeps the rest of the tenant namespace, ancestor tenants and off-cluster sources off the etcd ports; the Kubernetes backup strategy's dump Job carries the label it admits. The tenant etcd's scrape now selects its own members by instance, because every member etcd-operator runs carries app.kubernetes.io/name: etcd. The platform waits for etcd-operator before offering the application. The defrag job both charts share pulls its image through the configured registry, pinned by digest to the multi-architecture index, so a mirrored installation does not depend on ghcr.io for it. Tested with helm-unittest on both the own and the shared branch, the pre-delete hook's bats suite run against a stub kubectl for both, and a render of an existing cluster that matches main byte for byte. The guest e2e runs the defrag CronJob once, and probes the etcd client port from a labelled Pod, an unlabelled one and one in tenant-root. Co-authored-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
Render fixtures
hack/check-render-matrix.sh renders every app chart with its defaults plus these injected values. helm-unittest renders the templates selected by each suite, so a chart with passing unit tests can still have an untested template that fails to render. This sweep checks that Helm accepts the rendered YAML; it does not validate Kubernetes schemas or runtime behavior.
The source of _cluster is packages/core/platform/templates/apps.yaml; _namespace comes from packages/apps/tenant/templates/namespace.yaml. These fixtures model selected install states, not a complete copy of every platform setting. Top-level scalar values in these maps are strings, including booleans. Charts such as tenant compare oidc-enabled with "true", so a YAML boolean has the wrong type.
scheduling and branding are maps copied with toYaml, which preserves their nested types. The scheduling keys read by app charts have a more specific contract: globalAppTopologySpreadConstraints is a string containing YAML (or an empty string), and dedicatedNodesForWindowsVMs is compared with the string "true". The configured and wildcard fixtures supply a topology constraint; fresh leaves it empty. The embedded YAML retains numeric fields such as maxSkew.
_namespace.<service> contains the namespace providing the shared service, or an empty string when unavailable. A new Kubernetes cluster renders its own etcd, so etcd changes nothing in that chart's render; it still drives the tenant chart's inheritance. These states use ingress rather than Gateway API, so gateway stays empty: a non-empty gateway would disable Harbor Ingress and leave the certificate modes untested.
| File | State |
|---|---|
fresh.yaml |
OIDC off, no certificates or shared services, no topology constraint |
configured.yaml |
OIDC on, per-host ACME via http01, shared services and topology constraint |
wildcard.yaml |
OIDC on, dns01 with a platform-issued wildcard certificate, shared services and topology constraint |
Each chart is attempted under every fixture. vm-instance and kubernetes-nodes require a VirtualMachineClusterInstancetype lookup on their defaults. The sweep accepts their skip only while every fixture fails with the recorded lookup diagnostic; a successful render or a different error fails the sweep. For kubernetes-nodes it supplies a parent cluster and matching release name first. For tenant it declares the Keycloak API with --api-versions v1.edp.epam.com/v1, allowing OIDC-enabled fixtures to render the realm groups.
lookup returns an empty result during this check. Tests for existing objects belong in chart-specific helm-unittest suites using kubernetesProvider; packages/apps/clickhouse/tests/backup_api_password_persistence_test.yaml covers both password generation and preservation that way. Presets, replica counts and other app feature toggles are outside this sweep.
The BATS suite checks fixture types with the small Helm chart in validator/, using --set-file so explicit nulls are not removed by Helm's values merge. Separate assertions check PostgreSQL topology constraints, tenant OIDC groups, a Kubernetes cluster's own etcd and its metrics-server HelmRelease in every state, and Harbor per-host ACME versus wildcard TLS. Pairwise comparison of complete tenant renders detects duplicate fixture states, and a second render of each state checks that randomness cannot satisfy that comparison. The branch assertions are needed because tenant also copies injected values into a Secret, so different output alone does not prove a conditional resource was rendered.
When adding an injected value read by an app, update the relevant states and add an assertion for the branch it exercises. Review all read forms, including index, get and dig, before deciding a value is unused:
grep -rn -e '_cluster' -e '_namespace' packages/apps/*/templates/