Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: track infra machine install status via a counter
With this change, we change the way we track whether Talos is installed on the disk or not in the bare-metal infra provider. Previously, it worked like the following: - Omni, when observing some specific type of events on SideroLink, set the `installed` flag on the dedicated `MachineState` resource to true. - The provider, after wiping disks of a machine, set that flag to false. This method went against the "single owner per resource" principle and was not leveraging COSI runtime and controller-based logic. Furthermore, it made the contract between Omni and the provider more complex since it was yet another resource. Instead, now, we do the following: - Every time we observe those specific types of events on SideroLink, we increment a counter field on the `infra.Machine` resource. - When the provider wipes a machine, it persists this counter value at the time of wipe internally. - To detect whether Talos is installed or not, the provider compares the internally stored counter value vs the value on the `infra.Machine`. It is "installed" only if the counter value on the `infra.Machine` is bigger than the internally stored one (it means we observed an installation after the last wipe). Signed-off-by: Utku Ozdemir <[email protected]>
- Loading branch information