UNCLASSIFIED - NO CUI

Fix duplicate Grafana env Secret when GitLab Redis password is set

Summary

This MR fixes duplicate rendering of the grafana-env-secret Secret in the monitoring namespace when addons.gitlab.redis.password is configured.

Changes include:

  • Keep both Grafana env Secret templates so the legacy Monitoring-owned Grafana deployment path remains supported.
  • Make the standalone Grafana template render only when grafana.enabled=true and GitLab or GitLab Runner Redis dashboard integration is enabled.
  • Make the Monitoring template render only for the legacy compatibility path: monitoring.enabled=true, grafana.enabled=false, monitoring.values.upstream.grafana.enabled=true, and GitLab or GitLab Runner Redis dashboard integration is enabled.
  • Document that standalone Grafana via grafana.enabled is a supported deployment option, while Monitoring-owned Grafana remains a legacy compatibility path.
  • Add helm-unittest coverage for standalone Grafana ownership, legacy Monitoring Grafana ownership, and the duplicate-prevention gates.

Relevant logs/screenshots

Post-render failure from the unpatched chart:

error: accumulating resources: accumulation err='accumulating resources from 'all.yaml': may not add resource with an already registered id: Secret.v1.[noGrp]/grafana-env-secret.monitoring'
exit_code=1

Verification against this branch with addons.gitlab.redis.password set:

postrender_exit_code=0
grafana_env_secret_count=1

Standalone Grafana ownership render check:

# Source: bigbang/templates/grafana/grafana-env-secret.yaml
kind: Secret
  name: grafana-env-secret
  GITLAB_REDIS_PASSWORD: redis-pass

Legacy Monitoring Grafana ownership render check:

# Source: bigbang/templates/monitoring/grafana-env-secret.yaml
kind: Secret
  name: grafana-env-secret
  GITLAB_REDIS_PASSWORD: redis-pass
helm unittest . -f "unittests/**/*_test.yaml"
Charts:      1 passed, 1 total
Test Suites: 52 passed, 52 total
Tests:       277 passed, 277 total

helm lint ./chart
1 chart(s) linted, 0 chart(s) failed

Linked Issue

Closes #3259 (closed)

Upgrade Notices

"N/A"

Complete MR checklist

Assignee

  • Followed upgrade instructions outlined in docs/DEVELOPMENT_MAINTENANCE.md
  • Update Docs with new/updated steps as needed
  • Tested and Validated Changes made with supporting info like logs or screenshots from test pipelines

Reviewer only

  • Tested and Validated changes
Edited by Dax McDonald

Merge request reports

Loading