feat(monitoring): add Azure Monitor datasource for shared Postgres - #89
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an Azure Monitor datasource to the cluster’s Grafana (kube-prometheus-stack) so Grafana can query/alert on metrics from the shared Postgres Flexible Server (psql-j26apps-shared-sdc). Secrets are intended to be provided via the existing Azure Key Vault CSI pattern.
Changes:
- Adds a
SecretProviderClassin themonitoringnamespace to materializeAZURE_CLIENT_SECRETfor Grafana. - Provisions a new Grafana datasource (“Azure Monitor”) configured to use
$__env{AZURE_CLIENT_SECRET}. - Mounts the Secrets Store CSI volume and wires
envFromSecretso Grafana can resolve the client secret at runtime.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| k8s/infra-manifest/monitoring/secret-provider-class.yaml | New SecretProviderClass to sync the Azure Monitor client secret from Key Vault into a Kubernetes Secret. |
| k8s/infra-manifest/monitoring/helm-values.yaml | Adds Grafana Azure Monitor datasource provisioning plus secret env/CSI mount wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Wires Grafana to Azure Monitor via a dedicated service principal (Monitoring Reader on rg-j26apps-shared-sec only) so we can dashboard and alert on psql-j26apps-shared-sdc load. Client secret delivered via KV CSI + envFromSecret, never stored in git.
- spec.source was dead: ArgoCD ignores it once spec.sources is set,
so the SecretProviderClass would never have been GitOps-managed.
Move it into sources[] as a proper git manifest source.
- Rename KV object to match the {app}-{env-var} naming convention
(grafana-azure-monitor-azure-client-secret). Old KV secret
soft-deleted; new one verified live via CSI sync.
…urce Copilot flagged that the new git directory source over k8s/infra-manifest/monitoring would also try to apply the Helm values files (helm-values.yaml, loki-values.yaml, alloy-values.yaml) as raw manifests, risking sync errors. Scope it to only secret-provider-class.yaml via directory.include.
hakan-persson
force-pushed
the
feat/grafana-azure-monitor
branch
from
July 26, 2026 11:27
92acada to
2907183
Compare
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
psql-j26apps-shared-sdc(shared Postgres flexible server) load. Currently there is no continuous monitoring of that server — this closes that gap.j26-grafana-azure-monitor-reader, scoped to Monitoring Reader onrg-j26apps-shared-seconly (read-only, resource-group scoped).kv-j26apps-shared-sdc(grafana-azure-monitor-*keys), delivered to the Grafana pod via the standard KV CSI pattern (secret-provider-class.yaml), never committed to git.envFromSecret+$__env{AZURE_CLIENT_SECRET}in the datasource'ssecureJsonData— standard Grafana provisioning mechanism for keeping secrets out of git.Test plan
helm templateverified the full render: CSI volume mount,envFromsecretRef, and datasource ConfigMap (picked up by kube-prometheus-stack's built-in datasource sidecar) all wire together correctly with consistent naming.SecretProviderClassapplied live tomonitoringns; confirmed CSI materializedgrafana-azure-monitor-secretswith the correct client secret value.psql-j26apps-shared-sdcmetrics (cpu_percent, memory_percent, active_connections, cpu_credits_remaining, etc.) — follow-up dashboard/alerts PR to come.🤖 Generated with Claude Code