Skip to content

Commit 58e7b53

Browse files
committed
Add CONTRIBUTING.md, AGENTS.md
and links to those from some tools we use, and some README updates with it Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
1 parent f652cc0 commit 58e7b53

6 files changed

Lines changed: 83 additions & 2 deletions

File tree

.cursor/rules/project.mdc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
description: Core project conventions -- read AGENTS.md in the project root
3+
alwaysApply: true
4+
---

AGENTS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Project objective
2+
3+
See [README](./README.md##trusted-execution-cluster-operator-trusted-cluster-operator).
4+
5+
- **Success looks like**: With the operator deployed, all nodes in the cluster are attested from hardware to software.
6+
- **Non-goals**: Rely on OpenShift, see the [confidential-clusters](https://github.com/confidential-clusters/operator) downstream.
7+
8+
# Architecture
9+
10+
- Entry points: see [README](./README.md#repository-structure).
11+
- Integrations: [Trustee](https://github.com/confidential-containers/trustee), [compute-pcrs](https://github.com/trusted-execution-clusters/compute-pcrs), [clevis-pin-trustee](https://github.com/latchset/clevis-pin-trustee)
12+
13+
# Conventions
14+
15+
- See [CONTRIBUTING](./CONTRIBUTING.md).
16+
- Use `Assisted-by:` or `Generated-by`: in commit messages for AI-supported contributions.
17+
- Never commit real credentials; use env vars and local `.env` (gitignored) with synthetic values in docs.
18+
19+
# Things that human users of agents should do
20+
21+
and agents should suggest when they detect
22+
23+
- Have a coherent goal per session
24+
- Read architecture, security-sensitive paths, performance-critical design, ambiguous product trade-offs
25+
26+
# Things agents should do, but can get wrong
27+
28+
- The operator's crate name is `operator`.
29+
- Use MCPs when available
30+
- Prefer the MCP LSP over `grep`
31+
- Prefer the k8s LSP over `kubectl`.
32+
- Reuse, and check for other uses of a similar pattern. When functionality can be moved out of a function for reuse, commit the generalization before the new use.
33+
- Include lint-compatible code style when writing, not as an afterthought.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- [Sign off commits](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff)
2+
- [Sign commits cryptographically](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---gpg-signkey-id)
3+
- Limit commit subjects to 50 and messages to 72 characters.
4+
- Bisects should stay intact
5+
- Linting should pass, so a new definition must be used in the same commit.
6+
- When a change requires a change to a test, the changes should be in the same commit. On the contrary, a larger new test can be in a separate commit for easier review.
7+
- Add small changes to larger PRs in separate commits to ease review burden, but do not add them to already open PRs.
8+
- Use `cargo fmt`. Always perform `make lint clippy` before publishing when code is changed.
9+
- Use an extra binding if this saves more than one (formatted) LOC, e.g.
10+
```rust
11+
let svc = ATTESTATION_KEY_REGISTER_SERVICE;
12+
self.create_certificate(svc, ATT_REG_CERT, ATT_REG_SECRET, issuer_name)
13+
.await?;
14+
```
15+
over
16+
```rust
17+
self.create_certificate(
18+
ATTESTATION_KEY_REGISTER_SERVICE,
19+
ATT_REG_CERT,
20+
ATT_REG_SECRET,
21+
issuer_name,
22+
)
23+
.await?;
24+
```
25+
- When functionality is changed, perform `make test` and [integration test](./tests/README.md) at least with basic attestation.
26+
- Prepend your commit subject with a short focus area. Omit this when making general operator changes. Examples are `tests`, `tests/azure`, `rvs` (reference values)
27+
- Use [REUSE](https://reuse.software) comments for new files, or exclude in [REUSE.toml](./REUSE.toml) when not possible.

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,29 @@ within the cluster.
1010

1111
## Repository Structure
1212

13-
- `/api`: Defines the `TrustedExecutionCluster` Custom Resource Definition (CRD) and associated CRDs and RBAC definitions in Go. Also contains a program to generate a `TrustedExecutionCluster` CR and associated deployment.
13+
The operator relies on Rust crates for its functionality.
14+
15+
### Operator components
16+
1417
- `/operator`: Contains the source code for the Kubernetes operator itself.
1518
- `/register-server`: A server that provides Clevis PINs for key retrieval with random UUIDs.
1619
- `/attestation-key-register`: A server that accepts attestation key registrations from VMs and creates AttestationKey resources.
1720
- `/compute-pcrs`: A program to compute PCR reference values using the [compute-pcrs library](https://github.com/trusted-execution-clusters/compute-pcrs) and insert them into a ConfigMap, run as a Job.
21+
22+
### Other crates
23+
1824
- `/lib`: Shared Rust definitions, including translated CRDs
25+
- `/tests`: Non-unit tests, most rely on a cluster being available. Many of those also rely on a virtualization backend.
26+
- `/test_utils`: Operator setup helpers and virtualization backends
27+
28+
### Other components
29+
30+
- `/docs`, `/examples`
31+
- `/api`: Defines the `TrustedExecutionCluster` Custom Resource Definition (CRD) and associated CRDs and RBAC definitions in Go. Also contains a program to generate a `TrustedExecutionCluster` CR and associated deployment.
1932
- `/scripts`: Helper scripts for managing a local `kind` development cluster.
2033
- `/config`: The default output directory for generated manifests. This directory is not checked into source control.
34+
- `/tools`: Tracking tool versions for autoupdates
35+
- `/must-gather`: for OpenShift CI
2136

2237
## Getting Started
2338

REUSE.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ version = 1
22

33
[[annotations]]
44
path = [
5-
"README.md",
5+
".cursor/rules/*.mdc",
6+
"*.md",
67
"Cargo.lock",
78
"go.sum",
89
"PROJECT",

0 commit comments

Comments
 (0)