Files
Aleksei Sviridkin a522d58968 feat(cozystack-controller): add a GPU-only mode and a Lease name flag
A cluster whose cozystack-controller predates the GPU binder cannot
pick up GPUDevice by starting a second, newer instance: every
reconciler is registered unconditionally, so the second instance runs
its own copy of the workload, tenant, gateway and secret reconcilers
next to the first.

--gpu-only (with --enable-gpu) registers only the GPU binder, its
webhooks and the probes; nothing else is set up, so no other informer
or cache exists in that process. It is not meant to run beside a
controller from this tree, which runs a binder of its own.
--leader-election-id names the Lease instead of the fixed ID, whose
default stays the historical one. A GPU-only instance that elects
must name its own Lease: on the default one it would take leadership
from the main controller in a shared namespace and stop all of its
reconcilers while holding it. The logger is now set right after flag
parsing, so this and the other flag refusals reach the pod log
instead of exiting silently.

Known limit of the pairing: the older controller's WorkloadMonitor
still counts the GPUs KubeVirt requests on a virt-launcher pod, while
the binder writes a usage record per device, so a VM covered by an
application's WorkloadMonitor is counted twice until the main
controller is upgraded.

The manager wiring is now a list of named steps, so a test can assert
which steps each mode runs without starting a manager. The image
builds the command as a package, since it no longer fits in main.go.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-10-22 11:49:15 +03:00
..