How Trident Knows What to Do
The Trident CLI implements several verbs, like install and update. These
verbs allow Trident to explicitly understand what the user wants to do. For
a given verb, Trident will determine what needs to be done based on the
Host Configuration
file, which is a declarative API that describes the desired state of the
machine.
The Host Configuration contains a description of the machine's disks, partitions, filesystems, and other details. It will be compared to the existing state of the machine to find the differences and determine what actions need to be taken to bring the machine to the desired state.
Several Trident subsystems have been implemented to handle different aspects of the configuration. Each subsystem is responsible for a specific area (for example, storage).
Each subsystem will validate the relevant Host Configuration setting(s), prepare the system for changes, perform the required changes, and then modify any required system configurations. The various subsystems in the Trident architecture can be seen in the Install Flow diagram.
Using storage as an example, Trident will read the Host Configuration and
determine how to get to the desired state. This includes things like:
- adopting and creating disk partitions
- configuring A/B volume pairs
- deploying filesystems
- setting up encryption
- creating swap and raid arrays