renovate-operator
CLAUDE.md626 starsChanged 3 months agoMITView on GitHub
A Kubernetes-native operator that runs Renovate for automated dependency updates: CRDs, cron scheduling, parallel Job execution, and a web UI, abstracted over multiple Git platforms.
The file
We split this CLAUDE.md into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 49
Config via
config.GetValue(): Never read os.Getenv outside config/. - Very specific: line 66
Every new values.yaml key needs a matching entry in charts/renovate-operator/values.schema.json (additionalProperties: false throughout) or …
- Very specific: line 75
Run just check before finishing (regenerates CRDs, lints, unit tests, Helm unit tests).
- Very specific: line 77
Keep the directory map and invariants above in sync with the code as it changes.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.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
Renovate Operator — Claude Code Guide
A Kubernetes-native operator that runs Renovate for automated dependency updates: CRDs, cron scheduling, parallel Job execution, and a web UI, abstracted over multiple Git platforms.
Directory Structure
src/
├── api/v1alpha1/ # CRD types; well-known label/annotation/finalizer keys (see Invariants)
├── assert/ # panic-on-critical-error helpers for startup/init failures
├── clientProvider/ # Kubernetes client factory
├── cmd/ # main.go — wires everything together
├── config/ # singleton env-var config, schema-validated
├── controllers/ # controller-runtime reconciliation loop
├── github/ # GitHub App secret naming helpers
├── gitProviderClients/ # Git provider abstraction
│ ├── factory/ # creates the right provider from job.Spec.Provider
│ └── {github,gitlab,gitea,forgejo,bitbucket}Provider/
├── health/ # thread-safe health state, exposed on the HTTP health endpoint
├── integration/ # over-the-wire tests, build tag `integration`
├── internal/
│ ├── crdManager/ # CRUD on RenovateJob CRDs and Kubernetes Jobs
│ ├── kvstore/ # KV store abstraction (Valkey/Redis-backed)
│ ├── logStore/ # most-recent log output per (namespace, job, project)
│ ├── objectstore/ # S3 client for log archival
│ ├── podLogs/ # streams logs from executor Job pods
│ ├── webhookSync/ # provider-agnostic repo webhook sync
│ ├── policy/ # install-wide guard rails on RenovateJob specs
│ ├── parser/ # extracts discovered repos and dependency issues from Renovate logs
│ ├── renovate/ # discovery, executor, job definitions (jobDefinitions.go)
│ ├── telemetry/ # OpenTelemetry wiring
│ ├── types/ # shared internal types
│ └── utils/ # platform endpoints, job naming helpers
├── metricStore/ # Prometheus metrics
├── scheduler/ # cron scheduling wrapper
├── static/ # frontend assets (components/, css/, js/, pages/)
├── ui/ # web UI server, auth (OIDC, GitHub OAuth), API endpoints
└── webhook/ # HTTP webhook server (per-platform trigger endpoints)
charts/ # Helm chart
docs/ # user-facing docs — see Docs below
tests/ui/ # Playwright browser tests for src/static (see its README)Conventions
- Interfaces first. Anything touching a Git provider, scheduler, executor, or external system is an interface, implemented per platform — never branch shared code on provider type. Extend existing interfaces (
gitProviderClients.GitProviderClient— repo info incl. fork/pending-deletion detection in one call, webhooks, repo search;ui.AuthProvider;renovate.DiscoveryAgent/RenovateExecutor;scheduler.Scheduler); don't replace them. - Git provider factory. New provider: package under
gitProviderClients/<name>Provider/, implementGitProviderClientfully, register ingitProviderClients/factory/. Never instantiate a provider client outside the factory. - Jobs, not Pods. Renovate runs as Kubernetes Jobs for TTL cleanup and restart semantics. Extend templates in
internal/renovate/jobDefinitions.go, never build job specs inline elsewhere. - Config via
config.GetValue(). Never reados.Getenvoutsideconfig/; declare new values in the config schema. - Errors: wrap with
fmt.Errorf("...: %w", err).assert.NoError/assert.Assertonly for unrecoverable startup failures. External API errors fail open where exclusion would be worse than inclusion (e.g. fork filtering keeps repos on API failure). - Concurrency:
sync.Mutex/RWMutexfor shared state; channel semaphores to cap external API parallelism (pattern inforkFilter.go, max 10). Executor polls every 10s, respecting the CRD'sparallelism. - Logging:
logr.Logger, injected — never a global.Infofor normal events,V(1).Infofor verbose,Errorfor errors. Neverfmt.Println/log.Print. - Reconcilers: idempotent;
ctrl.Result{RequeueAfter: ...}for scheduled requeues,ctrl.Result{}, errfor immediate retry. - Health state lives in
health/, not locally in components. - Naming: Job names via
internal/utils/jobNames.go, platform base URLs viainternal/utils/platformEndpoints.go. Labels:renovate-operator.mogenius.com/<key>.
Invariants
Non-obvious rules that silently break security or state if skipped:
- A new
Policy/AccessDefaultsfield that gates behavior must be spelled so its zero value enforces (e.g.Disabled,AllowUnlabeledSecretRefs,AuthorizationDisabled) — tests construct these structs bare, and a permissive zero value would silently void enforcement. - Adding a field to
sessionDatathat access control reads requires bumpingcurrentSessionVersioninui/auth.go, or sessions minted before the field existed resolve to no access instead of failing back to login. - Secrets read at a caller-chosen key (i.e. not Renovate's well-known token names) require the
api.LabelAllowReflabel and aPolicy.ValidateReferencedSecretcall before any key is read. - New URL-valued spec fields need a check in
Policy.ValidateJobDestinations; host matching is exact, no wildcards or subtrees. - New label/annotation/finalizer keys go in
api/v1alpha1(well_known_labels.go/annotation_key_constants.go) and must be added toownedKeysinwell_known_labels_test.go. - Every new
values.yamlkey needs a matching entry incharts/renovate-operator/values.schema.json(additionalProperties: falsethroughout) or installs reject it. - ConfigMaps/Secrets read by key from a spec bypass the informer cache (
main.go'sDisableFor) — fetch live, don't assume they're cached.
Docs
docs/ (start at docs/README.md) is the source of truth for user-facing behavior, configuration options, platform setup, and security/access-control rationale. This file covers only what's needed to edit the code correctly — don't duplicate docs/ content here.
Verification
Run just check before finishing (regenerates CRDs, lints, unit tests, Helm unit tests). Run just generate alone after changing CRD types or well-known keys. Run just test-ui (only when src/static changed — browser tests, needs Chromium).
Keep the directory map and invariants above in sync with the code as it changes; put design rationale in docs/, not here.
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.

