Skip to content

Roll Grafana on secret rotation, release-gate monitoring deploys - #151

Merged
giang-h-vu merged 4 commits into
mainfrom
PROJ-A/roll-grafana-on-secret-rotation_update-documentation
Jul 20, 2026
Merged

Roll Grafana on secret rotation, release-gate monitoring deploys#151
giang-h-vu merged 4 commits into
mainfrom
PROJ-A/roll-grafana-on-secret-rotation_update-documentation

Conversation

@giang-h-vu

@giang-h-vu giang-h-vu commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes Grafana password rotation actually take effect (pod rolls automatically when the grafana-admin Secret changes), release-gates the monitoring deploy so it always ships from the same tag as the app, rotates the prod Grafana admin password, and updates docs incl. live-environment links in the root README.

Motivation & Context

The live Grafana password had drifted from the vault: env vars from secretKeyRef resolve once at container start, so rotating the Secret never reached the running pod. Separately, monitoring deployed from main on merge while the app shipped at release, so dashboards/alerts could reference metrics prod didn't emit yet.

Changes

  • Ansible passes the grafana-admin Secret's resourceVersion into the monitoring chart; it lands as a pod-template annotation, so any rotation rolls the Grafana pod (resourceVersion, not a password hash — nothing password-derived in the pod spec)
  • cd-prod calls cd-monitoring as a reusable workflow after the app deploy (workflow_call runs at the caller's ref = the release tag); cd-monitoring keeps workflow_dispatch as the manual escape hatch and now shares the deploy-prod concurrency group
  • Rotated vault_grafana_admin_password in the encrypted prod vault
  • Docs: live-environment links (dev AKS, prod Rancher, Grafana) in the root README; monitoring README, CLAUDE.md, and chart comments updated to the release-gated model

Steps for Testing

  1. helm template infra/helm/monitoring --set grafana.adminSecretVersion=123 → deployment renders a secret-version/admin: "123" pod annotation; without the value, no annotation
  2. actionlint passes on both workflows (pre-commit)
  3. After merge + next release: cd-prod run shows the deploy-monitoring job; kubectl -n genops-monitoring get pod shows Grafana re-rolled and login works with the new vault password

Checklist

  • Self-reviewed the diff
  • No debug statements, commented-out code, or TODOs
  • All CI checks pass (build · test · lint)
  • Tests added or updated (n/a — CI/Helm/Ansible config)
  • New env vars added to .env.example (n/a)
  • OpenAPI spec updated (n/a — no endpoint changes)
  • Screenshots attached (n/a — no UI changes)

Summary by CodeRabbit

  • New Features

    • Monitoring deployments now run automatically after production application releases, using the same release version.
    • Added a manual deployment option for urgent dashboard and alert updates.
    • Grafana now restarts automatically when its administrator password changes.
  • Bug Fixes

    • Improved monitoring deployment reliability and synchronization with production releases.
  • Documentation

    • Added live environment links and clarified monitoring deployment procedures, access, and current alerting capabilities.

Env vars from secretKeyRef resolve once at container start, so a rotated
grafana-admin Secret never reached the running pod (live password drifted
from the vault). Ansible now passes the Secret's resourceVersion into the
chart, where it lands as a pod-template annotation — any rotation changes
the template and triggers a rollout. resourceVersion instead of a password
hash so nothing password-derived appears in the pod spec.
Monitoring previously deployed from main on merge while the app shipped at
release, so dashboards/alerts could reference metrics prod did not emit
yet. cd-prod now calls cd-monitoring as a reusable workflow after the app
deploy; workflow_call runs at the caller's ref, so monitoring deploys from
the same release tag as the app. workflow_dispatch remains as the manual
escape hatch, sharing the deploy-prod concurrency group since both paths
upgrade the same Helm release.
Root README gains a live-environments table (dev AKS, prod Rancher,
Grafana; Prometheus is deliberately not exposed — NetworkPolicy admits
only Grafana). Update monitoring README, CLAUDE.md, and the Grafana
deployment header to match the new deploy model: monitoring ships with
prod releases via cd-prod calling cd-monitoring, and a rotated admin
password now rolls the pod.
@giang-h-vu giang-h-vu added infra Infrastructure & DevOps documentation Improvements or additions to documentation labels Jul 20, 2026
@giang-h-vu giang-h-vu self-assigned this Jul 20, 2026
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90de478e-316a-4b93-aa0c-7bc3f763f5e5

📥 Commits

Reviewing files that changed from the base of the PR and between 6ac9353 and 09b17af.

📒 Files selected for processing (9)
  • .github/workflows/cd-monitoring.yml
  • .github/workflows/cd-prod.yml
  • CLAUDE.md
  • README.md
  • infra/ansible/inventories/prod/group_vars/all/vault.yml
  • infra/ansible/playbooks/monitoring.yml
  • infra/helm/monitoring/templates/grafana-deployment.yaml
  • infra/helm/monitoring/values.yaml
  • monitoring/README.md

📝 Walkthrough

Walkthrough

Monitoring deployment is now release-gated through cd-prod, with manual dispatch retained. The Ansible and Helm flow propagates Grafana Secret resourceVersion changes into pod rollouts. Documentation and production vault data were updated accordingly.

Changes

Monitoring release and rotation

Layer / File(s) Summary
Grafana secret rotation wiring
infra/helm/monitoring/..., infra/ansible/playbooks/monitoring.yml, infra/ansible/inventories/prod/group_vars/all/vault.yml
Ansible passes the Grafana Secret resourceVersion to Helm, and the chart uses it to trigger Grafana pod rollouts when the Secret changes.
Release-gated monitoring workflow
.github/workflows/cd-*.yml, monitoring/README.md, README.md, CLAUDE.md
cd-prod invokes cd-monitoring after application deployment, with manual dispatch retained and deployment documentation updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CDProd
  participant CDMonitoring
  participant MonitoringPlaybook
  participant GrafanaSecret
  participant HelmMonitoring
  participant Grafana
  CDProd->>CDMonitoring: invoke after application deploy
  CDMonitoring->>MonitoringPlaybook: run monitoring deployment
  MonitoringPlaybook->>GrafanaSecret: create or update admin Secret
  GrafanaSecret-->>MonitoringPlaybook: return resourceVersion
  MonitoringPlaybook->>HelmMonitoring: pass adminSecretVersion
  HelmMonitoring->>Grafana: render rollout annotation
Loading

Possibly related PRs

Suggested reviewers: toukhi

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly captures the main changes: Grafana secret-rotation rollout behavior and release-gated monitoring deploys.
Description check ✅ Passed The description follows the template well and includes summary, motivation, changes, testing steps, and checklist, with only the issue-closing line omitted.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PROJ-A/roll-grafana-on-secret-rotation_update-documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@toukhi toukhi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lgtm

@giang-h-vu
giang-h-vu merged commit d996f65 into main Jul 20, 2026
12 of 13 checks passed
@giang-h-vu
giang-h-vu deleted the PROJ-A/roll-grafana-on-secret-rotation_update-documentation branch July 20, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation infra Infrastructure & DevOps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants