How syself/cluster-api-provider-hetzner works
CAPH is a Kubernetes Cluster API provider that reconciles declarative cluster and machine resources into Hetzner Cloud and bare-metal infrastructure. The main workflow starts with Kubernetes resources, validates them at admission, then controllers reconcile clusters, hosts, and machines through scopes and infrastructure services. The README also identifies CSR validation and approval as a capability. Sampled files and the source index support the shown wiring; unsampled subsystems are included where the tree and README establish their role, without inferring their internal call paths.
Main entry points: hetznercluster_types.go Infrastructure resources · client.go Hetzner Cloud client · main.go Controller manager · hetznerbaremetalhost_controller.go Bare-metal host reconciler
Components 26
Kubernetes API
- Infrastructure resources
api/v1beta2/hetznercluster_types.go - v1beta1 conversion
api/v1beta1/conversion.go
Reconciliation
- Controller manager
main.go - Cluster reconciler
controllers/hetznercluster_controller.go - Cloud machine reconciler
controllers/hcloudmachine_controller.go - Machine template reconciler
controllers/hcloudmachinetemplate_controller.go - Cloud remediation reconciler
controllers/hcloudremediation_controller.go - Bare-metal host reconciler
controllers/hetznerbaremetalhost_controller.go - Bare-metal machine reconciler
controllers/hetznerbaremetalmachine_controller.go - Bare-metal remediation reconciler
controllers/hetznerbaremetalremediation_controller.go - CSR reconciler
controllers/csr_controller.go - Reconcile scopes
pkg/scope/cluster.go
Infrastructure Services
- Hetzner Cloud client
pkg/services/hcloud/client/client.go - Cloud server service
pkg/services/hcloud/server/server.go - Cluster infrastructure
pkg/services/hcloud/network/network.go - Cloud remediation
pkg/services/hcloud/remediation/remediation.go
Bare-Metal Operations
- Bare-metal host service
pkg/services/baremetal/host/host.go - Bare-metal machine service
pkg/services/baremetal/baremetal/baremetal.go - Robot client
pkg/services/baremetal/client/robot/robot_client.go - SSH client
pkg/services/baremetal/client/ssh/ssh_client.go
Admission and Security
- Admission webhooks
pkg/webhook/v1beta2/hetznercluster_webhook.go - CSR approval
pkg/csr/csr.go
Other components
- Cluster operator
- Kubernetes API
- Workload cluster
- Hetzner services
Connections 39
- Cluster operator → Kubernetes API: applies desired state
README.md - Kubernetes API → Infrastructure resources: stores resources
README.md - Controller manager → Cluster reconciler: registers
main.go - Controller manager → Cloud machine reconciler: registers
main.go - Controller manager → Bare-metal host reconciler: registers
main.go - Controller manager → Bare-metal machine reconciler: registers
main.go - Controller manager → CSR reconciler: registers
main.go - Controller manager → Admission webhooks: sets up
main.go - Cluster reconciler → Infrastructure resources: reconciles
controllers/hetznercluster_controller.go - Cloud machine reconciler → Infrastructure resources: reconciles
controllers/hcloudmachine_controller.go - Bare-metal host reconciler → Infrastructure resources: reconciles
controllers/hetznerbaremetalhost_controller.go - Bare-metal machine reconciler → Infrastructure resources: reconciles
controllers/hetznerbaremetalmachine_controller.go - Cluster reconciler → Reconcile scopes: builds scope
controllers/hetznercluster_controller.go - Cloud machine reconciler → Reconcile scopes: builds scope
controllers/hcloudmachine_controller.go - Bare-metal host reconciler → Reconcile scopes: uses scope
controllers/hetznerbaremetalhost_controller.go - Bare-metal machine reconciler → Reconcile scopes: uses scope
controllers/hetznerbaremetalmachine_controller.go - Cluster reconciler → Cluster infrastructure: manages infrastructure
controllers/hetznercluster_controller.go - Cluster reconciler → Hetzner Cloud client: uses client
controllers/hetznercluster_controller.go - Cloud machine reconciler → Cloud server service: delegates server work
controllers/hcloudmachine_controller.go - Cloud machine reconciler → Hetzner Cloud client: creates client
controllers/hcloudmachine_controller.go - Machine template reconciler → Infrastructure resources: reconciles
controllers/hcloudmachinetemplate_controller.go - Machine template reconciler → Hetzner Cloud client: creates client
controllers/hcloudmachinetemplate_controller.go - Machine template reconciler → Hetzner services: provisions templates
- Cloud remediation reconciler → Cloud remediation: delegates remediation
controllers/hcloudremediation_controller.go - Cloud remediation reconciler → Hetzner Cloud client: creates client
controllers/hcloudremediation_controller.go - Bare-metal host reconciler → Bare-metal host service: delegates host work
controllers/hetznerbaremetalhost_controller.go - Bare-metal host reconciler → Robot client: uses client
controllers/hetznerbaremetalhost_controller.go - Bare-metal host reconciler → SSH client: uses client
controllers/hetznerbaremetalhost_controller.go - Bare-metal machine reconciler → Bare-metal machine service: delegates machine work
controllers/hetznerbaremetalmachine_controller.go - Bare-metal machine reconciler → Hetzner Cloud client: creates client
controllers/hetznerbaremetalmachine_controller.go - Bare-metal host service → SSH client: uses client
pkg/services/baremetal/host/host.go - Cloud server service → Hetzner Cloud client: calls API client
pkg/services/hcloud/server/server.go - Cluster infrastructure → Hetzner Cloud client: uses client
- Hetzner services → Hetzner Cloud client: serves cloud requests
- Robot client → Hetzner services: accesses Robot
- v1beta1 conversion → Infrastructure resources: converts versions
api/v1beta1/conversion.go - Admission webhooks → Infrastructure resources: validates admission
pkg/webhook/v1beta2/hetznercluster_webhook.go - CSR reconciler → CSR approval: validates and approves
controllers/csr_controller.go - CSR reconciler → Workload cluster: approves requests
README.md