Skip to content

update chart to support multi env reporting#690

Merged
sami-alajrami merged 3 commits intomainfrom
helm-chart-update
Mar 9, 2026
Merged

update chart to support multi env reporting#690
sami-alajrami merged 3 commits intomainfrom
helm-chart-update

Conversation

@sami-alajrami
Copy link
Contributor

@sami-alajrami sami-alajrami commented Mar 9, 2026

Summary

related to kosli-dev/server#4720

Breaking change (v2.0.0): Replaces the single-environment reporting model in the k8s-reporter Helm chart with a new multi-environment configuration.

What changed

The old chart allowed reporting to only one Kosli environment at a time via flat values (kosliEnvironmentName, namespaces, namespacesRegex, excludeNamespaces, excludeNamespacesRegex). This PR replaces all of those with a single reporterConfig.environments list, where each entry has a required name and optional namespace selectors. This enables reporting to multiple Kosli environments with different namespace filters from a single chart installation.

Changes by file

  • Chart.yaml — Version bump: 1.11.3 → 2.0.0, appVersion: 2.11.43 → 2.12.0
  • values.yaml — Removed old flat config keys; replaced with environments list including commented-out examples
  • configmap.yaml (new) — New ConfigMap template that renders the environments list into a config.yaml mounted into the reporter container
  • cronjob.yaml — Mounts the new ConfigMap at /config; container args now use --config-file /config/config.yaml instead of positional env name; removed old env var injection for namespace filters
  • _validations.tpl — Simplified: replaced multiple validation helpers with a single check ensuring environments is non-empty and every entry has a name
  • README.md — Updated docs with new config format, migration notes from v1.x, and examples for single/multi-environment setups

Migration from v1.x

Users must migrate from the old flat values to the new reporterConfig.environments list format. A single-environment setup is a list with one entry:

reporterConfig:
  kosliOrg: my-org
  environments:
    - name: my-env-name

Copy link
Contributor

@AlexKantor87 AlexKantor87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this, Sami — the move to a multi-environment config list is clean and the ConfigMap approach is solid. A few things I'd flag:

1. kosliOrg default changed from "" to "my-org" (values.yaml)
This looks unintentional. The old default was an empty string — shipping a placeholder like "my-org" means someone could install the chart without overriding it and silently report to a non-existent org. I'd revert this to "".

2. Default environment entry - name: prod-env is uncommented (values.yaml)
The default values ship with an active (uncommented) entry. Combined with the new validation only checking that environments is non-empty and each entry has a name, helm install will succeed without the user configuring anything meaningful — it'll try to report to prod-env in my-org. The old chart used a required call to force the user to set kosliEnvironmentName. I'd suggest either commenting out the default entry (so the validation fails and prompts the user to configure), or keeping the environments default as [] and relying on the validation to surface a clear error.

3. Per-entry namespace conflict validation is gone
The old _validations.tpl checked that include and exclude selectors weren't combined (e.g. namespaces + excludeNamespaces). The new validation only checks for a non-empty list and presence of name. If this conflict validation is now handled by the CLI when it parses config.yaml, that's fine — but worth confirming, and maybe worth a comment in the template noting where that validation lives now.

4. README table vs actual defaults mismatch
The values table says reporterConfig.environments defaults to [], but the actual values.yaml has a populated entry. Minor, but worth aligning.

Everything else looks good — ConfigMap template correctly uses toJson for array fields and quote for name, cronjob volume/volumeMount is well-placed, --config-file arg swap is clean, and the old env var injection removal is complete.

@sami-alajrami
Copy link
Contributor Author

  • for 1 and 2, it was to enable linting. Now I restored them back to be empty and override them when linting instead.
  • 4 the README is auto updated after publishing so not an issue
  • 3 the validation still happens in the CLI, but the feedback loop becomes longer. Restored it in the chart to get faster feedback.

@sami-alajrami sami-alajrami enabled auto-merge (squash) March 9, 2026 12:03
@sami-alajrami sami-alajrami merged commit 4f110f4 into main Mar 9, 2026
9 checks passed
@sami-alajrami sami-alajrami deleted the helm-chart-update branch March 9, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants