Skip to main content

Project Conventions

Decision matrix

Core project conventions

Core project conventions.
ConventionWhat it means in practiceWhy it matters
Delay abstraction until the rule of threeDo not create shared helpers the first or second time a pattern appears.This keeps the codebase from filling with speculative utility layers.
Keep PRs single-themeA change should primarily be a feature, bug fix, refactor, or doc update, not several unrelated cleanups at once.Smaller review surfaces keep maintainers effective.
Treat architecture boundaries as policyUpdate the boundary policy before adding new top-level internal packages or controller packages.The repository enforces these rules automatically, so design intent and CI stay aligned.
Always update the generated or test artifacts a change impliesIf APIs, manifests, golden files, or rules change, regenerate them in the same PR.Generated drift should never be left for the next contributor to discover.
No `any` in core logic

Treat any and interface{} as escape hatches for external API boundaries, not as normal implementation tools. If a helper only works because it erases types, it usually needs a narrower contract.

Type safety and package shape

  • Use defined types for enum-like status and phase values instead of raw strings.
  • Avoid junk-drawer package names such as util, common, or shared.
  • Prefer package names that describe the actual boundary or job, such as k8sutil, config, or schema.

Review hygiene

  • Keep a PR to one main theme.
  • Avoid drive-by reformatting of unrelated files.
  • If a change touches api/, update the generated artifacts in the same branch.

Verify

Boundary policy regeneration and verification

bash

make generate-ast-rules
make verify-arch-policy
make test-ast
make lint-ast

Run this when you add a new top-level internal/* package, introduce a new controller package, or change the boundary policy itself.

Decision matrix

Observability and testing expectations

Observability and testing expectations.
AreaRepository expectationPrimary entry point
MetricsUse the openbao_ prefix and stable label sets.The metrics conventions in the existing controllers plus review.
LoggingPrefer structured, context-rich logging with consistent field names.[Kubernetes operator patterns](/contribute/standards/kubernetes-patterns).
CRD evolutionPrefer additive API changes and document migrations when a breaking shape change is unavoidable.API review plus [Reference](/docs/reference).

Related build-and-change guides

Next release documentation

You are reading the unreleased main docs. Use the version menu for the newest published release, or check the release notes for what is already out.

Was this page helpful?

Use Needs work to open a structured GitHub issue for this page. The Yes button only acknowledges the signal locally.