-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix deploy Kubernetes cluster with workers #3870
Conversation
- k8s: for workers and masters only check if the network is loaded if not create a new network without break;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works, good job
{ "masters": [ { "version": 0, "type": "zmachine", "contractId": 191373, "nodeId": 153, "name": "mrtyklo", "created": 1739174873, "status": "ok", "message": "", "flist": "https://hub.grid.tf/tf-official-apps/threefolddev-k3s-v1.31.0.flist", "publicIP": null, "myceliumIP": "42e:525:4c9e:f4e4:ff0f:0:400:2", "interfaces": [ { "network": "nwkies6", "ip": "10.20.4.2" } ], "capacity": { "cpu": 1, "memory": 4096 }, "mounts": [ { "name": "mrtyklo_disk", "mountPoint": "/mnt/data", "size": 107374182400, "state": "ok", "message": "" } ], "env": { "SSH_KEY": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDfqmofYkYQUFPeerDyZloK61Zslbwov5o41QcaBjmsUodYiO1+crAqO4OCFX4EFXIRJLkCq20wELaFuVEkPoXufbLyOpcCqD79yuU+LikXQgi7lYFolDVX506kL2b/pTnkP6PapJnAOMUoaSjI41fKsw44mog7IgCHzq05age6Md/RKcytH75N2DcxX+Eo6xtAF2+2lF0jvBYu1A4GYnwfWjOQ74TIv/YP1lrSJs6RO1t+I3gEokn6hwYsVe+0HKhsMWAFA97Uis2XMCzWoZFTy41jBC9BXL873tAQA9KDueRjHJ583HUGGfIXZIVH0rkXcxhfsYU0OUvyo1Dn95liFw6EE+INdLt2GDlb6MbLQthomuu6Si8jhoP2jgpBenjFdSEwNmX0dVg8uzA+qUFXaGITQQsbHnleEk7MYiozBCkq5HfhdYYP8Dtp+UBj0vuzBZK2EANin7GnRU8pu7Z/J53D2CBr08m8oFH9N5Zep/G9l6joaIYZ3eN0h5WZCSvGxTUw7WThlS/jwefPY1AdU8OliTN1WrObt9sDa6RnKpKXzfOJL4UdRAJ5MbW7JPwif4Ag4lTVKZfJpFgiWfitO64gz8pkUmFyTXF5YvrSpcPQJgiXcFktd0eqqVITnC45r2jndx2QuM9wwdExr7lel5tqN9hIIGtPhhUHYvFIsw== cosmos", "K3S_TOKEN": "YiEwYq98B6", "K3S_DATA_DIR": "/mnt/data", "K3S_FLANNEL_IFACE": "eth0", "K3S_NODE_NAME": "mrtyklo", "K3S_URL": "" }, "entrypoint": "/sbin/zinit init", "metadata": "", "description": "", "rootfs_size": 524288000, "corex": false, "gpu": [] } ], "workers": [ { "version": 0, "type": "zmachine", "contractId": 191372, "nodeId": 128, "name": "wrcjlrr", "created": 1739174874, "status": "ok", "message": "", "flist": "https://hub.grid.tf/tf-official-apps/threefolddev-k3s-v1.31.0.flist", "publicIP": null, "myceliumIP": "554:d273:2e79:9ec6:ff0f:0:500:2", "interfaces": [ { "network": "nwkies6", "ip": "10.20.5.2" } ], "capacity": { "cpu": 1, "memory": 4096 }, "mounts": [ { "name": "wrcjlrr_disk", "mountPoint": "/mnt/data", "size": 107374182400, "state": "ok", "message": "" } ], "env": { "SSH_KEY": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDfqmofYkYQUFPeerDyZloK61Zslbwov5o41QcaBjmsUodYiO1+crAqO4OCFX4EFXIRJLkCq20wELaFuVEkPoXufbLyOpcCqD79yuU+LikXQgi7lYFolDVX506kL2b/pTnkP6PapJnAOMUoaSjI41fKsw44mog7IgCHzq05age6Md/RKcytH75N2DcxX+Eo6xtAF2+2lF0jvBYu1A4GYnwfWjOQ74TIv/YP1lrSJs6RO1t+I3gEokn6hwYsVe+0HKhsMWAFA97Uis2XMCzWoZFTy41jBC9BXL873tAQA9KDueRjHJ583HUGGfIXZIVH0rkXcxhfsYU0OUvyo1Dn95liFw6EE+INdLt2GDlb6MbLQthomuu6Si8jhoP2jgpBenjFdSEwNmX0dVg8uzA+qUFXaGITQQsbHnleEk7MYiozBCkq5HfhdYYP8Dtp+UBj0vuzBZK2EANin7GnRU8pu7Z/J53D2CBr08m8oFH9N5Zep/G9l6joaIYZ3eN0h5WZCSvGxTUw7WThlS/jwefPY1AdU8OliTN1WrObt9sDa6RnKpKXzfOJL4UdRAJ5MbW7JPwif4Ag4lTVKZfJpFgiWfitO64gz8pkUmFyTXF5YvrSpcPQJgiXcFktd0eqqVITnC45r2jndx2QuM9wwdExr7lel5tqN9hIIGtPhhUHYvFIsw== cosmos", "K3S_TOKEN": "YiEwYq98B6", "K3S_DATA_DIR": "/mnt/data", "K3S_FLANNEL_IFACE": "eth0", "K3S_NODE_NAME": "wrcjlrr", "K3S_URL": "https://10.20.4.2:6443" }, "entrypoint": "/sbin/zinit init", "metadata": "", "description": "", "rootfs_size": 524288000, "corex": false, "gpu": [] } ], "wireguard": "[Interface]\nAddress = 100.64.20.3/32\nPrivateKey = x/ugVx7GragYRHRZE/lQ+dZRBXx6RE21ge74J/c35hM=\n\n[Peer]\nPublicKey = XugpkuEvSbnBwDkHyP+y3juqzCjmuQ23EmaWkRy+uTk=\nAllowedIPs = 10.20.0.0/16, 100.64.20.0/32\nPersistentKeepalive = 25\nEndpoint = 185.206.122.31:17621" }
// Sets the network and contractMetadata based on the node's zos version | ||
const nodeTwinId = await this.capacity.getNodeTwinId(master.node_id); | ||
const features = await this.rmb.request([nodeTwinId], "zos.system.node_features_get", "", 20, 3); | ||
if (features.some(item => item.includes("zmachine-light") || item.includes("network-light"))) { | ||
network = new ZNetworkLight(options.network.name, options.network.ip_range, this.config); | ||
await network.load(); | ||
if (!network) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this network be defined at any point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check that in the rest of the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this network be defined at any point?
Yes it will be defined in the next iteration also in the workers
if (features.some(item => item.includes("zmachine-light") || item.includes("network-light"))) { | ||
network = new ZNetworkLight(options.network.name, options.network.ip_range, this.config); | ||
await network.load(); | ||
if (!network) { | ||
network = new ZNetworkLight(options.network.name, options.network.ip_range, this.config); | ||
await network.load(); | ||
} | ||
contractMetadata = JSON.stringify({ | ||
version: 4, | ||
type: "kubernetes", | ||
name: options.name, | ||
projectName: this.config.projectName || `kubernetes/${options.name}`, | ||
}); | ||
} else { | ||
network = new Network(options.network.name, options.network.ip_range, this.config); | ||
await network.load(); | ||
if (!network) { | ||
network = new Network(options.network.name, options.network.ip_range, this.config); | ||
await network.load(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this part repeated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to create a function in utils that does those steps, but the function will take the network argument, network, and network type, so there will be more lines
example
awat createOrLoadNetowrk(options.network.name, options.network.ip_range, this.config, network, 'ZNetworkLight`)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the case you might have only workers if you add a worker to an existing cluster
The issue that checking if the node is definded and already created breaks the creation of the workers, it passes with master as there is no network was created yet so it will continue normally then to the workers will face the break line before adding the workers
Changes
Related Issues
Tested Scenarios
Documentation PR
For UI changes, Please provide the Documentation PR on info_grid
To consider
Preliminary Checks:
UI Checks:
Code Quality Checks:
Testing Checklist
General Checklist