Skip to content

Add docs/principles.md for operator design principles#4496

Merged
caseydavenport merged 4 commits intotigera:masterfrom
caseydavenport:casey/add-principles-doc
Mar 5, 2026
Merged

Add docs/principles.md for operator design principles#4496
caseydavenport merged 4 commits intotigera:masterfrom
caseydavenport:casey/add-principles-doc

Conversation

@caseydavenport
Copy link
Member

Adds a new docs/principles.md that codifies the key architecture and design principles for developing in this repo:

  • API design — declarative APIs, minimal surface, overrides for every container, kubebuilder-first validation
  • Respecting user input — never overwrite user fields, never delete user resources, track field ownership on shared resources, copy (don't modify) user-provided secrets/configmaps downstream
  • Component isolation — new components default to calico-system (separate namespaces only when specifically needed)
  • Controller design — watch/reconcile/render/apply pattern, pure render packages, user-facing status messages
  • Security — mTLS for all component-to-component communication
  • Certificates and secrets — OwnerReference conventions, naming conventions

Also refactors docs/dev_guidelines.md to focus on workflow (code structure, code generation, cherry-picks, common tasks) and reference principles.md for design guidance. Moves the code generation section from principles into dev_guidelines where it fits better.

Adds a .claude/CLAUDE.md with project-specific context for AI-assisted development.

Codifies the key architecture and design principles we follow when developing
in this repo — API design, user input handling, component isolation, controller
patterns, security, and certificate conventions. Also refactors dev_guidelines.md
to focus on workflow and reference principles.md for design guidance.
Controller pattern, certificates/secrets, and design principle highlights
are now in principles.md — no need to maintain them in two places. Also
fixes the project overview to reflect the calico-system namespace default.

## Security

- **Component-to-component communication must use mTLS.** All internal communication between operator-managed components must be secured with mutual TLS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a combination of mTLS and TLS + token auth.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rene-dekker Where is TLS + token authz used? And what would be the guiding principle on when / where to use one vs. the other?

Copy link
Member

@rene-dekker rene-dekker Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think mTLS is preferred, but both are secure.
If components would talk to components outside of the cluster then mTLS has the advantage that we can have identity being managed at a higher level than the cluster signer of JWTs. I'm thinking of technologies like Spiffe/Spire.

There are some places where service accounts talk directly to servers using their own JWT, like Manager -> Queryserver, prometheus server.

- Security: mTLS isn't the only pattern, also TLS + token auth
- Certs: remove inaccurate Passthrough claim and outdated naming conventions
Not just secrets — any object the operator creates should have an
OwnerReference, with exceptions for things like CRDs where cascading
deletion would be catastrophic.
@caseydavenport caseydavenport merged commit a5771d7 into tigera:master Mar 5, 2026
6 checks passed
@caseydavenport caseydavenport deleted the casey/add-principles-doc branch March 5, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants