From c2fceeca4ff120306ced8b445f5eca61cc3021ea Mon Sep 17 00:00:00 2001 From: rawdaGastan Date: Thu, 26 Sep 2024 13:33:33 +0300 Subject: [PATCH] update k8s flist in client and cli --- grid-cli/cmd/deploy_kubernetes.go | 4 +--- grid-cli/docs/kubernetes.md | 6 +++--- grid-client/deployer/k8s_deployer_test.go | 15 ++++++--------- grid-client/integration_tests/batch_k8s_test.go | 6 ++---- grid-client/integration_tests/k8s_test.go | 4 +--- grid-client/workloads/k8s.go | 3 +++ grid-client/workloads/k8s_test.go | 8 +++----- 7 files changed, 19 insertions(+), 27 deletions(-) diff --git a/grid-cli/cmd/deploy_kubernetes.go b/grid-cli/cmd/deploy_kubernetes.go index 499393988..4c36d4dfd 100644 --- a/grid-cli/cmd/deploy_kubernetes.go +++ b/grid-cli/cmd/deploy_kubernetes.go @@ -14,8 +14,6 @@ import ( "github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads" ) -var k8sFlist = "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist" - // deployKubernetesCmd represents the deploy kubernetes command var deployKubernetesCmd = &cobra.Command{ Use: "kubernetes", @@ -211,7 +209,7 @@ var deployKubernetesCmd = &cobra.Command{ for i := range workers { workers[i].NodeID = uint32(workersNodes[i]) } - cluster, err := command.DeployKubernetesCluster(cmd.Context(), t, master, workers, string(sshKey), k8sFlist) + cluster, err := command.DeployKubernetesCluster(cmd.Context(), t, master, workers, string(sshKey), workloads.K8sFlist) if err != nil { log.Fatal().Err(err).Send() } diff --git a/grid-cli/docs/kubernetes.md b/grid-cli/docs/kubernetes.md index c83b91612..853d4017f 100644 --- a/grid-cli/docs/kubernetes.md +++ b/grid-cli/docs/kubernetes.md @@ -163,7 +163,7 @@ $ tfcmd get kubernetes kube "publicip": false, "publicip6": false, "planetary": true, - "flist": "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist", + "flist": "https://hub.grid.tf/tf-official-apps/threefolddev-k3s-v1.31.0.flist", "flist_checksum": "c87cf57e1067d21a3e74332a64ef9723", "computedip": "", "computedip6": "", @@ -186,7 +186,7 @@ $ tfcmd get kubernetes kube "publicip": false, "publicip6": false, "planetary": true, - "flist": "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist", + "flist": "https://hub.grid.tf/tf-official-apps/threefolddev-k3s-v1.31.0.flist", "flist_checksum": "c87cf57e1067d21a3e74332a64ef9723", "computedip": "", "computedip6": "", @@ -208,7 +208,7 @@ $ tfcmd get kubernetes kube "publicip": false, "publicip6": false, "planetary": true, - "flist": "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist", + "flist": "https://hub.grid.tf/tf-official-apps/threefolddev-k3s-v1.31.0.flist", "flist_checksum": "c87cf57e1067d21a3e74332a64ef9723", "computedip": "", "computedip6": "", diff --git a/grid-client/deployer/k8s_deployer_test.go b/grid-client/deployer/k8s_deployer_test.go index 1d33f4bbf..830f43b2f 100644 --- a/grid-client/deployer/k8s_deployer_test.go +++ b/grid-client/deployer/k8s_deployer_test.go @@ -90,8 +90,7 @@ func k8sMockValidation(identity substrate.Identity, cl *mocks.RMBMockClient, sub } func constructK8sCluster() (workloads.K8sCluster, error) { - flist := "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist" - flistCheckSum, err := workloads.GetFlistChecksum(flist) + flistCheckSum, err := workloads.GetFlistChecksum(workloads.K8sFlist) if err != nil { return workloads.K8sCluster{}, err } @@ -138,7 +137,7 @@ func constructK8sCluster() (workloads.K8sCluster, error) { Token: "tokens", SSHKey: "", NetworkName: "network", - Flist: flist, + Flist: workloads.K8sFlist, FlistChecksum: flistCheckSum, NodesIPRange: make(map[uint32]gridtypes.IPNet), } @@ -320,8 +319,7 @@ func ExampleK8sDeployer_Deploy() { const network = "" const nodeID = 11 // use any node with status up, use ExampleFilterNodes to get valid nodeID - const flist = "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist" - flistCheckSum, err := workloads.GetFlistChecksum(flist) + flistCheckSum, err := workloads.GetFlistChecksum(workloads.K8sFlist) if err != nil { fmt.Println(err) return @@ -370,7 +368,7 @@ func ExampleK8sDeployer_Deploy() { Token: "tokens", SSHKey: "", NetworkName: n.Name, - Flist: flist, + Flist: workloads.K8sFlist, FlistChecksum: flistCheckSum, NodesIPRange: make(map[uint32]gridtypes.IPNet), } @@ -395,8 +393,7 @@ func ExampleK8sDeployer_BatchDeploy() { const network = "" const nodeID = 11 // use any node with status up, use ExampleFilterNodes to get valid nodeID - const flist = "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist" - flistCheckSum, err := workloads.GetFlistChecksum(flist) + flistCheckSum, err := workloads.GetFlistChecksum(workloads.K8sFlist) if err != nil { fmt.Println(err) return @@ -445,7 +442,7 @@ func ExampleK8sDeployer_BatchDeploy() { Token: "tokens", SSHKey: "", NetworkName: n.Name, - Flist: flist, + Flist: workloads.K8sFlist, FlistChecksum: flistCheckSum, NodesIPRange: make(map[uint32]gridtypes.IPNet), } diff --git a/grid-client/integration_tests/batch_k8s_test.go b/grid-client/integration_tests/batch_k8s_test.go index b471c60d1..1f4d72eac 100644 --- a/grid-client/integration_tests/batch_k8s_test.go +++ b/grid-client/integration_tests/batch_k8s_test.go @@ -45,8 +45,6 @@ func TestBatchK8sDeployment(t *testing.T) { require.NoError(t, err) }) - flist := "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist" - master1 := workloads.K8sNode{ VM: &workloads.VM{ Name: generateRandString(10), @@ -100,7 +98,7 @@ func TestBatchK8sDeployment(t *testing.T) { Workers: []workloads.K8sNode{workerNodeData1}, Token: "tokens", SSHKey: publicKey, - Flist: flist, + Flist: workloads.K8sFlist, NetworkName: network.Name, } @@ -109,7 +107,7 @@ func TestBatchK8sDeployment(t *testing.T) { Workers: []workloads.K8sNode{workerNodeData2}, Token: "tokens", SSHKey: publicKey, - Flist: flist, + Flist: workloads.K8sFlist, NetworkName: network.Name, } diff --git a/grid-client/integration_tests/k8s_test.go b/grid-client/integration_tests/k8s_test.go index 3b9564abd..c32d4330f 100644 --- a/grid-client/integration_tests/k8s_test.go +++ b/grid-client/integration_tests/k8s_test.go @@ -77,8 +77,6 @@ func TestK8sDeployment(t *testing.T) { require.NoError(t, err) }) - k8sFlist := "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist" - master := workloads.K8sNode{ VM: &workloads.VM{ Name: fmt.Sprintf("master_%s", generateRandString(5)), @@ -123,7 +121,7 @@ func TestK8sDeployment(t *testing.T) { Workers: workers, Token: "tokens", SSHKey: publicKey, - Flist: k8sFlist, + Flist: workloads.K8sFlist, NetworkName: network.Name, } diff --git a/grid-client/workloads/k8s.go b/grid-client/workloads/k8s.go index a85544499..ed5537a29 100644 --- a/grid-client/workloads/k8s.go +++ b/grid-client/workloads/k8s.go @@ -15,6 +15,9 @@ import ( "github.com/threefoldtech/zos/pkg/gridtypes/zos" ) +// old: https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist +var K8sFlist = "https://hub.grid.tf/tf-official-apps/threefolddev-k3s-v1.31.0.flist" + // K8sNode kubernetes data type K8sNode struct { *VM diff --git a/grid-client/workloads/k8s_test.go b/grid-client/workloads/k8s_test.go index ac25f0a7f..9a947be2d 100644 --- a/grid-client/workloads/k8s_test.go +++ b/grid-client/workloads/k8s_test.go @@ -9,8 +9,6 @@ import ( "github.com/threefoldtech/zos/pkg/gridtypes/zos" ) -var flist = "https://hub.grid.tf/tf-official-apps/threefoldtech-k3s-latest.flist" - // K8sWorkload to be used in tests var K8sWorkload = K8sNode{ VM: &VM{ @@ -20,8 +18,8 @@ var K8sWorkload = K8sNode{ PublicIP: false, PublicIP6: false, Planetary: false, - Flist: flist, - FlistChecksum: "e71ee7421f45392fbbb92309182e3006", + Flist: K8sFlist, + FlistChecksum: "f25c9e75e8df3b4fab3ee4de25fa5e17", ComputedIP: "", ComputedIP6: "", PlanetaryIP: "", @@ -52,7 +50,7 @@ func TestK8sNodeData(t *testing.T) { Token: "testToken", SSHKey: "", NetworkName: "network", - Flist: flist, + Flist: K8sFlist, FlistChecksum: "e71ee7421f45392fbbb92309182e3006", Entrypoint: "/sbin/zinit init", }