sentry-kubernetes
AGENTS.md500 starsChanged 8 months agoApache-2.0View on GitHub
Use Go modules: go mod tidy, go mod download AI commits MUST include:
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 5
Use Go modules: go mod tidy, go mod download
- Distinctive: line 35
Follow Sentry commit conventions
- Distinctive: line 51
Never writes to the Kubernetes API
- Very specific: line 69
Run go fix ./... to apply Go modernizations (also in pre-commit)
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Instructions
Package Manager
Use Go modules: go mod tidy, go mod download
Build & Dev Commands
| Command | Description |
make build | Build the Go module |
make build-dist | Build optimized production binary to dist/ |
make build-docker | Build Docker image |
make test | Run all tests |
make test-coverage | Run tests with coverage report |
make vet | Run go vet static analysis |
make lint | Run golangci-lint |
make lint-fix | Lint with auto-fix |
make format | Format code and tidy modules |
make mod-tidy | Check go.mod tidiness (CI check) |
make fmt-check | Check formatting (CI check) |
make upgrade-deps | Update all dependencies |
make help | Show all available commands |
Commit Attribution
AI commits MUST include:
Co-Authored-By: (the agent model's name and attribution byline)Commit Messages
- Follow Sentry commit conventions
- Format:
<type>(<scope>): <subject> - Types:
feat,fix,ref,perf,docs,test,build,ci,chore - Imperative mood, no period, max 70 chars
Project Structure
cmd/agent/main.go- Application entry pointinternal/agent/- All business logic and handlersk8s/manifests/- Kubernetes deployment manifestsk8s/errors/- Test error scenario manifests.github/workflows/- CI/CD pipelines
Architecture
- Read-only Kubernetes agent - watches cluster events, sends to Sentry
- Never writes to the Kubernetes API
- Uses informers for Jobs, CronJobs, Deployments, ReplicaSets
- Uses watchers for Events and Pods
- Enhancers enrich Sentry events with K8s metadata
- Supports custom DSNs via
k8s.sentry.io/dsnannotation
Setup
- First-time setup:
make init(installs Brew deps, Go modules, pre-commit hooks) - Pre-commit hooks run: build, test, go fix, vet, lint, and dprint formatting
Key Conventions
- Logging:
github.com/rs/zerolog - K8s client:
k8s.io/client-gov0.35 - Error reporting:
github.com/getsentry/sentry-go - Docker: multi-stage build,
gcr.io/distroless/static:nonrootruntime - RBAC: read-only (
watch,list,getonly) - Run
go fix ./...to apply Go modernizations (also in pre-commit)
Environment Variables
SENTRY_DSN- Required. Sentry project DSNSENTRY_ENVIRONMENT- Sentry environment nameSENTRY_K8S_WATCH_NAMESPACES- Comma-separated namespaces,__all__for allSENTRY_K8S_MONITOR_CRONJOBS-1to enable Crons integrationSENTRY_K8S_CUSTOM_DSNS-1to enable per-resource DSN annotationsSENTRY_K8S_LOG_LEVEL-trace/debug/info/warn/error/fatal/panic/disabledSENTRY_K8S_GLOBAL_TAG_*- Custom tags (prefix stripped)SENTRY_K8S_CLUSTER_CONFIG_TYPE-auto/in-cluster/out-cluster
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

