-
Notifications
You must be signed in to change notification settings - Fork 8
GridClient Nightly ZOS3 Lite Mycelium test and update #4047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
khaledyoussef24
merged 10 commits into
development
from
development_zos3-lite-mycelium-test
May 6, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8062c60
Replace ZOS4 VM script with ZOS3 Lite Mycelium test and update nightl…
khaledyoussef24 d3d55fd
fix workflow
khaledyoussef24 6568fc9
add muliple vm for zos 3 lite scripts and nightly
khaledyoussef24 49c6caf
adding multiple tests result
khaledyoussef24 a70c645
adding zos3gateway script
khaledyoussef24 ba498f0
adding domain to nightly fixing changes to make domain script work fine
khaledyoussef24 c74f12b
Fix zos3lite gateway test
khaledyoussef24 c944899
adding random name generation to multiple vms scripts
khaledyoussef24 83845a3
using the name generation from playground
khaledyoussef24 f636a86
fixing genrating string functions
khaledyoussef24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
132 changes: 132 additions & 0 deletions
132
packages/grid_client/scripts/multiple_vms_zos_3_lite.ts
This file contains hidden or 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,132 @@ | ||
import { | ||
Features, | ||
FilterOptions, | ||
generateRandomHexSeed, | ||
generateString, | ||
GridClient, | ||
MachinesDeleteModel, | ||
MachinesModel, | ||
} from "../src"; | ||
import { config, getClient } from "./client_loader"; | ||
import { log, pingNodes } from "./utils"; | ||
|
||
async function deploy(client: GridClient, vms: MachinesModel) { | ||
const res = await client.machines.deploy(vms); | ||
log("================= Deploying VM ================="); | ||
log(res); | ||
log("================= Deploying VM ================="); | ||
} | ||
|
||
async function getDeployment(client: GridClient, name: string) { | ||
const res = await client.machines.getObj(name); | ||
log("================= Getting deployment information ================="); | ||
log(res); | ||
log("================= Getting deployment information ================="); | ||
} | ||
|
||
async function cancel(client: GridClient, name: string) { | ||
const res = await client.machines.delete({ name }); | ||
log("================= Canceling the deployment ================="); | ||
log(res); | ||
log("================= Canceling the deployment ================="); | ||
} | ||
|
||
async function getNodeId(client: GridClient, options: FilterOptions) { | ||
const nodes = await client.capacity.filterNodes(options); | ||
const nodeId = await pingNodes(client, nodes); | ||
return nodeId; | ||
} | ||
|
||
async function main() { | ||
const name = "vm" + generateString(6); | ||
const networkName = "nw" + generateString(6); | ||
const machine1Name = "machine" + generateString(6); | ||
const machine2Name = "machine" + generateString(6); | ||
const disk1Name = "disk" + generateString(6); | ||
const disk2Name = "disk" + generateString(6); | ||
|
||
const grid3 = await getClient(`vm/${name}`); | ||
|
||
const vmQueryOptions: FilterOptions = { | ||
cru: 1, | ||
mru: 1, // GB | ||
sru: 14, | ||
availableFor: grid3.twinId, | ||
features: [Features.zmachinelight, Features.networklight, Features.mycelium], | ||
nodeExclude: [259], | ||
farmName: "LiriaFarm", | ||
}; | ||
|
||
const nodeId = await getNodeId(grid3, vmQueryOptions); | ||
|
||
const vms: MachinesModel = { | ||
name, | ||
network: { | ||
name: networkName, | ||
ip_range: "10.238.0.0/16", | ||
}, | ||
machines: [ | ||
{ | ||
name: machine1Name, | ||
node_id: nodeId!, | ||
disks: [ | ||
{ | ||
name: disk1Name, | ||
size: 5, | ||
mountpoint: "/newDisk1", | ||
}, | ||
], | ||
public_ip: false, | ||
public_ip6: false, | ||
planetary: false, | ||
mycelium: true, | ||
cpu: 1, | ||
memory: 1024, | ||
rootfs_size: 0, | ||
flist: "https://hub.grid.tf/tf-official-apps/base:latest.flist", | ||
entrypoint: "/sbin/zinit init", | ||
env: { | ||
SSH_KEY: config.ssh_key, | ||
}, | ||
}, | ||
{ | ||
name: machine2Name, | ||
node_id: nodeId!, | ||
disks: [ | ||
{ | ||
name: disk2Name, | ||
size: 5, | ||
mountpoint: "/newDisk2", | ||
}, | ||
], | ||
public_ip: false, | ||
public_ip6: false, | ||
planetary: false, | ||
mycelium: true, | ||
cpu: 1, | ||
memory: 1024, | ||
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 VMs via ts grid3 client", | ||
}; | ||
|
||
//Deploy VMs | ||
await deploy(grid3, vms); | ||
|
||
//Get the deployment | ||
await getDeployment(grid3, name); | ||
|
||
// Uncomment the line below to cancel the deployment | ||
// await cancel(grid3, name); | ||
|
||
await grid3.disconnect(); | ||
} | ||
|
||
main(); |
This file contains hidden or 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 hidden or 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 hidden or 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,57 @@ | ||
import { Features, FilterOptions, GatewayNameModel, generateString } from "../src"; | ||
import { getClient } from "./client_loader"; | ||
import { log } from "./utils"; | ||
|
||
async function deploy(client, gw) { | ||
const res = await client.gateway.deploy_name(gw); | ||
log("================= Deploying name gateway ================="); | ||
log(res); | ||
log("================= Deploying name gateway ================="); | ||
} | ||
|
||
async function getDeployment(client, gw) { | ||
const res = await client.gateway.getObj(gw); | ||
log("================= Getting deployment information ================="); | ||
log(res); | ||
log("================= Getting deployment information ================="); | ||
} | ||
|
||
async function cancel(client, gw) { | ||
const res = await client.gateway.delete_name(gw); | ||
log("================= Canceling the deployment ================="); | ||
log(res); | ||
log("================= Canceling the deployment ================="); | ||
} | ||
|
||
// read more about the gateway types in this doc: https://github.com/threefoldtech/zos/tree/main/docs/internals/gateway | ||
async function main() { | ||
const grid3 = await getClient(); | ||
const gatewayName = "gw" + generateString(6); | ||
|
||
const gatewayQueryOptions: FilterOptions = { | ||
gateway: true, | ||
features: [Features.mycelium, Features.zmachinelight, Features.networklight], | ||
farmName: "LiriaFarm", | ||
}; | ||
|
||
const gw: GatewayNameModel = { | ||
name: gatewayName, | ||
node_id: +(await grid3.capacity.filterNodes(gatewayQueryOptions))[0].nodeId, | ||
tls_passthrough: false, | ||
// the backends have to be in this format `http://ip:port` or `https://ip:port`, and the `ip` pingable from the node so using the ygg ip or public ip if available. | ||
backends: ["http://185.206.122.35:8000"], | ||
}; | ||
|
||
//Deploy gateway | ||
await deploy(grid3, gw); | ||
|
||
//Get the deployment | ||
await getDeployment(grid3, gw.name); | ||
|
||
//Uncomment the line below to cancel the deployment | ||
// await cancel(grid3, { name: gw.name }); | ||
|
||
grid3.disconnect(); | ||
} | ||
|
||
main(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.