-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supporting deployments on zos4 nodes (#3497)
* Supporting deployments on zos4 nodes * Fixing tests, adding vmlight primitive and adding a match method * Adding networklight class in primitives * Updating networklight class in primitives * Adjusting FilterOptions to support features in automatic and manual node selection * Adding wiregaurd to filters * Adjusting getFeaturesFromFilters method and adding planetary, mycelium and wireguard to filters in all solutions * Updating networklight primitive class, create deployment and create methods to support zos4 deployments * Adjusting load, NodeExists, addNode and getFreeSubnet methods in network light primitive * Updating getFeaturesFromFilters method * Fixing reservation network error, updating k8s to support zos4 deployment, removing unnecessary comments and adding descriptive ones * Added a script to deploy on a zos4 node * Adding deployment flow doc * Resolving comments: removing unnecessary comments, adding wiregaurd in AddMachine filters and moving getFeatures method to utils * Updating network light primitive class * Revert "Resolving comments: removing unnecessary comments, adding wiregaurd in AddMachine filters and moving getFeatures method to utils" This reverts commit 17c3ec9. * Revert "Updating network light primitive class" This reverts commit 14ab9b9. * Added some changes in networklight primitive and added some more adjustments in _deleteMachineNetwork function * Fixing _deleteMachineNetwork function * Adjusting manual selection feature error, fixing the public_ip random error * Adjusting manual selection feature error, fixing the public_ip random error * Added the required features in all scripts' filters * Adjusting Supported interface in manage domains in case of zmachine-light * Adjust zos4 script and merging functionalites of delete zmachine and zmachine light in one condition to get rid of redundant code * Resolving comments: Addinf Features enum, using WorkloadTypes in ZmachineData, some updates in networklight primitive * Refactoring vm primitive file, adjusting features type in filtersOptions and fixing scripts * Fixing typo in deployment flow readme file * Fixing scripts unhandled promise error * Adding features to tests, corrects mispelled words and hiding wireguard in deployement data in case of zmachine light * Adding features to tests, corrects mispelled words and hiding wireguard in deployement data in case of zmachine light * Excluding node 259 in single_vm_zos4 script * adjusting features in zos4 script and updating deployment flow readme file * Checking against features rather than zos version while deploying, using workloadTypes enum and adding a semi-fix to loadgateway nodes * Fix: using json.stringify for filters so it doesn't enter an infinite loop when loading gateway nodes * Removing comments * Removing features from machinemodel
- Loading branch information
1 parent
8dbc069
commit fd63f33
Showing
86 changed files
with
1,722 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Deployment Flow | ||
|
||
This document outlines the process for determining whether to deploy on a zos3 or a zos4 node. | ||
|
||
## Machine Model Initialization | ||
|
||
The deployment process begins with initializing the machine model as follows: | ||
|
||
```ts | ||
const vms: MachinesModel = { | ||
name: "newMY", | ||
network: { | ||
name: "hellotest", | ||
ip_range: "10.249.0.0/16", | ||
myceliumSeeds: [ | ||
{ | ||
nodeId: 168, | ||
seed: "050d109829d8492d48bfb33b711056080571c69e46bfde6b4294c4c5bf468a76", //(HexSeed of length 32) | ||
}, | ||
], | ||
}, | ||
machines: [ | ||
{ | ||
name: "testvmMY", | ||
node_id: 168, | ||
disks: [ | ||
{ | ||
name: "wedDisk", | ||
size: 8, | ||
mountpoint: "/testdisk", | ||
}, | ||
], | ||
public_ip: false, | ||
public_ip6: false, | ||
planetary: true, | ||
mycelium: true, | ||
myceliumSeed: "1e1404279b3d", //(HexSeed of length 6) | ||
cpu: 1, | ||
memory: 1024 * 2, | ||
rootfs_size: 0, | ||
flist: "https://hub.grid.tf/tf-official-apps/base:latest.flist", | ||
entrypoint: "/sbin/zinit init", | ||
env: { | ||
SSH_KEY: config.ssh_key, | ||
}, | ||
}, | ||
], | ||
metadata: "", | ||
description: "test deploying single VM with mycelium via ts grid3 client", | ||
}; | ||
``` | ||
|
||
## Deployment Execution | ||
|
||
- The next step is invoking the `deploy` function: | ||
- Takes the `MachinesModel` object as a parameter | ||
- Checks if a machine with the same name already exists and if so throws an error | ||
- If not, then it calls the `_createDeployment` function along some othe functions | ||
- Finally, the function returns the created contracts. If the deployment is on a zos3 node, then the wireguard configuration is returned as well. | ||
|
||
```ts | ||
await client.machines.deploy(vms); | ||
``` | ||
|
||
- The `_createDeployment` function: | ||
- Takes the `MachinesModel` object as a parameter | ||
- Retrieves the features of the node using: `await this.rmb.request([nodeTwinId], "zos.system.node_features_get", "", 20, 3);` | ||
- Examines the retrieved features to determine the network's primitive type (`Network` or `ZNetworkLight`) and initializes it accordingly. | ||
- Sets the contractMetadata based on the network type. | ||
- Invokes the `create` function | ||
|
||
```ts | ||
await this._createDeployment(options); | ||
``` | ||
|
||
- The `create` function | ||
- Validates or assigns IP addresses based on the network type. | ||
- Determines network type (`network` or `network-light`) based on node features. | ||
- Adds access points and updates network configurations as necessary. | ||
- Initialize the VM primitive (`VMPrimitive` or `VMLightPrimitive`) based on the network type | ||
- Configures the VM with networking, storage, and environment variables. | ||
- Generates a Mycelium seed if not provided. | ||
- Generate the deployments | ||
- Finally, the function returns the created contracts. If the deployment is on a zos3 node, then the wireguard configuration is returned as well. | ||
|
||
```ts | ||
await this.vm.create( | ||
machine.name, | ||
machine.node_id, | ||
machine.flist, | ||
machine.cpu, | ||
machine.memory, | ||
machine.rootfs_size, | ||
machine.disks!, | ||
machine.public_ip, | ||
machine.public_ip6!, | ||
machine.planetary, | ||
machine.mycelium, | ||
machine.myceliumSeed!, | ||
network, | ||
options.network.myceliumSeeds!, | ||
machine.entrypoint, | ||
machine.env, | ||
contractMetadata, | ||
options.metadata, | ||
options.description, | ||
machine.qsfs_disks, | ||
this.config.projectName, | ||
options.network.addAccess, | ||
options.network.accessNodeId, | ||
machine.ip, | ||
machine.corex, | ||
machine.solutionProviderId!, | ||
machine.zlogsOutput, | ||
machine.gpus, | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.