Skip to content

Commit

Permalink
refactor rename k8s machines
Browse files Browse the repository at this point in the history
Signed-off-by: nabil salah <[email protected]>
  • Loading branch information
Nabil-Salah committed Oct 21, 2024
1 parent 82d0565 commit fb58033
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions grid-client/integration_tests/batch_k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,38 @@ func TestBatchK8sDeployment(t *testing.T) {
require.NoError(t, err)
})

masterVM1, err := generateBasicVM(generateRandString(10), nodeID1, network.Name, "")
master1VM, err := generateBasicVM(generateRandString(10), nodeID1, network.Name, "")
require.NoError(t, err)

master1 := workloads.K8sNode{
VM: &masterVM1,
VM: &master1VM,
DiskSizeGB: 1,
}
masterVM2, err := generateBasicVM(generateRandString(10), nodeID2, network.Name, "")
master2VM, err := generateBasicVM(generateRandString(10), nodeID2, network.Name, "")
require.NoError(t, err)

master2 := workloads.K8sNode{
VM: &masterVM2,
VM: &master2VM,
DiskSizeGB: 1,
}
vm1, err := generateBasicVM(generateRandString(10), nodeID1, network.Name, "")
require.NoError(t, err)

workerNodeData1 := workloads.K8sNode{
worker1NodeData := workloads.K8sNode{
VM: &vm1,
DiskSizeGB: 1,
}
vm2, err := generateBasicVM(generateRandString(10), nodeID2, network.Name, "")
require.NoError(t, err)

workerNodeData2 := workloads.K8sNode{
worker2NodeData := workloads.K8sNode{
VM: &vm2,
DiskSizeGB: 1,
}

k8sCluster1 := workloads.K8sCluster{
Master: &master1,
Workers: []workloads.K8sNode{workerNodeData1},
Workers: []workloads.K8sNode{worker1NodeData},
Token: "tokens",
SSHKey: publicKey,
Flist: workloads.K8sFlist,
Expand All @@ -86,7 +86,7 @@ func TestBatchK8sDeployment(t *testing.T) {

k8sCluster2 := workloads.K8sCluster{
Master: &master2,
Workers: []workloads.K8sNode{workerNodeData2},
Workers: []workloads.K8sNode{worker2NodeData},
Token: "tokens",
SSHKey: publicKey,
Flist: workloads.K8sFlist,
Expand Down
10 changes: 5 additions & 5 deletions grid-client/integration_tests/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ func TestK8sDeployment(t *testing.T) {
vm1, err := generateBasicVM(fmt.Sprintf("worker1_%s", generateRandString(5)), workerNodeID, network.Name, "")
require.NoError(t, err)

workerNodeData1 := workloads.K8sNode{
worker1NodeData := workloads.K8sNode{
VM: &vm1,
DiskSizeGB: 1,
}
vm2, err := generateBasicVM(fmt.Sprintf("worker2_%s", generateRandString(5)), workerNodeID, network.Name, "")
require.NoError(t, err)

workerNodeData2 := workloads.K8sNode{
worker2NodeData := workloads.K8sNode{
VM: &vm2,
DiskSizeGB: 1,
}

// deploy k8s cluster
workers := []workloads.K8sNode{workerNodeData1, workerNodeData2}
workers := []workloads.K8sNode{worker1NodeData, worker2NodeData}

k8sCluster := workloads.K8sCluster{
Master: &master,
Expand Down Expand Up @@ -146,7 +146,7 @@ func TestK8sDeployment(t *testing.T) {
// require.NoError(t, requireNodesAreReady(len(k8s.Workers)+1, masterIP, privateKey))

// update k8s cluster (remove worker)
k8sCluster.Workers = []workloads.K8sNode{workerNodeData1}
k8sCluster.Workers = []workloads.K8sNode{worker1NodeData}

err = tfPluginClient.K8sDeployer.Deploy(context.Background(), &k8sCluster)
require.NoError(t, err)
Expand Down Expand Up @@ -174,7 +174,7 @@ func TestK8sDeployment(t *testing.T) {
// require.NoError(t, requireNodesAreReady(len(k8s.Workers)+1, masterIP, privateKey))

// update k8s cluster (add worker)
k8sCluster.Workers = append(k8sCluster.Workers, workerNodeData2)
k8sCluster.Workers = append(k8sCluster.Workers, worker2NodeData)
err = tfPluginClient.K8sDeployer.Deploy(context.Background(), &k8sCluster)
require.NoError(t, err)

Expand Down
4 changes: 3 additions & 1 deletion grid-client/integration_tests/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import (
"github.com/threefoldtech/zos/pkg/gridtypes"
"golang.org/x/crypto/ssh"
)

const (
ubuntuFlist = "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist"
)
func setup() (deployer.TFPluginClient, error) {
mnemonics := os.Getenv("MNEMONICS")
log.Printf("mnemonics: %s", mnemonics)
Expand Down
2 changes: 0 additions & 2 deletions grid-client/integration_tests/two_vms_same_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ func TestTwoVMsSameNetworkWithPublicIPV6(t *testing.T) {
network, err := generateBasicNetwork([]uint32{nodeID})
require.NoError(t, err)

ubuntuFlist := "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist"

vm1, err := generateBasicVM("vm1", nodeID, network.Name, publicKey)
require.NoError(t, err)

Expand Down
4 changes: 2 additions & 2 deletions grid-client/integration_tests/vms_private_ips_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestDeploymentsDeploy(t *testing.T) {
vm1, err := generateBasicVM(vm1Name, nodeID, network.Name, "")
require.NoError(t, err)

vm1.Flist = "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist"
vm1.Flist = ubuntuFlist

err = tfPluginClient.NetworkDeployer.Deploy(context.Background(), &network)
if err != nil {
Expand Down Expand Up @@ -164,7 +164,7 @@ func TestDeploymentsBatchDeploy(t *testing.T) {
NetworkName: network.Name,
CPU: minCPU,
MemoryMB: minMemory * 1024,
Flist: "https://hub.grid.tf/tf-official-apps/threefoldtech-ubuntu-22.04.flist",
Flist: ubuntuFlist,
Entrypoint: "/sbin/zinit init",
}

Expand Down

0 comments on commit fb58033

Please sign in to comment.