Skip to content

Conversation

@naptalie
Copy link

Summary

  • Fixes RBAC template rendering failure when rbac.rules or rbac.clusterRules are set to empty arrays
  • Adds conditional checks to output valid YAML empty array syntax when rule arrays are empty
  • Includes test case for empty RBAC rules configuration

Problem

The Grafana Alloy Helm chart fails to template when rbac.rules or rbac.clusterRules configuration fields are set to empty arrays. This produces a YAML parsing error because the toYaml filter outputs an empty string for empty arrays, leaving the rules: key without a valid value.

Solution

Modified rbac.yaml to:

  1. Check if rule arrays have content before rendering
  2. Output valid YAML empty array syntax [] when arrays are empty
  3. Handle both Role and ClusterRole configurations

Test Plan

  • Added test case configuration in rbac-empty-rules-values.yaml
  • Verified template renders successfully with empty RBAC rules:
    helm template test charts/alloy -f charts/alloy/ci/rbac-empty-rules-values.yaml
  • Generated test outputs verify valid YAML structure

Fixes #4778

🤖 Generated with Claude Code

The Helm chart would fail to render when rbac.rules or
rbac.clusterRules were set to empty arrays, producing invalid YAML.

This change adds conditional checks to output valid YAML (empty array
syntax) when the rule arrays are empty, allowing users to explicitly
disable custom RBAC rules while maintaining valid configuration.

Fixes grafana#4778

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@naptalie naptalie requested a review from a team as a code owner November 16, 2025 02:53
@CLAassistant
Copy link

CLAassistant commented Nov 16, 2025

CLA assistant check
All committers have signed the CLA.

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.

Helm chart 1.4.0 fails templating when rbac.rules or rbac.clusterRules is empty array

2 participants