Skip to content

Commit cd7d1f8

Browse files
ludydooclaude
andauthored
Add CLAUDE.md documentation for AI-assisted development (#319)
* Add CLAUDE.md documentation for AI-assisted development This file provides comprehensive guidance for Claude Code when working with the RHACS observability resources repository, including: - Repository structure and purpose - Essential commands for development and testing - Build and validation workflows - Monitoring and alerting infrastructure overview 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: lint --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 56a7ad7 commit cd7d1f8

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Repository Overview
6+
7+
This repository contains observability configuration for Red Hat Advanced Cluster Security (RHACS) managed service. It includes Prometheus alerts, recording rules, Grafana dashboards, and federation configuration for monitoring RHACS components across OpenShift clusters.
8+
9+
## Common Commands
10+
11+
### Main Build Commands
12+
- `make generate` - Regenerate all resources (dashboards, alerts, federation config)
13+
- `make generate-resources` - Generate Kubernetes mixin and Grafana dashboards only
14+
- `make generate-federate` - Update federation configuration based on current alerts/dashboards
15+
- `make update` - Update Kubernetes mixin dependencies
16+
17+
### Testing and Validation
18+
- `./scripts/test-prom-rules.sh` - Run Prometheus rule unit tests
19+
- `./scripts/lint-grafana.sh` - Lint Grafana dashboards
20+
- `./scripts/run-kube-linter.sh` - Run kube-linter on Kubernetes resources
21+
- `pre-commit run --all-files` - Run all pre-commit hooks
22+
23+
### Component-Specific Commands
24+
- `make -C resources/mixins/kubernetes generate` - Generate Kubernetes mixin resources
25+
- `make -C resources/grafana generate` - Generate Grafana dashboards from JSON sources
26+
27+
## Architecture
28+
29+
### Key Components
30+
31+
**Prometheus Rules (`resources/prometheus/`)**
32+
- `prometheus-rules.yaml` - Main alerting rules for RHACS components (Central, Scanner, Fleetshard)
33+
- `rhacs-recording-rules.yaml` - Recording rules for metrics aggregation
34+
- `billing-rules.yaml` - Billing and quota tracking rules
35+
- `unit_tests/` - Unit tests for all alert rules using promtool
36+
37+
**Grafana Dashboards (`resources/grafana/`)**
38+
- `sources/` - Source JSON dashboards exported from Grafana
39+
- `generated/dashboards/` - YAML manifests generated from sources for Grafana Operator
40+
- `templates/` - Template files for dashboard generation
41+
42+
**Kubernetes Mixin (`resources/mixins/kubernetes/`)**
43+
- `mixin.libsonnet` - Jsonnet configuration customizing kubernetes-mixin for RHACS
44+
- Uses kubernetes-mixin from github.com/kubernetes-monitoring/kubernetes-mixin
45+
- Customizes selectors and alert severities for OpenShift environment
46+
47+
**Federation & Remote Write (`resources/prometheus/`)**
48+
- `federation-config.yaml` - Metrics federated from OpenShift monitoring
49+
- `remote-write.yaml` - Configuration for pushing metrics to Observatorium
50+
- Auto-generated based on metrics used in alerts/dashboards via `make generate-federate`
51+
52+
### Alert Policy
53+
54+
Alerts follow strict guidelines:
55+
- **Critical alerts**: Page SREs, indicate service unavailability (timeline: ~5 minutes)
56+
- **Warning alerts**: Addressed within ~60 minutes, don't pose immediate threat
57+
- All alerts require SOP URLs and follow CamelCase naming (e.g., `RHACSCentralScrapeFailed`)
58+
- Alert names should be prefixed with component name
59+
60+
### Dependencies
61+
62+
Required tools for development:
63+
- `jq` - JSON processing for federation config generation
64+
- `yq` - YAML processing for dashboard generation
65+
- `mimirtool` - Grafana dashboard validation
66+
- `jsonnet` and `jb` (jsonnet-bundler) - For Kubernetes mixin
67+
- `promtool` - Prometheus rule testing
68+
- `pre-commit` - Git hooks for validation
69+
70+
## Development Workflow
71+
72+
1. **Modifying Dashboards**: Edit JSON files in `resources/grafana/sources/`, then run `make generate`
73+
2. **Modifying Alerts**: Edit `resources/prometheus/prometheus-rules.yaml`, add unit tests, run `make generate-federate`
74+
3. **Kubernetes Mixin Changes**: Edit `resources/mixins/kubernetes/mixin.libsonnet`, run `make generate`
75+
4. **Testing**: Always run `./scripts/test-prom-rules.sh` before committing changes
76+
77+
The repository uses Kustomize for resource organization with the main `resources/kustomization.yaml` defining all managed resources.

0 commit comments

Comments
 (0)