Skip to content

Commit

Permalink
Merge pull request #1212 from threefoldtech/development_update_k8s_flist
Browse files Browse the repository at this point in the history
update k8s flist in client and cli
  • Loading branch information
rawdaGastan authored Sep 26, 2024
2 parents 8cf709d + c2fceec commit 9f4d31b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 27 deletions.
4 changes: 1 addition & 3 deletions grid-cli/cmd/deploy_kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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()
}
Expand Down
6 changes: 3 additions & 3 deletions grid-cli/docs/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand All @@ -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": "",
Expand All @@ -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": "",
Expand Down
15 changes: 6 additions & 9 deletions grid-client/deployer/k8s_deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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),
}
Expand Down Expand Up @@ -320,8 +319,7 @@ func ExampleK8sDeployer_Deploy() {
const network = "<dev, test, qa, main>"
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
Expand Down Expand Up @@ -370,7 +368,7 @@ func ExampleK8sDeployer_Deploy() {
Token: "tokens",
SSHKey: "<ssh key goes here>",
NetworkName: n.Name,
Flist: flist,
Flist: workloads.K8sFlist,
FlistChecksum: flistCheckSum,
NodesIPRange: make(map[uint32]gridtypes.IPNet),
}
Expand All @@ -395,8 +393,7 @@ func ExampleK8sDeployer_BatchDeploy() {
const network = "<dev, test, qa, main>"
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
Expand Down Expand Up @@ -445,7 +442,7 @@ func ExampleK8sDeployer_BatchDeploy() {
Token: "tokens",
SSHKey: "<ssh key goes here>",
NetworkName: n.Name,
Flist: flist,
Flist: workloads.K8sFlist,
FlistChecksum: flistCheckSum,
NodesIPRange: make(map[uint32]gridtypes.IPNet),
}
Expand Down
6 changes: 2 additions & 4 deletions grid-client/integration_tests/batch_k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
}

Expand All @@ -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,
}

Expand Down
4 changes: 1 addition & 3 deletions grid-client/integration_tests/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -123,7 +121,7 @@ func TestK8sDeployment(t *testing.T) {
Workers: workers,
Token: "tokens",
SSHKey: publicKey,
Flist: k8sFlist,
Flist: workloads.K8sFlist,
NetworkName: network.Name,
}

Expand Down
3 changes: 3 additions & 0 deletions grid-client/workloads/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions grid-client/workloads/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -20,8 +18,8 @@ var K8sWorkload = K8sNode{
PublicIP: false,
PublicIP6: false,
Planetary: false,
Flist: flist,
FlistChecksum: "e71ee7421f45392fbbb92309182e3006",
Flist: K8sFlist,
FlistChecksum: "f25c9e75e8df3b4fab3ee4de25fa5e17",
ComputedIP: "",
ComputedIP6: "",
PlanetaryIP: "",
Expand Down Expand Up @@ -52,7 +50,7 @@ func TestK8sNodeData(t *testing.T) {
Token: "testToken",
SSHKey: "",
NetworkName: "network",
Flist: flist,
Flist: K8sFlist,
FlistChecksum: "e71ee7421f45392fbbb92309182e3006",
Entrypoint: "/sbin/zinit init",
}
Expand Down

0 comments on commit 9f4d31b

Please sign in to comment.