Create a VM Deployment Target
As an Aegir manager,
In order to make a VM Deployment Target available
I need to create a VM Deployment Target
Architecture notes:
- This is creating an entity using the "VM" bundle of the Deployment Target entity type
- Fields:
- Target name (host)
- Routeable address (hostname or IP)
We are hoping to use ECK entities to implement this, and reproduce the behaviour of the current Platform (custom) entity type, which will eventually be replaced with Deployment Target. This means:
- Auto-create Operations and Tasks associated with the Target (see how Platform uses AutoCreateTrait.php)
- To use the AutoCreate code via an ECK entity type, it will probably need to be moved into a Service or similar, and attached via
preSave
orpreCreate
hooks attached to the relevant ECK entity type
- To use the AutoCreate code via an ECK entity type, it will probably need to be moved into a Service or similar, and attached via
- Marshal field values from the Operations and Tasks referenced by the Target (recursively), to pass them to
dispatcherd
(see how Platform uses MarshalTrait.php- Similarly, this Marshaling logic likely needs to move into a Service or something to be able to be called from a hook we attach to the relevant ECK entity type.
- Base field
operation_status
(inherited on the Platform entity from AbstractEntity.php) should be set to the status of the most recent operation run on the entity.- In ECK, we probably need to use hook_entity_base_field_info() to attach this base field to the ECK Entity type (Deployment Target), and arrange for Operations run on the Target entity to update it, the way Platform does currently
- We aren't sure what mechanism(s) is/are best to customize ECK entity types, but the following may be useful techniques:
- One reason to re-build the Platform functionality in parallel is to address (and ultimately remove) a lot of the boilerplate and oddities in using Entity API from D8 beta (see #76 (closed) for example)
TODO:
-
Start from the existing branch for #125 (closed) which has a "cluster" ECK entity type, which we would like to rename to Deployment Target (machine name: deployment_target
)- Note we have a script in Envision which can copy/paste an existing Entity Type module tree to a new name (https://gitlab.com/consensus.enterprises/clients/envision-recycling/logistics-app/-/blob/main/web/profiles/envision/modules/copy-entity-module.sh?ref_type=heads)
-
Create an Task type (bundle) for a "debug" task to attach to Deployment Targets -
Create an Operation type (bundle) for a "debug" operation to attach to Deployment Targets - This Operation should contain a reference field to the corresponding Task type
-
Arrange for Operations and Tasks to be auto-created when creating a Deployment Target entity -
Arrange for running the "debug" Operation, such that it marshals field values and dispatches them using the existing queue mechanism (similar to our example_update_operation
module)
Edited by Ambient.Impact