myasnikovdaniil d7c280ca74 [Backport release-1.6] fix(cozy-lib): make the cozyconfig helpers survive uninjected values (#5141)
## What this PR does

Backport of #3647 to release-1.6.

Since #5080 (backport of #4710) `tenant.ciliumPolicies` calls
`cozy-lib.bundle-name`, and on release-1.6 that helper still does `index
.Values._cluster "bundle-name"`, which fails with `index of untyped nil`
when `_cluster` is not set. Tenant export-proxy suite
(`tests/networkpolicy_vm_exportproxy_test.yaml`) sets no `_cluster`, so
all four cases fail and unit tests are red on every PR against
release-1.6, including batch #5089. #5080 set `_cluster: {}` only in its
own suite, that's why it passed there.

#3647 guards the map in every cozyconfig helper and adds cozy-lib-tests
suite for injected and uninjected state. It applies cleanly, diff is
identical to main.

Checked locally (helm-unittest is not installed here, CI runs it):

- export-proxy suite renders fail on current branch and pass with this
change;
- new cozyconfig suite passes, its uninjected case fails against old
helpers;
- all 34 charts using cozy-lib render the same before and after with
realistic `_cluster` / `_namespace` (apart from generated passwords),
only tenant chart with nothing injected changes, it doesn't fail in
`networkpolicy.yaml` anymore.

Plain `helm template` of tenant chart without `_cluster` still fails in
`keycloakgroups.yaml`, main fixed it separately in #3636. Unit tests are
not affected, suite renders only templates it names.

### Screenshots

Not a UI change.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:

### Release note

```release-note
fix(cozy-lib): the cozyconfig helpers now return their documented empty defaults when the platform has not injected `_cluster` / `_namespace`, instead of aborting the render, so a chart using them can be rendered and unit-tested on its own
```
2026-10-30 11:18:44 +05:00
2025-10-08 09:43:34 +05:00
2025-04-01 18:48:14 +02:00
2024-02-08 12:04:32 +01:00

Cozystack Cozystack

Open Source Apache-2.0 License Support Active GitHub Release GitHub Commit OpenSSF Best Practices OpenSSF Scorecard

Cozystack

Cozystack is a free platform and framework for building clouds.

Cozystack is a CNCF Sandbox Level Project that was originally built and sponsored by Ænix.

With Cozystack, you can transform a bunch of servers into an intelligent system with a simple REST API for spawning Kubernetes clusters, Database-as-a-Service, virtual machines, load balancers, HTTP caching services, and other services with ease.

Use Cozystack to build your own cloud or provide a cost-effective development environment.

Cozystack user interface

Use-Cases

Documentation

The documentation is located on the cozystack.io website.

Read the Getting Started section for a quick start.

If you encounter any difficulties, start with the troubleshooting guide and work your way through the process that we've outlined.

Versioning

Versioning adheres to the Semantic Versioning principles.
A full list of the available releases is available in the GitHub repository's Release section.

Contributions

Contributions are highly appreciated and very welcomed!

In case of bugs, please check if the issue has already been opened by checking the GitHub Issues section. If it isn't, you can open a new one. A detailed report will help us replicate it, assess it, and work on a fix.

You can express your intention to on the fix on your own. Commits are used to generate the changelog, and their author will be referenced in it.

If you have a concrete feature request, open an issue. For a cross-cutting or architectural change, open a design proposal in the community repo. For questions or early ideas, use GitHub Discussions. See CONTRIBUTING.md for the full routing.

Community

You are welcome to join our Telegram group and come to our weekly community meetings. Add them to your Google Calendar or iCal for convenience.

License

Cozystack is licensed under Apache 2.0.
The code is provided as-is with no warranties.

Commercial Support

A list of companies providing commercial support for this project can be found on official site.

Languages
Go 52.9%
Shell 33.3%
TypeScript 6.7%
Go Template 4.7%
Makefile 1.2%
Other 1.1%