cluster-api-provider-proxmox
AGENTS.md498 starsChanged 22 months agoApache-2.0View on GitHub
CAPMOX (Cluster API Provider for Proxmox VE) enables declarative management of Kubernetes clusters on Proxmox VE using the Cluster API provider contract. See go.mod for dependency versions. The storage API version is v1alpha2 (imported as infrav1). v1alpha1 exists only for backward compatibility with automatic conversion to/from v1alpha2. Several dependencies appear in multiple files and must be updated atomically. Use the helper scripts in hack/ rather than editing files manually: Each script accepts the version with or without a v prefix,…
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 31,774 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.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.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 116
Run make manifests generate mockgen after modifying API types
- Very specific: line 117
If conversion behavior changes, update api/v1alpha1/*_conversion.go
- Very specific: line 118
Run make lint verify test before committing
- Very specific: line 119
When bumping Go, cluster-api, golangci-lint, or k8s.io: use hack/bump-*.sh instead of editing files manually, then run make verify-versions
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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
AGENTS.md
CAPMOX (Cluster API Provider for Proxmox VE) enables declarative management of Kubernetes clusters on Proxmox VE using the Cluster API provider contract. See go.mod for dependency versions.
The storage API version is v1alpha2 (imported as infrav1). v1alpha1 exists only for backward compatibility with automatic conversion to/from v1alpha2.
Repository Structure
api/v1alpha1/— deprecated CRDs with conversion to v1alpha2api/v1alpha2/— current storage version CRDs (ProxmoxCluster, ProxmoxMachine, ProxmoxMachineTemplate, ProxmoxClusterTemplate)cmd/main.go— controller manager entry pointinternal/controller/— reconciliation logicinternal/webhook/— validation and defaulting webhooksinternal/service/— VM, scheduler, and task servicespkg/— shared packages (proxmox client, scope, cloudinit, ignition, ipam)config/— Kustomize configuration for CRDs, RBAC, webhookshack/— helper scriptstest/e2e/— end-to-end tests
Commands
Build & Test
make build # Build manager binary
make test # Run unit tests
make test WHAT=./pkg/scope/... # Run tests for specific packages
make lint # Run golangci-lint + kube-api-linter
make lint-fix # Lint with auto-fix
make yamlfmt # Format YAML files
make tidy # go mod tidy
make tilt-up # Start Tilt dev environment in a kind clusterCode Generation
make manifests # Regenerate CRDs, RBAC, webhook manifests
make generate # Regenerate DeepCopy methods and conversion functions
make mockgen # Regenerate mocks (configured in .mockery.yaml)Verification
make verify # Verify modules and generated files are up to date
make verify-versions # Check that version references are consistent across the repoShell Scripts
make lint-sh # Run ShellCheck on hack/ scripts
make test-sh # Run ShellSpec tests for hack/ scripts with kcov coverageVersion Bumping
Several dependencies appear in multiple files and must be updated atomically. Use the helper scripts in hack/ rather than editing files manually:
hack/bump-go.sh 1.26.0 [<digest>] # go.mod, Dockerfile, .golangci-kal.yml, .github/workflows/test.yml's pinned image (digest looked up live if omitted)
hack/bump-capi.sh 1.11.0 # go.mod require+replace, e2e config, test/e2e/data/shared/<contract>/metadata.yaml
hack/bump-golangci-lint.sh v2.10.0 # go.mod require+replace, .custom-gcl.yaml
hack/bump-k8s.sh 0.33.0 # go.mod k8s.io/{api,apimachinery,client-go,code-generator}, test/e2e/config KUBERNETES_VERSION, docs --kubernetes-versionEach script accepts the version with or without a v prefix, prints a line for every file it changes (silent when nothing changes), and runs go mod tidy automatically.
Architecture
Reconciliation Flow
Controllers (internal/controller/) reconcile two custom resources:
- ProxmoxCluster — manages cluster-level infrastructure (control plane endpoint, allowed nodes)
- ProxmoxMachine — manages individual VM lifecycle on Proxmox VE
Each controller creates a Scope (pkg/scope/) bundling the CAPI owner objects, infrastructure CR, Proxmox client, and IPAM helper into a single context object passed through the reconciliation pipeline.
The ProxmoxMachine controller delegates VM operations to services under internal/service/:
vmservice/— VM clone, configure, bootstrap (cloud-init or Ignition), IP assignment, power management, deletionscheduler/— selects which Proxmox node to place a new VM ontaskservice/— tracks async Proxmox task completion and error handling
Proxmox Client Abstraction
pkg/proxmox/client.go defines the Client interface for all Proxmox API operations. The production implementation lives in pkg/proxmox/goproxmox/ (wrapping go-proxmox). Tests use a mock at pkg/proxmox/proxmoxtest/.
API Versions and Conversion
api/v1alpha2/— current storage versionapi/v1alpha1/— deprecated; conversion implemented in*_conversion.goandzz_generated.conversion.go
Key v1alpha2 change: unified NetworkDevices array replacing v1alpha1's split of Default + AdditionalDevices.
Bootstrap & IPAM
pkg/cloudinit/ and pkg/ignition/ handle cloud-init and Flatcar Ignition bootstrap data. IP management is via the Cluster API IPAM contract (pkg/kubernetes/ipam/).
Testing
- Unit tests colocated with source files, using envtest; see
MakefileforENVTEST_K8S_VERSION - First
make testrun builds envtest binaries — setup output is not a test failure testifyfor assertions,gomega/ginkgofor BDD-style tests- Proxmox client mocks generated via
make mockgen(.mockery.yaml) - E2E tests in
test/e2e/require a live Proxmox VE instance; controlled by PR labels
Contributing
See CONTRIBUTING.md for contribution guidelines, paying particular attention to the AI-Assisted Contributions section which covers authorship, transparency, and quality expectations for AI-assisted work.
Rules
✅ Always:
- Run
make manifests generate mockgenafter modifying API types - If conversion behavior changes, update
api/v1alpha1/*_conversion.go - Run
make lint verify testbefore committing - When bumping Go, cluster-api, golangci-lint, or k8s.io: use
hack/bump-*.shinstead of editing files manually, then runmake verify-versions - Preserve existing
new(expr)usage where present. With Go 1.26,new(node)is valid for values as well, so don't replace it withptr.To(...)just to satisfy older Go assumptions.
⚠️ Ask before:
- Changing v1alpha1 conversion functions (affects backward compatibility)
- Removing or renaming fields in v1alpha2 API types
🚫 Never:
- Edit files with a
Code generated … DO NOT EDITheader - Edit the unmarked outputs of
make manifests(config/crd/bases/*.yaml,config/rbac/role.yaml,config/webhook/manifests.yaml) ormake crs-*(templates/crs/cni/*.yaml) — regenerate instead - Edit version-tracked dependencies without the corresponding
hack/bump-*.shscript
Environment
See envfile.example for development config. Key vars: PROXMOX_URL, PROXMOX_TOKEN, PROXMOX_SECRET, CAPMOX_LOGLEVEL.
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.

