Files
Terry Howe 5a86a7c13e fix(controller): delete orphaned spire host entries (#2461)
* fix(controller): delete orphaned spire host entries

The machine SPIRE entry controller deleted a host's ClusterStaticEntry
only when it observed the Machine with a deletion timestamp. If the
Machine finished deleting while the worker was down, the entry leaked.
When a host is re-provisioned its TPM parent ID stays the same but its
host ID changes, so the leaked entry and the new one both match the
agent and it may present the old host SVID, failing the mTLS handshake.

After applying a Machine's entry, delete managed sibling entries with
the same parent ID whose host ID has no Machine that is not being
deleted. A leader-elected sweep also runs every 10 minutes and deletes
managed entries older than 1 hour whose host ID matches no Machine.

Host entries labeled nke.nvidia.com/managed-by=cloud-workflow-engine by
the pre-import controller are included: its node-table garbage
collection was removed with it, so entries for hosts deleted around that
switch were never cleaned up. Entries without one of these managed-by
labels are never touched.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(controller): keep sweeping past failed entry deletes

Collect delete errors in the sibling cleanup and the orphan sweep and
return them joined, so one entry that cannot be deleted no longer blocks
the rest. Skip the sweep when no Machine carries a host ID: the site's
own nodes are Machines, so an empty list means a bad read, not orphans.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-11-25 10:04:20 -07:00
..

CAPI Controllers

This package is for new controller-runtime or otherwise Kubernetes-native controllers in CWE.

These controllers should reconcile Kubernetes API state only. They should not depend on CWE-specific systems such as Temporal workflows or PostgreSQL state.

Most of the older controllers in internal/controllers/ predate this split and are still CWE-specific. Many of them use Temporal and/or Postgres directly, and some are hybrid controllers that combine Kubernetes reconciliation with CWE-owned state.

Longer term, controllers in this package are expected to move into the Cluster API NVKE providers (bootstrap, controlplane, or capn) once that code is ready to live outside CWE.