Skip to content

Support multiple gateway backends #1350

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

Merged
merged 6 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
83 changes: 83 additions & 0 deletions go.work.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion grid-cli/cmd/deploy_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

// deployGatewayCmd represents the deploy gateway command
Expand Down
2 changes: 1 addition & 1 deletion grid-cli/cmd/deploy_zdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-cli/internal/filters"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

// deployZDBCmd represents the deploy zdb command
Expand Down
7 changes: 3 additions & 4 deletions grid-cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/stretchr/testify v1.10.0
github.com/threefoldtech/tfgrid-sdk-go/grid-client v0.15.18
github.com/threefoldtech/tfgrid-sdk-go/grid-proxy v0.15.18
github.com/threefoldtech/zos v0.5.6-0.20240902110349-172a0a29a6ee
github.com/threefoldtech/zosbase v0.1.4
github.com/vedhavyas/go-subkey v1.0.3
)

Expand Down Expand Up @@ -47,9 +47,8 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241007205731-5e76664a3cc4 // indirect
github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go v0.15.18 // indirect
github.com/threefoldtech/zos4 v0.5.6-0.20241008102757-02d898c580c4 // indirect
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241127100051-77e684bcb1b2 // indirect
github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go v0.16.1-0.20241229121208-76ac3fea5e67 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/sync v0.10.0 // indirect
Expand Down
10 changes: 4 additions & 6 deletions grid-cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,10 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241007205731-5e76664a3cc4 h1:XIXVdFrum50Wnxv62sS+cEgqHtvdInWB2Co8AJVJ8xs=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241007205731-5e76664a3cc4/go.mod h1:cOL5YgHUmDG5SAXrsZxFjUECRQQuAqOoqvXhZG5sEUw=
github.com/threefoldtech/zos v0.5.6-0.20240902110349-172a0a29a6ee h1:pqpYVM0qkXujplHNfH6w5GDqcY5sLJAgOc4/hlR6+Xw=
github.com/threefoldtech/zos v0.5.6-0.20240902110349-172a0a29a6ee/go.mod h1:lut72yYMJhgK0QRvF0Wd/mB3+OfIoXWz04DQuXck3Sw=
github.com/threefoldtech/zos4 v0.5.6-0.20241008102757-02d898c580c4 h1:JCExxpPL32G7evO/+gHwlZLfAX1+l9QN9t55tnPDCp0=
github.com/threefoldtech/zos4 v0.5.6-0.20241008102757-02d898c580c4/go.mod h1:7KFtZaCcEFwQ1/cz/+hkYK616Ww04ISZgmMqLWHz6To=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241127100051-77e684bcb1b2 h1:VW2J36F8g/kJn4IkY0JiRFmb1gFcdjiOyltfJLJ0mYU=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241127100051-77e684bcb1b2/go.mod h1:cOL5YgHUmDG5SAXrsZxFjUECRQQuAqOoqvXhZG5sEUw=
github.com/threefoldtech/zosbase v0.1.4 h1:ZLm06TujSSIU8rX28X5Dx7utWQhiDqKBoTqGKBKOwDI=
github.com/threefoldtech/zosbase v0.1.4/go.mod h1:rxc49wA04S4IsBOYe0omVO7nu7GXridueh2PJh34gSo=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms=
Expand Down
2 changes: 1 addition & 1 deletion grid-client/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
proxy "github.com/threefoldtech/tfgrid-sdk-go/grid-proxy/pkg/client"
proxyTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-proxy/pkg/types"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"golang.org/x/sync/errgroup"
)

Expand Down
4 changes: 2 additions & 2 deletions grid-client/deployer/deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
proxyTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-proxy/pkg/types"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
"github.com/vedhavyas/go-subkey"
)

Expand Down
4 changes: 2 additions & 2 deletions grid-client/deployer/deployment_deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/state"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions grid-client/deployer/deployment_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (

"github.com/pkg/errors"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

// CountDeploymentPublicIPs counts the public IPs of a deployment
func CountDeploymentPublicIPs(dl zosTypes.Deployment) (uint32, error) {
var res uint32
for _, wl := range dl.Workloads {
if wl.Type == zosTypes.PublicIPType {
data, err := wl.Workload3().WorkloadData()
data, err := wl.Workload().WorkloadData()
if err != nil {
return res, errors.Wrapf(err, "could not parse workload data for workload %s", wl.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion grid-client/deployer/gateway_fqdn_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (d *GatewayFQDNDeployer) Sync(ctx context.Context, gw *workloads.GatewayFQD
gw.Network = gwWorkload.Network

if wl != nil && wl.Result.State.IsOkay() {
gwWorkload, err := workloads.NewGatewayFQDNProxyFromZosWorkload(*wl.Workload.Workload3())
gwWorkload, err := workloads.NewGatewayFQDNProxyFromZosWorkload(*wl.Workload.Workload())
gw.Backends = gwWorkload.Backends
gw.Name = gwWorkload.Name
gw.FQDN = gwWorkload.FQDN
Expand Down
4 changes: 2 additions & 2 deletions grid-client/deployer/gateway_fqdn_deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
proxyTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-proxy/pkg/types"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

func constructTestFQDNDeployer(t *testing.T, mock bool) (
Expand Down
2 changes: 1 addition & 1 deletion grid-client/deployer/gateway_name_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (d *GatewayNameDeployer) Sync(ctx context.Context, gw *workloads.GatewayNam

// if the node acknowledges it, we are golden
if wl != nil && wl.Result.State.IsOkay() {
gwWorkload, err := workloads.NewGatewayNameProxyFromZosWorkload(*wl.Workload.Workload3())
gwWorkload, err := workloads.NewGatewayNameProxyFromZosWorkload(*wl.Workload.Workload())
gw.Backends = gwWorkload.Backends
gw.Name = gwWorkload.Name
gw.FQDN = gwWorkload.FQDN
Expand Down
4 changes: 2 additions & 2 deletions grid-client/deployer/gateway_name_deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/state"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

var nameContractID uint64 = 200
Expand Down
10 changes: 5 additions & 5 deletions grid-client/deployer/k8s_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
client "github.com/threefoldtech/tfgrid-sdk-go/grid-client/node"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

// K8sDeployer for deploying k8s
Expand Down Expand Up @@ -261,7 +261,7 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload
for _, dl := range currentDeployments {
for _, w := range dl.Workloads {
if w.Type == zosTypes.ZMachineType {
d, err := w.Workload3().WorkloadData()
d, err := w.Workload().WorkloadData()
if err != nil {
zerolog.Error().Err(err).Msg("failed to get workload data")
}
Expand Down Expand Up @@ -303,7 +303,7 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload
for _, w := range dl.Workloads {
if w.Type == zosTypes.ZMachineType {
workloadNodeID[w.Name] = node
workloadObj[w.Name] = *w.Workload3()
workloadObj[w.Name] = *w.Workload()

} else if w.Type == zosTypes.PublicIPType {
ipResult := zos.PublicIPResult{}
Expand All @@ -313,7 +313,7 @@ func (d *K8sDeployer) UpdateFromRemote(ctx context.Context, k8sCluster *workload
publicIPs[w.Name] = ipResult.IP.String()
publicIP6s[w.Name] = ipResult.IPv6.String()
} else if w.Type == zosTypes.ZMountType {
wl, err := w.Workload3().WorkloadData()
wl, err := w.Workload().WorkloadData()
if err != nil {
return d.tfPluginClient.sentry.error(errors.Wrap(err, "failed to load disk data"))
}
Expand Down
2 changes: 1 addition & 1 deletion grid-client/deployer/k8s_deployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/subi"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
)

func constructTestK8s(t *testing.T, mock bool) (
Expand Down
4 changes: 2 additions & 2 deletions grid-client/deployer/node_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/rs/zerolog/log"
client "github.com/threefoldtech/tfgrid-sdk-go/grid-client/node"
"github.com/threefoldtech/tfgrid-sdk-go/grid-proxy/pkg/types"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

const requestedPagesPerIteration = 5
Expand Down
2 changes: 1 addition & 1 deletion grid-client/deployer/node_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
client "github.com/threefoldtech/tfgrid-sdk-go/grid-client/node"
"github.com/threefoldtech/tfgrid-sdk-go/grid-proxy/pkg/types"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

func TestHasEnoughStorage(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions grid-client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ require (
github.com/rs/zerolog v1.33.0
github.com/sethvargo/go-retry v0.3.0
github.com/stretchr/testify v1.10.0
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241007205731-5e76664a3cc4
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241127100051-77e684bcb1b2
github.com/threefoldtech/tfgrid-sdk-go/grid-proxy v0.15.18
github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go v0.15.18
github.com/threefoldtech/zos v0.5.6-0.20240902110349-172a0a29a6ee
github.com/threefoldtech/zos4 v0.5.6-0.20241008102757-02d898c580c4
github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go v0.16.1-0.20241229121208-76ac3fea5e67
github.com/vedhavyas/go-subkey v1.0.3
golang.org/x/crypto v0.31.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.10.0
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200609130330-bd2cb7843e1b
)

require github.com/threefoldtech/zosbase v0.1.4

require (
github.com/ChainSafe/go-schnorrkel v1.1.0 // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
Expand Down
10 changes: 4 additions & 6 deletions grid-client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241007205731-5e76664a3cc4 h1:XIXVdFrum50Wnxv62sS+cEgqHtvdInWB2Co8AJVJ8xs=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241007205731-5e76664a3cc4/go.mod h1:cOL5YgHUmDG5SAXrsZxFjUECRQQuAqOoqvXhZG5sEUw=
github.com/threefoldtech/zos v0.5.6-0.20240902110349-172a0a29a6ee h1:pqpYVM0qkXujplHNfH6w5GDqcY5sLJAgOc4/hlR6+Xw=
github.com/threefoldtech/zos v0.5.6-0.20240902110349-172a0a29a6ee/go.mod h1:lut72yYMJhgK0QRvF0Wd/mB3+OfIoXWz04DQuXck3Sw=
github.com/threefoldtech/zos4 v0.5.6-0.20241008102757-02d898c580c4 h1:JCExxpPL32G7evO/+gHwlZLfAX1+l9QN9t55tnPDCp0=
github.com/threefoldtech/zos4 v0.5.6-0.20241008102757-02d898c580c4/go.mod h1:7KFtZaCcEFwQ1/cz/+hkYK616Ww04ISZgmMqLWHz6To=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241127100051-77e684bcb1b2 h1:VW2J36F8g/kJn4IkY0JiRFmb1gFcdjiOyltfJLJ0mYU=
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241127100051-77e684bcb1b2/go.mod h1:cOL5YgHUmDG5SAXrsZxFjUECRQQuAqOoqvXhZG5sEUw=
github.com/threefoldtech/zosbase v0.1.4 h1:ZLm06TujSSIU8rX28X5Dx7utWQhiDqKBoTqGKBKOwDI=
github.com/threefoldtech/zosbase v0.1.4/go.mod h1:rxc49wA04S4IsBOYe0omVO7nu7GXridueh2PJh34gSo=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms=
Expand Down
2 changes: 1 addition & 1 deletion grid-client/integration_tests/batch_gateway_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"

"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

func TestBatchGatewayNameDeployment(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion grid-client/integration_tests/gateway_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"

"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

func TestGatewayNameDeployment(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion grid-client/integration_tests/gatway_fqdn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"

"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

func TestGatewayFQDNDeployment(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion grid-client/integration_tests/qsfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion grid-client/integration_tests/zdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/deployer"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

func TestZDBDeployment(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions grid-client/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/subi"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go"
"github.com/threefoldtech/zos/pkg/capacity/dmi"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/capacity/dmi"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

// ErrNoAccessibleInterfaceFound no accessible interface found
Expand Down
14 changes: 7 additions & 7 deletions grid-client/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/subi"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
"golang.org/x/exp/maps"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
Expand Down Expand Up @@ -91,7 +91,7 @@ func (st *State) LoadGatewayFQDNFromGrid(ctx context.Context, nodeID uint32, nam
if err != nil {
return workloads.GatewayFQDNProxy{}, errors.Wrapf(err, "could not generate deployment metadata for %s", name)
}
gateway, err := workloads.NewGatewayFQDNProxyFromZosWorkload(*wl.Workload3())
gateway, err := workloads.NewGatewayFQDNProxyFromZosWorkload(*wl.Workload())
if err != nil {
return workloads.GatewayFQDNProxy{}, err
}
Expand Down Expand Up @@ -127,7 +127,7 @@ func (st *State) LoadGatewayNameFromGrid(ctx context.Context, nodeID uint32, nam
if err != nil {
return workloads.GatewayNameProxy{}, errors.Wrapf(err, "could not generate deployment metadata for %s", deploymentName)
}
gateway, err := workloads.NewGatewayNameProxyFromZosWorkload(*wl.Workload3())
gateway, err := workloads.NewGatewayNameProxyFromZosWorkload(*wl.Workload())
if err != nil {
return workloads.GatewayNameProxy{}, err
}
Expand Down Expand Up @@ -194,12 +194,12 @@ func (st *State) LoadK8sFromGrid(ctx context.Context, nodeIDs []uint32, deployme
return workloads.K8sCluster{}, errors.Wrapf(err, "could not compute node %s, resources", workload.Name)
}

node, err := workloads.NewK8sNodeFromWorkload(*workload.Workload3(), nodeID, workloadDiskSize[workload.Name], workloadComputedIP[workload.Name], workloadComputedIP6[workload.Name])
node, err := workloads.NewK8sNodeFromWorkload(*workload.Workload(), nodeID, workloadDiskSize[workload.Name], workloadComputedIP[workload.Name], workloadComputedIP6[workload.Name])
if err != nil {
return workloads.K8sCluster{}, errors.Wrapf(err, "could not generate node data for %s", workload.Name)
}

isMaster, err := isMasterNode(*workload.Workload3())
isMaster, err := isMasterNode(*workload.Workload())
if err != nil {
return workloads.K8sCluster{}, err
}
Expand Down Expand Up @@ -282,7 +282,7 @@ func (st *State) computeK8sDeploymentResources(dl zosTypes.Deployment) (

case zos.ZMountType.String():

d, err := w.Workload3().WorkloadData()
d, err := w.Workload().WorkloadData()
if err != nil {
return workloadDiskSize, workloadComputedIP, workloadComputedIP6, errors.Wrap(err, "failed to load disk data")
}
Expand Down
4 changes: 2 additions & 2 deletions grid-client/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
client "github.com/threefoldtech/tfgrid-sdk-go/grid-client/node"
"github.com/threefoldtech/tfgrid-sdk-go/grid-client/workloads"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)

Expand Down
9 changes: 3 additions & 6 deletions grid-client/workloads/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package workloads
import (
"github.com/pkg/errors"
zosTypes "github.com/threefoldtech/tfgrid-sdk-go/grid-client/zos"
"github.com/threefoldtech/zos/pkg/gridtypes/zos"
"github.com/threefoldtech/zosbase/pkg/gridtypes/zos"
)

// Disk struct
Expand All @@ -18,12 +18,9 @@ type Disk struct {
func NewDiskFromWorkload(wl *zosTypes.Workload) (Disk, error) {
var dataI interface{}

dataI, err := wl.Workload3().WorkloadData()
dataI, err := wl.Workload().WorkloadData()
if err != nil {
dataI, err = wl.Workload4().WorkloadData()
if err != nil {
return Disk{}, errors.Wrap(err, "failed to get workload data")
}
return Disk{}, errors.Wrap(err, "failed to get workload data")
}

data, ok := dataI.(*zos.ZMount)
Expand Down
Loading
Loading