-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,22 +143,25 @@ class K8sModule extends BaseModule { | |
throw new ValidationError(`Another master with the same name ${master.name} already exists.`); | ||
masters_names.push(master.name); | ||
|
||
if (network) break; | ||
// 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) { | ||
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(); | ||
} | ||
contractMetadata = JSON.stringify({ | ||
version: 3, | ||
type: "kubernetes", | ||
|
@@ -219,21 +222,24 @@ class K8sModule extends BaseModule { | |
throw new ValidationError(`Another worker with the same name ${worker.name} already exists.`); | ||
workers_names.push(worker.name); | ||
|
||
if (network) break; | ||
const nodeTwinId = await this.capacity.getNodeTwinId(worker.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) { | ||
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(); | ||
} | ||
Comment on lines
227
to
+242
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 |
||
contractMetadata = JSON.stringify({ | ||
version: 3, | ||
type: "kubernetes", | ||
|
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.
Yes it will be defined in the next iteration also in the workers