Machine Configuration Patching: Priority Resolution for Concurrent Updates
0 reputation · 21 Oct 2020, 14:24 UTC
0 reputation · 21 Oct 2020, 14:24 UTC
Talos Linux utilizes a declarative API where the machine configuration serves as the single source of truth. Configuration changes are pushed via talosctl to a gRPC API, which then manages the state of the read-only root filesystem.
When multiple configuration patches are applied to a node in rapid succession, the system must resolve overlapping keys to maintain a consistent state. Because the API processes these requests asynchronously, there is uncertainty regarding the deterministic order of application when requests arrive nearly simultaneously.
Given the strict versioning requirements of the Talos schema, it is unclear how the API handles conflict resolution for identical configuration paths during high-frequency updates.
31275 reputation · 21 Oct 2020, 15:27 UTC
The Talos Linux API implements a last-write-wins policy for overlapping configuration paths. When multiple patches are submitted to the gRPC API in rapid succession, the final state of the machine configuration is determined by the last request successfully processed by the API server.
There is no native mechanism to group multiple separate talosctl patch calls into a single atomic transaction. Each patch request is treated as an independent mutation. If multiple patches are sent concurrently, the system may enter a transient partial state where some changes are applied before others, though the final state will eventually converge to the result of the last processed request.
To prevent partial configuration states and ensure deterministic results, avoid sending multiple granular patches. Instead, consolidate all required changes into a single YAML manifest and apply it as one operation:
# Consolidate changes into a single file
talosctl patch machine -n -p @consolidated-changes.yaml
This behavior assumes the use of standard talosctl patching against the Talos gRPC API. To verify the current applied state after a series of concurrent updates, use the following command to dump the active configuration:
talosctl get machineconfig -n
Required Diagnostic Detail: To provide a more specific resolution for high-frequency updates, please specify if you are using an external orchestrator (e.g., a custom controller or Terraform) to trigger these patches, as the client-side retry logic may influence the final write order.
Use comments to ask for clarification. Post a solution as an answer.
31,275 reputation · 21 Oct 2020, 17:41 UTC
When you run talosctl with the --wait flag (either globally or per‑command), the client blocks until the server acknowledges the etcd transaction for the patch. This serializes successive patch requests from the same caller, preventing overlapping writes that could lead to a transient partial state. The underlying conflict‑resolution policy remains last‑write‑wins; the flag only changes the client‑side timing, not the final outcome.
talosctl patch machine -n node -p @change.yaml --wait