Skip to content
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

Development support deploying k8s workers on multiple nodes #1136

Merged
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions grid-cli/cmd/deploy_kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var deployKubernetesCmd = &cobra.Command{
return err
}

workersNode, err := cmd.Flags().GetUint32("workers-node")
Nabil-Salah marked this conversation as resolved.
Show resolved Hide resolved
workersNode, err := cmd.Flags().GetUintSlice("workers-node")
if err != nil {
return err
}
Expand Down Expand Up @@ -186,7 +186,7 @@ var deployKubernetesCmd = &cobra.Command{
masterNode = uint32(nodes[0].NodeID)
}
master.Node = masterNode
if workersNode == 0 && len(workers) > 0 {
if len(workersNode) < len(workers) && len(workers) > 0 {

filter, disks, rootfss := filters.BuildK8sFilter(
Nabil-Salah marked this conversation as resolved.
Show resolved Hide resolved
workers[0],
Nabil-Salah marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -200,17 +200,20 @@ var deployKubernetesCmd = &cobra.Command{
disks,
nil,
rootfss,
uint64(len(workers)),
uint64(len(workers)-len(workersNode)),
Nabil-Salah marked this conversation as resolved.
Show resolved Hide resolved
)
if err != nil {
log.Fatal().Err(err).Send()
}
for i, node := range workersNodes {
workers[i].Node = uint32(node.NodeID)
for i := 0; i < len(workersNode); i++ {
workers[i].Node = uint32(workersNode[i])
}
for i, j := len(workersNode), 0; i < len(workers); i++ {
workers[i].Node = uint32(workersNodes[j].NodeID)
}
} else {
for i := 0; i < workerNumber; i++ {
workers[i].Node = workersNode
workers[i].Node = uint32(workersNode[i])
Nabil-Salah marked this conversation as resolved.
Show resolved Hide resolved
}
}
cluster, err := command.DeployKubernetesCluster(cmd.Context(), t, master, workers, string(sshKey))
Expand Down Expand Up @@ -283,7 +286,7 @@ func init() {
deployKubernetesCmd.Flags().Int("workers-cpu", 1, "workers number of cpu units")
deployKubernetesCmd.Flags().Int("workers-memory", 1, "workers memory size in gb")
deployKubernetesCmd.Flags().Int("workers-disk", 2, "workers disk size in gb")
deployKubernetesCmd.Flags().Uint32("workers-node", 0, "node id workers should be deployed on")
Nabil-Salah marked this conversation as resolved.
Show resolved Hide resolved
deployKubernetesCmd.Flags().UintSlice("workers-node", make([]uint, 0), "node id workers should be deployed on")
deployKubernetesCmd.Flags().Uint64("workers-farm", 1, "farm id workers should be deployed on")
deployKubernetesCmd.MarkFlagsMutuallyExclusive("workers-node", "workers-farm")
deployKubernetesCmd.Flags().Bool("workers-ipv4", false, "assign public ipv4 for workers")
Expand Down
Loading