From bd49c048383c0b179869acbe0e4d5dc59019b428 Mon Sep 17 00:00:00 2001 From: Artur Troian Date: Tue, 11 Apr 2023 18:58:35 -0400 Subject: [PATCH] feat: store provider specific parametrs for the lease in the CRD (#108) Signed-off-by: Artur Troian --- cluster/client.go | 63 ++- cluster/inventory.go | 1 + cluster/inventory_test.go | 2 +- cluster/kube/apply.go | 23 + cluster/kube/builder/builder.go | 13 +- cluster/kube/builder/builder_test.go | 80 ++-- cluster/kube/builder/deployment.go | 32 +- cluster/kube/builder/deployment_test.go | 9 +- cluster/kube/builder/manifest.go | 5 +- cluster/kube/builder/namespace.go | 4 +- cluster/kube/builder/netpol.go | 3 +- cluster/kube/builder/params_lease.go | 67 +++ cluster/kube/builder/podsecuritypolicy.go | 19 +- cluster/kube/builder/service.go | 35 +- cluster/kube/builder/statefulset.go | 28 +- cluster/kube/builder/workload.go | 69 +-- cluster/kube/cleanup.go | 4 +- cluster/kube/client.go | 39 +- cluster/kube/client_test.go | 4 +- cluster/kube/cluster_ip_connections.go | 9 +- cluster/kube/inventory.go | 8 +- cluster/kube/k8s_integration_test.go | 1 + cluster/kube/metallb/client.go | 12 +- cluster/manager.go | 26 +- cluster/mocks/client.go | 378 ++++++++-------- cluster/mocks/cluster.go | 21 +- cluster/mocks/deployment.go | 2 +- cluster/mocks/hostname_service_client.go | 46 +- cluster/mocks/ip_operator_client.go | 2 +- cluster/mocks/metallb_client.go | 68 +-- cluster/mocks/read_client.go | 206 ++++----- cluster/mocks/reservation.go | 18 +- cluster/mocks/service.go | 56 +-- cluster/monitor_test.go | 4 +- cluster/types/v1beta2/types.go | 16 +- cluster/types/v1beta3/deployment.go | 90 ++++ cluster/types/v1beta3/directives.go | 2 +- cluster/types/v1beta3/hostname.go | 2 +- cluster/types/v1beta3/interfaces.go | 7 +- cluster/types/v1beta3/ip.go | 2 +- cluster/types/v1beta3/reservation.go | 2 +- cluster/types/v1beta3/types.go | 11 +- event/events.go | 8 +- gateway/rest/integration_test.go | 2 +- gateway/rest/router_test.go | 2 +- go.mod | 2 - make/codegen.mk | 21 +- make/init.mk | 2 +- make/test-integration.mk | 4 +- manifest/mocks/client.go | 2 +- manifest/mocks/status_client.go | 2 +- mocks/client.go | 36 +- mocks/status_client.go | 2 +- operator/ipoperator/ip_operator.go | 13 +- operator/ipoperator/ip_operator_test.go | 30 +- operator/ipoperator/ip_operator_types.go | 4 +- pkg/apis/akash.network/crd.yaml | 69 +++ pkg/apis/akash.network/v2beta1/types.go | 53 +-- .../v2beta2/k8s_integration_test.go | 12 +- .../v2beta2/lease_params_service.go | 45 ++ pkg/apis/akash.network/v2beta2/manifest.go | 316 ++++++++++++++ .../akash.network/v2beta2/provider_host.go | 40 ++ .../v2beta2/provider_lease_ip.go | 38 ++ pkg/apis/akash.network/v2beta2/register.go | 4 + pkg/apis/akash.network/v2beta2/types.go | 403 +----------------- pkg/apis/akash.network/v2beta2/types_test.go | 10 +- .../v2beta2/zz_generated.deepcopy.go | 186 +++++++- .../v2beta2/akash.network_client.go | 5 + .../v2beta2/fake/fake_akash.network_client.go | 4 + .../v2beta2/fake/fake_leaseparamsservice.go | 142 ++++++ .../v2beta2/generated_expansion.go | 2 + .../v2beta2/leaseparamsservice.go | 195 +++++++++ .../akash.network/v2beta2/interface.go | 7 + .../v2beta2/leaseparamsservice.go | 90 ++++ .../informers/externalversions/generic.go | 2 + .../v2beta2/expansion_generated.go | 8 + .../v2beta2/leaseparamsservice.go | 99 +++++ tools.go | 1 - 78 files changed, 2231 insertions(+), 1119 deletions(-) create mode 100644 cluster/kube/builder/params_lease.go create mode 100644 cluster/types/v1beta3/deployment.go create mode 100644 pkg/apis/akash.network/v2beta2/lease_params_service.go create mode 100644 pkg/apis/akash.network/v2beta2/manifest.go create mode 100644 pkg/apis/akash.network/v2beta2/provider_host.go create mode 100644 pkg/apis/akash.network/v2beta2/provider_lease_ip.go create mode 100644 pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_leaseparamsservice.go create mode 100644 pkg/client/clientset/versioned/typed/akash.network/v2beta2/leaseparamsservice.go create mode 100644 pkg/client/informers/externalversions/akash.network/v2beta2/leaseparamsservice.go create mode 100644 pkg/client/listers/akash.network/v2beta2/leaseparamsservice.go diff --git a/cluster/client.go b/cluster/client.go index 69acc2374..9fd075b09 100644 --- a/cluster/client.go +++ b/cluster/client.go @@ -16,7 +16,7 @@ import ( "k8s.io/apimachinery/pkg/version" "k8s.io/client-go/tools/remotecommand" - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" "github.com/akash-network/akash-api/go/node/types/unit" @@ -25,12 +25,11 @@ import ( mquery "github.com/akash-network/node/x/market/query" ctypes "github.com/akash-network/provider/cluster/types/v1beta3" - akashtypes "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) +// Errors types returned by the Exec function on the client interface var ( - // Errors types returned by the Exec function on the client interface ErrExec = errors.New("remote command execute error") ErrExecNoServiceWithName = fmt.Errorf("%w: no such service exists with that name", ErrExec) ErrExecServiceNotRunning = fmt.Errorf("%w: service with that name is not running", ErrExec) @@ -59,7 +58,7 @@ type ReadClient interface { GetHostnameDeploymentConnections(ctx context.Context) ([]ctypes.LeaseIDHostnameConnection, error) ObserveIPState(ctx context.Context) (<-chan ctypes.IPResourceEvent, error) - GetDeclaredIPs(ctx context.Context, leaseID mtypes.LeaseID) ([]akashtypes.ProviderLeasedIPSpec, error) + GetDeclaredIPs(ctx context.Context, leaseID mtypes.LeaseID) ([]crd.ProviderLeasedIPSpec, error) } // Client interface lease and deployment methods @@ -67,7 +66,7 @@ type ReadClient interface { //go:generate mockery --name Client type Client interface { ReadClient - Deploy(ctx context.Context, lID mtypes.LeaseID, mgroup *manifest.Group) error + Deploy(ctx context.Context, lID mtypes.LeaseID, mgroup *mani.Group) error TeardownLease(context.Context, mtypes.LeaseID) error Deployments(context.Context) ([]ctypes.Deployment, error) Inventory(context.Context) (ctypes.Inventory, error) @@ -82,14 +81,14 @@ type Client interface { tty bool, tsq remotecommand.TerminalSizeQueue) (ctypes.ExecResult, error) - // Connect a given hostname to a deployment + // ConnectHostnameToDeployment Connect a given hostname to a deployment ConnectHostnameToDeployment(ctx context.Context, directive ctypes.ConnectHostnameToDeploymentDirective) error - // Remove a given hostname from a deployment + // RemoveHostnameFromDeployment Remove a given hostname from a deployment RemoveHostnameFromDeployment(ctx context.Context, hostname string, leaseID mtypes.LeaseID, allowMissing bool) error - // Declare that a given deployment should be connected to a given hostname + // DeclareHostname Declare that a given deployment should be connected to a given hostname DeclareHostname(ctx context.Context, lID mtypes.LeaseID, host string, serviceName string, externalPort uint32) error - // Purge any hostnames associated with a given deployment + // PurgeDeclaredHostnames Purge any hostnames associated with a given deployment PurgeDeclaredHostnames(ctx context.Context, lID mtypes.LeaseID) error PurgeDeclaredHostname(ctx context.Context, lID mtypes.LeaseID, hostname string) error @@ -97,8 +96,8 @@ type Client interface { // KubeVersion returns the version information of kubernetes running in the cluster KubeVersion() (*version.Info, error) - DeclareIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, port uint32, externalPort uint32, proto manifest.ServiceProtocol, sharingKey string, overwrite bool) error - PurgeDeclaredIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, externalPort uint32, proto manifest.ServiceProtocol) error + DeclareIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, port uint32, externalPort uint32, proto mani.ServiceProtocol, sharingKey string, overwrite bool) error + PurgeDeclaredIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, externalPort uint32, proto mani.ServiceProtocol) error PurgeDeclaredIPs(ctx context.Context, lID mtypes.LeaseID) error } @@ -139,7 +138,7 @@ func (rp *resourcePair) subNLZ(val types.ResourceValue) bool { return true } -func (rp resourcePair) available() sdk.Int { +func (rp *resourcePair) available() sdk.Int { return rp.allocatable.Sub(rp.allocated) } @@ -376,7 +375,7 @@ const ( type nullLease struct { ctx context.Context cancel func() - group *manifest.Group + group *mani.Group } type nullClient struct { @@ -401,40 +400,38 @@ func NullClient() Client { } } -func (c *nullClient) RemoveHostnameFromDeployment(ctx context.Context, hostname string, leaseID mtypes.LeaseID, allowMissing bool) error { +func (c *nullClient) RemoveHostnameFromDeployment(_ context.Context, _ string, _ mtypes.LeaseID, _ bool) error { return errNotImplemented } -func (c *nullClient) ObserveHostnameState(ctx context.Context) (<-chan ctypes.HostnameResourceEvent, error) { +func (c *nullClient) ObserveHostnameState(_ context.Context) (<-chan ctypes.HostnameResourceEvent, error) { return nil, errNotImplemented } -func (c *nullClient) GetDeployments(ctx context.Context, dID dtypes.DeploymentID) ([]ctypes.Deployment, error) { +func (c *nullClient) GetDeployments(_ context.Context, _ dtypes.DeploymentID) ([]ctypes.Deployment, error) { return nil, errNotImplemented } -func (c *nullClient) GetHostnameDeploymentConnections(ctx context.Context) ([]ctypes.LeaseIDHostnameConnection, error) { + +func (c *nullClient) GetHostnameDeploymentConnections(_ context.Context) ([]ctypes.LeaseIDHostnameConnection, error) { return nil, errNotImplemented } -// Connect a given hostname to a deployment -func (c *nullClient) ConnectHostnameToDeployment(ctx context.Context, directive ctypes.ConnectHostnameToDeploymentDirective) error { +func (c *nullClient) ConnectHostnameToDeployment(_ context.Context, _ ctypes.ConnectHostnameToDeploymentDirective) error { return errNotImplemented } -// Declare that a given deployment should be connected to a given hostname -func (c *nullClient) DeclareHostname(ctx context.Context, lID mtypes.LeaseID, host string, serviceName string, externalPort uint32) error { +func (c *nullClient) DeclareHostname(_ context.Context, _ mtypes.LeaseID, _ string, _ string, _ uint32) error { return errNotImplemented } -// Purge any hostnames associated with a given deployment -func (c *nullClient) PurgeDeclaredHostnames(ctx context.Context, lID mtypes.LeaseID) error { +func (c *nullClient) PurgeDeclaredHostnames(_ context.Context, _ mtypes.LeaseID) error { return errNotImplemented } -func (c *nullClient) PurgeDeclaredHostname(ctx context.Context, lID mtypes.LeaseID, hostname string) error { +func (c *nullClient) PurgeDeclaredHostname(_ context.Context, _ mtypes.LeaseID, _ string) error { return errNotImplemented } -func (c *nullClient) Deploy(ctx context.Context, lid mtypes.LeaseID, mgroup *manifest.Group) error { +func (c *nullClient) Deploy(ctx context.Context, lid mtypes.LeaseID, mgroup *mani.Group) error { c.mtx.Lock() defer c.mtx.Unlock() @@ -496,7 +493,7 @@ func (c *nullClient) LeaseEvents(ctx context.Context, lid mtypes.LeaseID, _ stri genEvent := func() *eventsv1.Event { return &eventsv1.Event{ EventTime: v1.NewMicroTime(time.Now()), - ReportingController: lease.group.Name, + ReportingController: lease.group.GetName(), } } @@ -611,30 +608,30 @@ func (c *nullClient) KubeVersion() (*version.Info, error) { return nil, nil } -func (c *nullClient) DeclareIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, port uint32, externalPort uint32, proto manifest.ServiceProtocol, sharingKey string, overwrite bool) error { +func (c *nullClient) DeclareIP(_ context.Context, _ mtypes.LeaseID, _ string, _ uint32, _ uint32, _ mani.ServiceProtocol, _ string, _ bool) error { return errNotImplemented } -func (c *nullClient) PurgeDeclaredIPs(ctx context.Context, lID mtypes.LeaseID) error { +func (c *nullClient) PurgeDeclaredIPs(_ context.Context, _ mtypes.LeaseID) error { return errNotImplemented } -func (c *nullClient) ObserveIPState(ctx context.Context) (<-chan ctypes.IPResourceEvent, error) { +func (c *nullClient) ObserveIPState(_ context.Context) (<-chan ctypes.IPResourceEvent, error) { return nil, errNotImplemented } -func (c *nullClient) CreateIPPassthrough(ctx context.Context, lID mtypes.LeaseID, directive ctypes.ClusterIPPassthroughDirective) error { +func (c *nullClient) CreateIPPassthrough(_ context.Context, _ mtypes.LeaseID, _ ctypes.ClusterIPPassthroughDirective) error { return errNotImplemented } -func (c *nullClient) PurgeIPPassthrough(ctx context.Context, lID mtypes.LeaseID, directive ctypes.ClusterIPPassthroughDirective) error { +func (c *nullClient) PurgeIPPassthrough(_ context.Context, _ mtypes.LeaseID, _ ctypes.ClusterIPPassthroughDirective) error { return errNotImplemented } -func (c *nullClient) PurgeDeclaredIP(ctx context.Context, lID mtypes.LeaseID, serviceName string, externalPort uint32, proto manifest.ServiceProtocol) error { +func (c *nullClient) PurgeDeclaredIP(_ context.Context, _ mtypes.LeaseID, _ string, _ uint32, _ mani.ServiceProtocol) error { return errNotImplemented } -func (c *nullClient) GetDeclaredIPs(ctx context.Context, leaseID mtypes.LeaseID) ([]akashtypes.ProviderLeasedIPSpec, error) { +func (c *nullClient) GetDeclaredIPs(_ context.Context, _ mtypes.LeaseID) ([]crd.ProviderLeasedIPSpec, error) { return nil, errNotImplemented } diff --git a/cluster/inventory.go b/cluster/inventory.go index 27cb537f6..31b538bed 100644 --- a/cluster/inventory.go +++ b/cluster/inventory.go @@ -19,6 +19,7 @@ import ( dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" atypes "github.com/akash-network/akash-api/go/node/types/v1beta3" + "github.com/akash-network/node/pubsub" sdlutil "github.com/akash-network/node/sdl/util" "github.com/akash-network/node/util/runner" diff --git a/cluster/inventory_test.go b/cluster/inventory_test.go index c6735e27a..0dbdfbad6 100644 --- a/cluster/inventory_test.go +++ b/cluster/inventory_test.go @@ -173,7 +173,7 @@ func TestInventory_ClusterDeploymentDeployed(t *testing.T) { deployment := &mocks.Deployment{} deployment.On("LeaseID").Return(lid) - groupServices := make([]manifest.Service, 1) + groupServices := make(manifest.Services, 1) serviceCount := testutil.RandRangeInt(1, 10) serviceEndpoints := make([]types.Endpoint, serviceCount) diff --git a/cluster/kube/apply.go b/cluster/kube/apply.go index 6d7167a1c..aa63b35d5 100644 --- a/cluster/kube/apply.go +++ b/cluster/kube/apply.go @@ -175,3 +175,26 @@ func applyManifest(ctx context.Context, kc crdapi.Interface, b builder.Manifest) } return err } + +func applyServicesParams(ctx context.Context, kc crdapi.Interface, b builder.ParamsServices) error { + obj, err := kc.AkashV2beta2().LeaseParamsServices(b.NS()).Get(ctx, b.Name(), metav1.GetOptions{}) + + metricsutils.IncCounterVecWithLabelValuesFiltered(kubeCallsCounter, "akash-parameters-get", err, errors.IsNotFound) + + switch { + case err == nil: + // TODO - only run this update if it would change something + obj, err = b.Update(obj) + if err == nil { + _, err = kc.AkashV2beta2().LeaseParamsServices(b.NS()).Update(ctx, obj, metav1.UpdateOptions{}) + metricsutils.IncCounterVecWithLabelValues(kubeCallsCounter, "akash-parameters-update", err) + } + case errors.IsNotFound(err): + obj, err = b.Create() + if err == nil { + _, err = kc.AkashV2beta2().LeaseParamsServices(b.NS()).Create(ctx, obj, metav1.CreateOptions{}) + metricsutils.IncCounterVecWithLabelValues(kubeCallsCounter, "akash-parameters-create", err) + } + } + return err +} diff --git a/cluster/kube/builder/builder.go b/cluster/kube/builder/builder.go index 6bbb428c1..bc31621f2 100644 --- a/cluster/kube/builder/builder.go +++ b/cluster/kube/builder/builder.go @@ -1,20 +1,19 @@ package builder -// nolint:deadcode,golint - import ( "fmt" "strconv" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" "github.com/tendermint/tendermint/libs/log" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/intstr" - manifesttypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" clusterUtil "github.com/akash-network/provider/cluster/util" + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) const ( @@ -23,16 +22,15 @@ const ( AkashNetworkStorageClasses = "akash.network/storageclasses" AkashServiceTarget = "akash.network/service-target" AkashMetalLB = "metal-lb" + akashDeploymentPolicyName = "akash-deployment-restrictions" - akashNetworkNamespace = "akash.network/namespace" - + akashNetworkNamespace = "akash.network/namespace" AkashLeaseOwnerLabelName = "akash.network/lease.id.owner" AkashLeaseDSeqLabelName = "akash.network/lease.id.dseq" AkashLeaseGSeqLabelName = "akash.network/lease.id.gseq" AkashLeaseOSeqLabelName = "akash.network/lease.id.oseq" AkashLeaseProviderLabelName = "akash.network/lease.id.provider" AkashLeaseManifestVersion = "akash.network/manifest.version" - akashDeploymentPolicyName = "akash-deployment-restrictions" ) const ( @@ -65,7 +63,8 @@ type builder struct { log log.Logger settings Settings lid mtypes.LeaseID - group *manifesttypes.Group + group *mani.Group + sparams crd.ParamsServices } var _ builderBase = (*builder)(nil) diff --git a/cluster/kube/builder/builder_test.go b/cluster/kube/builder/builder_test.go index 15310b4d2..3f900bc90 100644 --- a/cluster/kube/builder/builder_test.go +++ b/cluster/kube/builder/builder_test.go @@ -65,13 +65,17 @@ func TestLidNsSanity(t *testing.T) { func TestGlobalServiceBuilder(t *testing.T) { myLog := testutil.Logger(t) - group := &manitypes.Group{} - service := &manitypes.Service{ - Name: "myservice", + group := &manitypes.Group{ + Services: manitypes.Services{ + manitypes.Service{ + Name: "myservice", + }, + }, } + mySettings := NewDefaultSettings() lid := testutil.LeaseID(t) - serviceBuilder := BuildService(myLog, mySettings, lid, group, service, true) + serviceBuilder := BuildService(myLog, mySettings, lid, group, 0, true) require.NotNil(t, serviceBuilder) // Should have name ending with suffix require.Equal(t, "myservice-np", serviceBuilder.Name()) @@ -81,13 +85,16 @@ func TestGlobalServiceBuilder(t *testing.T) { func TestLocalServiceBuilder(t *testing.T) { myLog := testutil.Logger(t) - group := &manitypes.Group{} - service := &manitypes.Service{ - Name: "myservice", + group := &manitypes.Group{ + Services: manitypes.Services{ + manitypes.Service{ + Name: "myservice", + }, + }, } mySettings := NewDefaultSettings() lid := testutil.LeaseID(t) - serviceBuilder := BuildService(myLog, mySettings, lid, group, service, false) + serviceBuilder := BuildService(myLog, mySettings, lid, group, 0, false) require.NotNil(t, serviceBuilder) // Should have name verbatim require.Equal(t, "myservice", serviceBuilder.Name()) @@ -97,16 +104,20 @@ func TestLocalServiceBuilder(t *testing.T) { func TestGlobalServiceBuilderWithoutGlobalServices(t *testing.T) { myLog := testutil.Logger(t) - group := &manitypes.Group{} exposesServices := make([]manitypes.ServiceExpose, 1) exposesServices[0].Global = false - service := &manitypes.Service{ - Name: "myservice", - Expose: exposesServices, + group := &manitypes.Group{ + Services: manitypes.Services{ + manitypes.Service{ + Name: "myservice", + Expose: exposesServices, + }, + }, } + mySettings := NewDefaultSettings() lid := testutil.LeaseID(t) - serviceBuilder := BuildService(myLog, mySettings, lid, group, service, true) + serviceBuilder := BuildService(myLog, mySettings, lid, group, 0, true) // Should not have any work to do require.False(t, serviceBuilder.Any()) @@ -114,7 +125,6 @@ func TestGlobalServiceBuilderWithoutGlobalServices(t *testing.T) { func TestGlobalServiceBuilderWithGlobalServices(t *testing.T) { myLog := testutil.Logger(t) - group := &manitypes.Group{} exposesServices := make([]manitypes.ServiceExpose, 2) exposesServices[0] = manitypes.ServiceExpose{ Global: true, @@ -128,13 +138,18 @@ func TestGlobalServiceBuilderWithGlobalServices(t *testing.T) { Port: 2000, ExternalPort: 2001, } - service := &manitypes.Service{ - Name: "myservice", - Expose: exposesServices, + group := &manitypes.Group{ + Services: manitypes.Services{ + manitypes.Service{ + Name: "myservice", + Expose: exposesServices, + }, + }, } + mySettings := NewDefaultSettings() lid := testutil.LeaseID(t) - serviceBuilder := BuildService(myLog, mySettings, lid, group, service, true) + serviceBuilder := BuildService(myLog, mySettings, lid, group, 0, true) // Should have work to do require.True(t, serviceBuilder.Any()) @@ -151,16 +166,21 @@ func TestGlobalServiceBuilderWithGlobalServices(t *testing.T) { func TestLocalServiceBuilderWithoutLocalServices(t *testing.T) { myLog := testutil.Logger(t) - group := &manitypes.Group{} exposesServices := make([]manitypes.ServiceExpose, 1) exposesServices[0].Global = true - service := &manitypes.Service{ - Name: "myservice", - Expose: exposesServices, + + group := &manitypes.Group{ + Services: manitypes.Services{ + manitypes.Service{ + Name: "myservice", + Expose: exposesServices, + }, + }, } + mySettings := NewDefaultSettings() lid := testutil.LeaseID(t) - serviceBuilder := BuildService(myLog, mySettings, lid, group, service, false) + serviceBuilder := BuildService(myLog, mySettings, lid, group, 0, false) // Should have work to do require.False(t, serviceBuilder.Any()) @@ -168,7 +188,6 @@ func TestLocalServiceBuilderWithoutLocalServices(t *testing.T) { func TestLocalServiceBuilderWithLocalServices(t *testing.T) { myLog := testutil.Logger(t) - group := &manitypes.Group{} exposesServices := make([]manitypes.ServiceExpose, 2) exposesServices[0] = manitypes.ServiceExpose{ Global: true, @@ -182,13 +201,18 @@ func TestLocalServiceBuilderWithLocalServices(t *testing.T) { Port: 2000, ExternalPort: 2001, } - service := &manitypes.Service{ - Name: "myservice", - Expose: exposesServices, + group := &manitypes.Group{ + Services: manitypes.Services{ + manitypes.Service{ + Name: "myservice", + Expose: exposesServices, + }, + }, } + mySettings := NewDefaultSettings() lid := testutil.LeaseID(t) - serviceBuilder := BuildService(myLog, mySettings, lid, group, service, false) + serviceBuilder := BuildService(myLog, mySettings, lid, group, 0, false) // Should have work to do require.True(t, serviceBuilder.Any()) diff --git a/cluster/kube/builder/deployment.go b/cluster/kube/builder/deployment.go index 22f1b1273..0708fc33f 100644 --- a/cluster/kube/builder/deployment.go +++ b/cluster/kube/builder/deployment.go @@ -1,13 +1,15 @@ package builder import ( + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" "github.com/tendermint/tendermint/libs/log" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - manitypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" + + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) type Deployment interface { @@ -22,22 +24,32 @@ type deployment struct { var _ Deployment = (*deployment)(nil) -func NewDeployment(log log.Logger, settings Settings, lid mtypes.LeaseID, group *manitypes.Group, service *manitypes.Service) Deployment { +func NewDeployment( + log log.Logger, + settings Settings, + lid mtypes.LeaseID, + group *mani.Group, + sparams crd.ParamsServices, + serviceIdx int) Deployment { return &deployment{ - workload: newWorkloadBuilder(log, settings, lid, group, service), + workload: newWorkloadBuilder(log, settings, lid, group, sparams, serviceIdx), } } func (b *deployment) Create() (*appsv1.Deployment, error) { // nolint:golint,unparam - replicas := int32(b.service.Count) + service := &b.group.Services[b.serviceIdx] + params := &b.sparams[b.serviceIdx].Params + + replicas := int32(service.Count) falseValue := false // fixme b.runtimeClassName is updated on call to the container() containers := []corev1.Container{b.container()} var effectiveRuntimeClassName *string - if len(b.runtimeClassName) != 0 && b.runtimeClassName != runtimeClassNoneValue { - effectiveRuntimeClassName = &b.runtimeClassName + if len(params.RuntimeClass) != 0 && params.RuntimeClass != runtimeClassNoneValue { + runtimeClass := params.RuntimeClass + effectiveRuntimeClassName = &runtimeClass } kdeployment := &appsv1.Deployment{ @@ -71,19 +83,15 @@ func (b *deployment) Create() (*appsv1.Deployment, error) { // nolint:golint,unp } func (b *deployment) Update(obj *appsv1.Deployment) (*appsv1.Deployment, error) { // nolint:golint,unparam - var effectiveRuntimeClassName *string - if len(b.runtimeClassName) != 0 && b.runtimeClassName != runtimeClassNoneValue { - effectiveRuntimeClassName = &b.runtimeClassName - } + service := &b.group.Services[b.serviceIdx] + replicas := int32(service.Count) - replicas := int32(b.service.Count) obj.Labels = b.labels() obj.Spec.Selector.MatchLabels = b.labels() obj.Spec.Replicas = &replicas obj.Spec.Template.Labels = b.labels() obj.Spec.Template.Spec.Containers = []corev1.Container{b.container()} obj.Spec.Template.Spec.ImagePullSecrets = b.imagePullSecrets() - obj.Spec.Template.Spec.RuntimeClassName = effectiveRuntimeClassName return obj, nil } diff --git a/cluster/kube/builder/deployment_test.go b/cluster/kube/builder/deployment_test.go index 978278c3f..941dff1a5 100644 --- a/cluster/kube/builder/deployment_test.go +++ b/cluster/kube/builder/deployment_test.go @@ -8,6 +8,8 @@ import ( "github.com/akash-network/node/testutil" "github.com/stretchr/testify/require" + + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) func TestDeploySetsEnvironmentVariables(t *testing.T) { @@ -22,8 +24,11 @@ func TestDeploySetsEnvironmentVariables(t *testing.T) { mani, err := sdl.Manifest() require.NoError(t, err) - service := mani.GetGroups()[0].Services[0] - deploymentBuilder := NewDeployment(log, settings, lid, &mani.GetGroups()[0], &service) + + sparams := make(crd.ParamsServices, len(mani.GetGroups()[0].Services)) + + deploymentBuilder := NewDeployment(log, settings, lid, &mani.GetGroups()[0], sparams, 0) + require.NotNil(t, deploymentBuilder) dbuilder := deploymentBuilder.(*deployment) diff --git a/cluster/kube/builder/manifest.go b/cluster/kube/builder/manifest.go index d5bd36d83..070a064e6 100644 --- a/cluster/kube/builder/manifest.go +++ b/cluster/kube/builder/manifest.go @@ -1,9 +1,9 @@ package builder import ( + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" "github.com/tendermint/tendermint/libs/log" - manitypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" @@ -25,7 +25,7 @@ type manifest struct { var _ Manifest = (*manifest)(nil) -func BuildManifest(log log.Logger, settings Settings, ns string, lid mtypes.LeaseID, group *manitypes.Group) Manifest { +func BuildManifest(log log.Logger, settings Settings, ns string, lid mtypes.LeaseID, group *mani.Group) Manifest { return &manifest{ builder: builder{ log: log.With("module", "kube-builder"), @@ -42,7 +42,6 @@ func (b *manifest) labels() map[string]string { } func (b *manifest) Create() (*crd.Manifest, error) { - obj, err := crd.NewManifest(b.mns, b.lid, b.group) if err != nil { diff --git a/cluster/kube/builder/namespace.go b/cluster/kube/builder/namespace.go index 27880dbb0..c0629d765 100644 --- a/cluster/kube/builder/namespace.go +++ b/cluster/kube/builder/namespace.go @@ -1,10 +1,10 @@ package builder import ( + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - manitypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" ) @@ -20,7 +20,7 @@ type ns struct { var _ NS = (*ns)(nil) -func BuildNS(settings Settings, lid mtypes.LeaseID, group *manitypes.Group) NS { +func BuildNS(settings Settings, lid mtypes.LeaseID, group *mani.Group) NS { return &ns{builder: builder{settings: settings, lid: lid, group: group}} } diff --git a/cluster/kube/builder/netpol.go b/cluster/kube/builder/netpol.go index 17b73382a..db3372494 100644 --- a/cluster/kube/builder/netpol.go +++ b/cluster/kube/builder/netpol.go @@ -8,6 +8,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" manitypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" sdlutil "github.com/akash-network/node/sdl/util" @@ -25,7 +26,7 @@ type netPol struct { var _ NetPol = (*netPol)(nil) -func BuildNetPol(settings Settings, lid mtypes.LeaseID, group *manitypes.Group) NetPol { +func BuildNetPol(settings Settings, lid mtypes.LeaseID, group *mani.Group) NetPol { return &netPol{builder: builder{settings: settings, lid: lid, group: group}} } diff --git a/cluster/kube/builder/params_lease.go b/cluster/kube/builder/params_lease.go new file mode 100644 index 000000000..549e478db --- /dev/null +++ b/cluster/kube/builder/params_lease.go @@ -0,0 +1,67 @@ +package builder + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/tendermint/tendermint/libs/log" + + mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" + + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" +) + +type ParamsServices interface { + builderBase + Create() (*crd.LeaseParamsService, error) + Update(obj *crd.LeaseParamsService) (*crd.LeaseParamsService, error) + Name() string +} + +type paramsServices struct { + builder + ns string +} + +var _ ParamsServices = (*paramsServices)(nil) + +func BuildParamsLeases(log log.Logger, settings Settings, ns string, lid mtypes.LeaseID, params crd.ParamsServices) ParamsServices { + return ¶msServices{ + builder: builder{ + log: log.With("module", "kube-builder"), + settings: settings, + lid: lid, + sparams: params, + }, + ns: ns, + } +} + +func (b *paramsServices) labels() map[string]string { + return AppendLeaseLabels(b.lid, b.builder.labels()) +} + +func (b *paramsServices) Create() (*crd.LeaseParamsService, error) { + obj := &crd.LeaseParamsService{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: b.ns, + Name: b.Name(), + Labels: b.labels(), + }, + Spec: crd.LeaseParamsServiceSpec{ + Services: b.sparams, + }, + } + + return obj, nil +} + +func (b *paramsServices) Update(obj *crd.LeaseParamsService) (*crd.LeaseParamsService, error) { + cobj := *obj + cobj.Spec.Services = b.sparams + + return &cobj, nil +} + +func (b *paramsServices) NS() string { + return b.ns +} diff --git a/cluster/kube/builder/podsecuritypolicy.go b/cluster/kube/builder/podsecuritypolicy.go index 23a951427..fb5193d9f 100644 --- a/cluster/kube/builder/podsecuritypolicy.go +++ b/cluster/kube/builder/podsecuritypolicy.go @@ -1,12 +1,14 @@ package builder import ( + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" corev1 "k8s.io/api/core/v1" "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - manitypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" + + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) type PspRestricted interface { @@ -20,8 +22,19 @@ type pspRestricted struct { builder } -func BuildPSP(settings Settings, lid mtypes.LeaseID, group *manitypes.Group) PspRestricted { // nolint:golint,unparam - return &pspRestricted{builder: builder{settings: settings, lid: lid, group: group}} +func BuildPSP( + settings Settings, + lid mtypes.LeaseID, + group *mani.Group, + sparams crd.ParamsServices) PspRestricted { // nolint:golint,unparam + return &pspRestricted{ + builder: builder{ + settings: settings, + lid: lid, + group: group, + sparams: sparams, + }, + } } func (p *pspRestricted) Name() string { diff --git a/cluster/kube/builder/service.go b/cluster/kube/builder/service.go index 38489ebed..fee97c0bd 100644 --- a/cluster/kube/builder/service.go +++ b/cluster/kube/builder/service.go @@ -9,8 +9,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" manitypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" + sdlutil "github.com/akash-network/node/sdl/util" ) @@ -28,9 +30,23 @@ type service struct { var _ Service = (*service)(nil) -func BuildService(log log.Logger, settings Settings, lid mtypes.LeaseID, group *manitypes.Group, mservice *manitypes.Service, requireNodePort bool) Service { +func BuildService( + log log.Logger, + settings Settings, + lid mtypes.LeaseID, + group *mani.Group, + serviceIdx int, + requireNodePort bool) Service { return &service{ - workload: newWorkloadBuilder(log, settings, lid, group, mservice), + workload: workload{ + builder: builder{ + settings: settings, + log: log.With("module", "kube-builder"), + lid: lid, + group: group, + }, + serviceIdx: serviceIdx, + }, requireNodePort: requireNodePort, } } @@ -66,7 +82,6 @@ func (b *service) Create() (*corev1.Service, error) { // nolint:golint,unparam Ports: ports, }, } - // b.log.Debug("provider/cluster/kube/builder: created service", "service", svc) return svc, nil } @@ -105,7 +120,9 @@ func (b *service) Update(obj *corev1.Service) (*corev1.Service, error) { // noli } func (b *service) Any() bool { - for _, expose := range b.service.Expose { + service := &b.group.Services[b.serviceIdx] + + for _, expose := range service.Expose { exposeIsIngress := sdlutil.ShouldBeIngress(expose) if b.requireNodePort && exposeIsIngress { continue @@ -126,9 +143,11 @@ var errUnsupportedProtocol = errors.New("Unsupported protocol for service") var errInvalidServiceBuilder = errors.New("service builder invalid") func (b *service) ports() ([]corev1.ServicePort, error) { - ports := make([]corev1.ServicePort, 0, len(b.service.Expose)) + service := &b.group.Services[b.serviceIdx] + + ports := make([]corev1.ServicePort, 0, len(service.Expose)) portsAdded := make(map[int32]struct{}) - for i, expose := range b.service.Expose { + for i, expose := range service.Expose { shouldBeIngress := sdlutil.ShouldBeIngress(expose) if expose.Global == b.requireNodePort || (!b.requireNodePort && shouldBeIngress) { if b.requireNodePort && shouldBeIngress { @@ -144,7 +163,7 @@ func (b *service) ports() ([]corev1.ServicePort, error) { default: return nil, errUnsupportedProtocol } - externalPort := sdlutil.ExposeExternalPort(b.service.Expose[i]) + externalPort := sdlutil.ExposeExternalPort(service.Expose[i]) _, added := portsAdded[externalPort] if !added { portsAdded[externalPort] = struct{}{} @@ -159,7 +178,7 @@ func (b *service) ports() ([]corev1.ServicePort, error) { } if len(ports) == 0 { - b.log.Debug("provider/cluster/kube/builder: created 0 ports", "requireNodePort", b.requireNodePort, "serviceExpose", b.service.Expose) + b.log.Debug("provider/cluster/kube/builder: created 0 ports", "requireNodePort", b.requireNodePort, "serviceExpose", service.Expose) return nil, errInvalidServiceBuilder } diff --git a/cluster/kube/builder/statefulset.go b/cluster/kube/builder/statefulset.go index c46200c65..3c52f7b03 100644 --- a/cluster/kube/builder/statefulset.go +++ b/cluster/kube/builder/statefulset.go @@ -1,13 +1,15 @@ package builder import ( + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" "github.com/tendermint/tendermint/libs/log" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - manitypes "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" + + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) type StatefulSet interface { @@ -22,22 +24,32 @@ type statefulSet struct { var _ StatefulSet = (*statefulSet)(nil) -func BuildStatefulSet(log log.Logger, settings Settings, lid mtypes.LeaseID, group *manitypes.Group, service *manitypes.Service) StatefulSet { +func BuildStatefulSet( + log log.Logger, + settings Settings, + lid mtypes.LeaseID, + group *mani.Group, + sparams crd.ParamsServices, + serviceIdx int) StatefulSet { return &statefulSet{ - workload: newWorkloadBuilder(log, settings, lid, group, service), + workload: newWorkloadBuilder(log, settings, lid, group, sparams, serviceIdx), } } func (b *statefulSet) Create() (*appsv1.StatefulSet, error) { // nolint:golint,unparam - replicas := int32(b.service.Count) + service := &b.group.Services[b.serviceIdx] + params := &b.sparams[b.serviceIdx].Params + + replicas := int32(service.Count) falseValue := false // fixme b.runtimeClassName is updated on call to the container() containers := []corev1.Container{b.container()} var effectiveRuntimeClassName *string - if len(b.runtimeClassName) != 0 && b.runtimeClassName != runtimeClassNoneValue { - effectiveRuntimeClassName = &b.runtimeClassName + if len(params.RuntimeClass) != 0 && params.RuntimeClass != runtimeClassNoneValue { + runtimeClass := params.RuntimeClass + effectiveRuntimeClassName = &runtimeClass } kdeployment := &appsv1.StatefulSet{ @@ -72,7 +84,9 @@ func (b *statefulSet) Create() (*appsv1.StatefulSet, error) { // nolint:golint,u } func (b *statefulSet) Update(obj *appsv1.StatefulSet) (*appsv1.StatefulSet, error) { // nolint:golint,unparam - replicas := int32(b.service.Count) + service := &b.group.Services[b.serviceIdx] + replicas := int32(service.Count) + obj.Labels = b.labels() obj.Spec.Selector.MatchLabels = b.labels() obj.Spec.Replicas = &replicas diff --git a/cluster/kube/builder/workload.go b/cluster/kube/builder/workload.go index e70dce119..41e51ca0c 100644 --- a/cluster/kube/builder/workload.go +++ b/cluster/kube/builder/workload.go @@ -4,15 +4,22 @@ import ( "fmt" "strings" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" "github.com/tendermint/tendermint/libs/log" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - maniv2beta1 "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" + "github.com/akash-network/node/sdl" sdlutil "github.com/akash-network/node/sdl/util" + + crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" +) + +const ( + ResourceNvidiaGPU = corev1.ResourceName("nvidia.com/gpu") ) type workloadBase interface { @@ -22,33 +29,40 @@ type workloadBase interface { type workload struct { builder - service *maniv2beta1.Service - runtimeClassName string + serviceIdx int } var _ workloadBase = (*workload)(nil) -func newWorkloadBuilder(log log.Logger, settings Settings, lid mtypes.LeaseID, group *maniv2beta1.Group, service *maniv2beta1.Service) workload { +func newWorkloadBuilder( + log log.Logger, + settings Settings, + lid mtypes.LeaseID, + group *mani.Group, + sparams crd.ParamsServices, + serviceIdx int) workload { return workload{ builder: builder{ settings: settings, log: log.With("module", "kube-builder"), lid: lid, group: group, + sparams: sparams, }, - service: service, - runtimeClassName: settings.DeploymentRuntimeClass, + serviceIdx: serviceIdx, } } func (b *workload) container() corev1.Container { falseValue := false + service := &b.group.Services[b.serviceIdx] + kcontainer := corev1.Container{ - Name: b.service.Name, - Image: b.service.Image, - Command: b.service.Command, - Args: b.service.Args, + Name: service.Name, + Image: service.Image, + Command: service.Command, + Args: service.Args, Resources: corev1.ResourceRequirements{ Limits: make(corev1.ResourceList), Requests: make(corev1.ResourceList), @@ -61,32 +75,31 @@ func (b *workload) container() corev1.Container { }, } - if cpu := b.service.Resources.CPU; cpu != nil { + if cpu := service.Resources.CPU; cpu != nil { requestedCPU := sdlutil.ComputeCommittedResources(b.settings.CPUCommitLevel, cpu.Units) kcontainer.Resources.Requests[corev1.ResourceCPU] = resource.NewScaledQuantity(int64(requestedCPU.Value()), resource.Milli).DeepCopy() kcontainer.Resources.Limits[corev1.ResourceCPU] = resource.NewScaledQuantity(int64(cpu.Units.Value()), resource.Milli).DeepCopy() } - if gpu := b.service.Resources.GPU; gpu != nil && gpu.Units.Value() > 0 { + if gpu := service.Resources.GPU; gpu != nil && gpu.Units.Value() > 0 { requestedGPU := sdlutil.ComputeCommittedResources(b.settings.GPUCommitLevel, gpu.Units) // GPUs are only supposed to be specified in the limits section, which means // - can specify GPU limits without specifying requests, because Kubernetes will use the limit as the request value by default. // - can specify GPU in both limits and requests but these two values must be equal. // - cannot specify GPU requests without specifying limits. // fixme get custom resource name from inventory - kcontainer.Resources.Requests["nvidia.com/gpu"] = resource.NewQuantity(int64(requestedGPU.Value()), resource.DecimalSI).DeepCopy() - kcontainer.Resources.Limits["nvidia.com/gpu"] = resource.NewQuantity(int64(gpu.Units.Value()), resource.DecimalSI).DeepCopy() - // todo fetch it from settings - b.runtimeClassName = runtimeClassNvidia + resourceName := ResourceNvidiaGPU + kcontainer.Resources.Requests[resourceName] = resource.NewQuantity(int64(requestedGPU.Value()), resource.DecimalSI).DeepCopy() + kcontainer.Resources.Limits[resourceName] = resource.NewQuantity(int64(gpu.Units.Value()), resource.DecimalSI).DeepCopy() } - if mem := b.service.Resources.Memory; mem != nil { + if mem := service.Resources.Memory; mem != nil { requestedMem := sdlutil.ComputeCommittedResources(b.settings.MemoryCommitLevel, mem.Quantity) kcontainer.Resources.Requests[corev1.ResourceMemory] = resource.NewQuantity(int64(requestedMem.Value()), resource.DecimalSI).DeepCopy() kcontainer.Resources.Limits[corev1.ResourceMemory] = resource.NewQuantity(int64(mem.Quantity.Value()), resource.DecimalSI).DeepCopy() } - for _, ephemeral := range b.service.Resources.Storage { + for _, ephemeral := range service.Resources.Storage { attr := ephemeral.Attributes.Find(sdl.StorageAttributePersistent) if persistent, _ := attr.AsBool(); !persistent { requestedStorage := sdlutil.ComputeCommittedResources(b.settings.StorageCommitLevel, ephemeral.Quantity) @@ -97,11 +110,11 @@ func (b *workload) container() corev1.Container { } } - if b.service.Params != nil { - for _, params := range b.service.Params.Storage { + if service.Params != nil { + for _, params := range service.Params.Storage { kcontainer.VolumeMounts = append(kcontainer.VolumeMounts, corev1.VolumeMount{ // matches VolumeName in persistentVolumeClaims below - Name: fmt.Sprintf("%s-%s", b.service.Name, params.Name), + Name: fmt.Sprintf("%s-%s", service.Name, params.Name), ReadOnly: params.ReadOnly, MountPath: params.Mount, }) @@ -109,7 +122,7 @@ func (b *workload) container() corev1.Container { } envVarsAdded := make(map[string]int) - for _, env := range b.service.Env { + for _, env := range service.Env { parts := strings.SplitN(env, "=", 2) switch len(parts) { case 2: @@ -121,7 +134,7 @@ func (b *workload) container() corev1.Container { } kcontainer.Env = b.addEnvVarsForDeployment(envVarsAdded, kcontainer.Env) - for _, expose := range b.service.Expose { + for _, expose := range service.Expose { kcontainer.Ports = append(kcontainer.Ports, corev1.ContainerPort{ ContainerPort: int32(expose.Port), }) @@ -133,7 +146,9 @@ func (b *workload) container() corev1.Container { func (b *workload) persistentVolumeClaims() []corev1.PersistentVolumeClaim { var pvcs []corev1.PersistentVolumeClaim // nolint:prealloc - for _, storage := range b.service.Resources.Storage { + service := &b.group.Services[b.serviceIdx] + + for _, storage := range service.Resources.Storage { attr := storage.Attributes.Find(sdl.StorageAttributePersistent) if persistent, valid := attr.AsBool(); !valid || !persistent { continue @@ -142,7 +157,7 @@ func (b *workload) persistentVolumeClaims() []corev1.PersistentVolumeClaim { volumeMode := corev1.PersistentVolumeFilesystem pvc := corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-%s", b.service.Name, storage.Name), + Name: fmt.Sprintf("%s-%s", service.Name, storage.Name), }, Spec: corev1.PersistentVolumeClaimSpec{ AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce}, @@ -170,12 +185,12 @@ func (b *workload) persistentVolumeClaims() []corev1.PersistentVolumeClaim { } func (b *workload) Name() string { - return b.service.Name + return b.group.Services[b.serviceIdx].Name } func (b *workload) labels() map[string]string { obj := b.builder.labels() - obj[AkashManifestServiceLabelName] = b.service.Name + obj[AkashManifestServiceLabelName] = b.group.Services[b.serviceIdx].Name return obj } diff --git a/cluster/kube/cleanup.go b/cluster/kube/cleanup.go index 7b3985323..b886bc036 100644 --- a/cluster/kube/cleanup.go +++ b/cluster/kube/cleanup.go @@ -3,18 +3,18 @@ package kube import ( "context" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/selection" "k8s.io/client-go/kubernetes" - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" "github.com/akash-network/provider/cluster/kube/builder" ) -func cleanupStaleResources(ctx context.Context, kc kubernetes.Interface, lid mtypes.LeaseID, group *manifest.Group) error { +func cleanupStaleResources(ctx context.Context, kc kubernetes.Interface, lid mtypes.LeaseID, group *mani.Group) error { ns := builder.LidNS(lid) // build label selector for objects not in current manifest group diff --git a/cluster/kube/client.go b/cluster/kube/client.go index 0937d8bb4..1369a6e08 100644 --- a/cluster/kube/client.go +++ b/cluster/kube/client.go @@ -20,7 +20,7 @@ import ( "k8s.io/client-go/util/flowcontrol" metricsclient "k8s.io/metrics/pkg/client/clientset/versioned" - manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" + mapi "github.com/akash-network/akash-api/go/manifest/v2beta2" dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" "github.com/akash-network/node/sdl" @@ -168,7 +168,7 @@ func (c *client) Deployments(ctx context.Context) ([]ctypes.Deployment, error) { return deployments, nil } -func (c *client) Deploy(ctx context.Context, lid mtypes.LeaseID, group *manifest.Group) error { +func (c *client) Deploy(ctx context.Context, lid mtypes.LeaseID, group *mapi.Group) error { settingsI := ctx.Value(builder.SettingsKey) if nil == settingsI { return kubeclienterrors.ErrNotConfiguredWithSettings @@ -193,6 +193,23 @@ func (c *client) Deploy(ctx context.Context, lid mtypes.LeaseID, group *manifest return err } + params := make(crd.ParamsServices, 0, len(group.Services)) + + for _, svc := range group.Services { + sParams := crd.ParamsService{} + + if svc.Resources.GPU.Units.Value() > 0 { + sParams.Params.RuntimeClass = "nvidia" + } + + params = append(params, sParams) + } + + if err := applyServicesParams(ctx, c.ac, builder.BuildParamsLeases(c.log, settings, c.ns, lid, params)); err != nil { + c.log.Error("applying manifest", "err", err, "lease", lid) + return err + } + if err := cleanupStaleResources(ctx, c.kc, lid, group); err != nil { c.log.Error("cleaning stale resources", "err", err, "lease", lid) return err @@ -210,12 +227,12 @@ func (c *client) Deploy(ctx context.Context, lid mtypes.LeaseID, group *manifest } if persistent { - if err := applyStatefulSet(ctx, c.kc, builder.BuildStatefulSet(c.log, settings, lid, group, service)); err != nil { + if err := applyStatefulSet(ctx, c.kc, builder.BuildStatefulSet(c.log, settings, lid, group, params, svcIdx)); err != nil { c.log.Error("applying statefulSet", "err", err, "lease", lid, "service", service.Name) return err } } else { - if err := applyDeployment(ctx, c.kc, builder.NewDeployment(c.log, settings, lid, group, service)); err != nil { + if err := applyDeployment(ctx, c.kc, builder.NewDeployment(c.log, settings, lid, group, params, svcIdx)); err != nil { c.log.Error("applying deployment", "err", err, "lease", lid, "service", service.Name) return err } @@ -226,7 +243,7 @@ func (c *client) Deploy(ctx context.Context, lid mtypes.LeaseID, group *manifest continue } - serviceBuilderLocal := builder.BuildService(c.log, settings, lid, group, service, false) + serviceBuilderLocal := builder.BuildService(c.log, settings, lid, group, svcIdx, false) if serviceBuilderLocal.Any() { if err := applyService(ctx, c.kc, serviceBuilderLocal); err != nil { c.log.Error("applying local service", "err", err, "lease", lid, "service", service.Name) @@ -234,7 +251,7 @@ func (c *client) Deploy(ctx context.Context, lid mtypes.LeaseID, group *manifest } } - serviceBuilderGlobal := builder.BuildService(c.log, settings, lid, group, service, true) + serviceBuilderGlobal := builder.BuildService(c.log, settings, lid, group, svcIdx, true) if serviceBuilderGlobal.Any() { if err := applyService(ctx, c.kc, serviceBuilderGlobal); err != nil { c.log.Error("applying global service", "err", err, "lease", lid, "service", service.Name) @@ -449,9 +466,9 @@ func (c *client) ForwardedPortStatus(ctx context.Context, leaseID mtypes.LeaseID isValid := true switch port.Protocol { case corev1.ProtocolTCP: - v.Proto = manifest.TCP + v.Proto = mapi.TCP case corev1.ProtocolUDP: - v.Proto = manifest.UDP + v.Proto = mapi.UDP default: isValid = false // Skip this, since the Protocol is set to something not supported by Akash } @@ -468,7 +485,7 @@ func (c *client) ForwardedPortStatus(ctx context.Context, leaseID mtypes.LeaseID return forwardedPorts, nil } -// todo: limit number of results and do pagination / streaming +// LeaseStatus todo: limit number of results and do pagination / streaming func (c *client) LeaseStatus(ctx context.Context, lid mtypes.LeaseID) (map[string]*ctypes.ServiceStatus, error) { settingsI := ctx.Value(builder.SettingsKey) if nil == settingsI { @@ -604,11 +621,11 @@ exposeCheckLoop: found = true for _, expose := range service.Expose { - proto, err := manifest.ParseServiceProtocol(expose.Proto) + proto, err := mapi.ParseServiceProtocol(expose.Proto) if err != nil { return nil, err } - mse := manifest.ServiceExpose{ + mse := mapi.ServiceExpose{ Port: uint32(expose.Port), ExternalPort: uint32(expose.ExternalPort), Proto: proto, diff --git a/cluster/kube/client_test.go b/cluster/kube/client_test.go index f754fe6d5..83d60fbce 100644 --- a/cluster/kube/client_test.go +++ b/cluster/kube/client_test.go @@ -612,7 +612,7 @@ func TestServiceStatusWithNoManifest(t *testing.T) { deploymentsMock.On("Get", mock.Anything, serviceName, metav1.GetOptions{}).Return(&deployment, nil) - services := make([]manifest.Service, 2) + services := make(manifest.Services, 2) services[0] = manifest.Service{ Name: "someService", Image: "best/image", @@ -686,7 +686,7 @@ func TestServiceStatusWithoutIngress(t *testing.T) { deploymentsMock.On("Get", mock.Anything, serviceName, metav1.GetOptions{}).Return(&deployment, nil) - services := make([]manifest.Service, 2) + services := make(manifest.Services, 2) services[0] = manifest.Service{ Name: "someService", Image: "best/image", diff --git a/cluster/kube/cluster_ip_connections.go b/cluster/kube/cluster_ip_connections.go index 8a1f6e7d5..7a34eab20 100644 --- a/cluster/kube/cluster_ip_connections.go +++ b/cluster/kube/cluster_ip_connections.go @@ -18,7 +18,6 @@ import ( "github.com/akash-network/provider/cluster/kube/builder" kubeclienterrors "github.com/akash-network/provider/cluster/kube/errors" - "github.com/akash-network/provider/cluster/types/v1beta3" ctypes "github.com/akash-network/provider/cluster/types/v1beta3" akashtypes "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) @@ -134,7 +133,7 @@ func (c *client) PurgeDeclaredIPs(ctx context.Context, lID mtypes.LeaseID) error return result } -func (c *client) ObserveIPState(ctx context.Context) (<-chan v1beta2.IPResourceEvent, error) { +func (c *client) ObserveIPState(ctx context.Context) (<-chan ctypes.IPResourceEvent, error) { var lastResourceVersion string phpager := pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { resources, err := c.ac.AkashV2beta2().ProviderLeasedIPs(c.ns).List(ctx, opts) @@ -184,7 +183,7 @@ func (c *client) ObserveIPState(ctx context.Context) (<-chan v1beta2.IPResourceE return nil, err } - leaseID, err := v.Spec.LeaseID.ToAkash() + leaseID, err := v.Spec.LeaseID.FromCRD() if err != nil { return nil, err } @@ -210,7 +209,7 @@ func (c *client) ObserveIPState(ctx context.Context) (<-chan v1beta2.IPResourceE data = nil - output := make(chan v1beta2.IPResourceEvent) + output := make(chan ctypes.IPResourceEvent) go func() { defer close(output) @@ -237,7 +236,7 @@ func (c *client) ObserveIPState(ctx context.Context) (<-chan v1beta2.IPResourceE c.log.Error("invalid provider address in provider host", "addr", plip.Spec.LeaseID.Provider, "err", err) continue // Ignore event } - leaseID, err := plip.Spec.LeaseID.ToAkash() + leaseID, err := plip.Spec.LeaseID.FromCRD() if err != nil { c.log.Error("invalid lease ID", "err", err) continue // Ignore event diff --git a/cluster/kube/inventory.go b/cluster/kube/inventory.go index 2c830be0f..2907a9316 100644 --- a/cluster/kube/inventory.go +++ b/cluster/kube/inventory.go @@ -26,10 +26,6 @@ const ( inventoryOperatorQueryTimeout = 5 * time.Second ) -const ( - resourceNvidiaGPU = "nvidia.com/gpu" -) - type node struct { id string arch string @@ -378,7 +374,7 @@ func (c *client) fetchActiveNodes(ctx context.Context, cstorage clusterStorage) // Create an entry with the allocatable amount for the node cpu := knode.Status.Allocatable.Cpu().DeepCopy() - gpu := knode.Status.Allocatable.Name(resourceNvidiaGPU, resource.DecimalSI).DeepCopy() + gpu := knode.Status.Allocatable.Name(builder.ResourceNvidiaGPU, resource.DecimalSI).DeepCopy() memory := knode.Status.Allocatable.Memory().DeepCopy() storage := knode.Status.Allocatable.StorageEphemeral().DeepCopy() entry := &node{ @@ -456,7 +452,7 @@ func (nd *node) addAllocatedResources(rl corev1.ResourceList) { nd.memory.allocated.Add(quantity) case corev1.ResourceEphemeralStorage: nd.ephemeralStorage.allocated.Add(quantity) - case resourceNvidiaGPU: + case builder.ResourceNvidiaGPU: nd.gpu.allocated.Add(quantity) } } diff --git a/cluster/kube/k8s_integration_test.go b/cluster/kube/k8s_integration_test.go index 41e64f84d..85d31eb92 100644 --- a/cluster/kube/k8s_integration_test.go +++ b/cluster/kube/k8s_integration_test.go @@ -47,6 +47,7 @@ func TestNewClient(t *testing.T) { // create lease lid := atestutil.LeaseID(t) group := mtestutil.AppManifestGenerator.Group(t) + ns := builder.LidNS(lid) settings := builder.Settings{ diff --git a/cluster/kube/metallb/client.go b/cluster/kube/metallb/client.go index af962d3ed..aec1ca9b6 100644 --- a/cluster/kube/metallb/client.go +++ b/cluster/kube/metallb/client.go @@ -54,11 +54,11 @@ var ( //go:generate mockery --name Client --structname MetalLBClient --filename metallb_client.go --output ../../mocks type Client interface { GetIPAddressUsage(ctx context.Context) (uint, uint, error) - GetIPAddressStatusForLease(ctx context.Context, leaseID mtypes.LeaseID) ([]v1beta2.IPLeaseState, error) + GetIPAddressStatusForLease(ctx context.Context, leaseID mtypes.LeaseID) ([]v1beta3.IPLeaseState, error) CreateIPPassthrough(ctx context.Context, directive ctypes.ClusterIPPassthroughDirective) error PurgeIPPassthrough(ctx context.Context, directive ctypes.ClusterIPPassthroughDirective) error - GetIPPassthroughs(ctx context.Context) ([]v1beta2.IPPassthrough, error) + GetIPPassthroughs(ctx context.Context) ([]v1beta3.IPPassthrough, error) DetectPoolChanges(ctx context.Context) (<-chan struct{}, error) Stop() @@ -262,7 +262,7 @@ func (ipls ipLeaseState) GetProtocol() manifest.ServiceProtocol { return ipls.protocol } -func (c *client) GetIPAddressStatusForLease(ctx context.Context, leaseID mtypes.LeaseID) ([]v1beta2.IPLeaseState, error) { +func (c *client) GetIPAddressStatusForLease(ctx context.Context, leaseID mtypes.LeaseID) ([]v1beta3.IPLeaseState, error) { ns := builder.LidNS(leaseID) servicePager := pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { return c.kube.CoreV1().Services(ns).List(ctx, opts) @@ -279,7 +279,7 @@ func (c *client) GetIPAddressStatusForLease(ctx context.Context, leaseID mtypes. return nil, err } - result := make([]v1beta2.IPLeaseState, 0) + result := make([]v1beta3.IPLeaseState, 0) err = servicePager.EachListItem(ctx, metav1.ListOptions{ LabelSelector: labelSelector.String(), }, @@ -430,7 +430,7 @@ func (c *client) CreateIPPassthrough(ctx context.Context, directive ctypes.Clust return nil } -func (c *client) GetIPPassthroughs(ctx context.Context) ([]v1beta2.IPPassthrough, error) { +func (c *client) GetIPPassthroughs(ctx context.Context) ([]v1beta3.IPPassthrough, error) { servicePager := pager.New(func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { return c.kube.CoreV1().Services(metav1.NamespaceAll).List(ctx, opts) }) @@ -446,7 +446,7 @@ func (c *client) GetIPPassthroughs(ctx context.Context) ([]v1beta2.IPPassthrough return nil, err } - result := make([]v1beta2.IPPassthrough, 0) + result := make([]v1beta3.IPPassthrough, 0) err = servicePager.EachListItem(ctx, metav1.ListOptions{ LabelSelector: labelSelector.String(), diff --git a/cluster/manager.go b/cluster/manager.go index 88780e3b0..9f297d34c 100644 --- a/cluster/manager.go +++ b/cluster/manager.go @@ -14,17 +14,17 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - maniv2beta2 "github.com/akash-network/akash-api/go/manifest/v2beta2" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" "github.com/akash-network/node/pubsub" sdlutil "github.com/akash-network/node/sdl/util" kubeclienterrors "github.com/akash-network/provider/cluster/kube/errors" - clustertypes "github.com/akash-network/provider/cluster/types/v1beta3" + ctypes "github.com/akash-network/provider/cluster/types/v1beta3" "github.com/akash-network/provider/cluster/util" clusterutil "github.com/akash-network/provider/cluster/util" "github.com/akash-network/provider/event" - manifest "github.com/akash-network/provider/manifest" + "github.com/akash-network/provider/manifest" "github.com/akash-network/provider/session" ) @@ -61,25 +61,25 @@ type deploymentManager struct { state deploymentState lease mtypes.LeaseID - mgroup *maniv2beta2.Group + mgroup *mani.Group monitor *deploymentMonitor wg sync.WaitGroup - updatech chan *maniv2beta2.Group + updatech chan *mani.Group teardownch chan struct{} currentHostnames map[string]struct{} log log.Logger lc lifecycle.Lifecycle - hostnameService clustertypes.HostnameServiceClient + hostnameService ctypes.HostnameServiceClient config Config serviceShuttingDown <-chan struct{} } -func newDeploymentManager(s *service, lease mtypes.LeaseID, mgroup *maniv2beta2.Group, isNewLease bool) *deploymentManager { - logger := s.log.With("cmp", "deployment-manager", "lease", lease, "manifest-group", mgroup.Name) +func newDeploymentManager(s *service, lease mtypes.LeaseID, mgroup *mani.Group, isNewLease bool) *deploymentManager { + logger := s.log.With("cmp", "deployment-manager", "lease", lease, "manifest-group", mgroup.GetName()) dm := &deploymentManager{ bus: s.bus, @@ -89,7 +89,7 @@ func newDeploymentManager(s *service, lease mtypes.LeaseID, mgroup *maniv2beta2. lease: lease, mgroup: mgroup, wg: sync.WaitGroup{}, - updatech: make(chan *maniv2beta2.Group), + updatech: make(chan *mani.Group), teardownch: make(chan struct{}), log: logger, lc: lifecycle.New(), @@ -116,7 +116,7 @@ func newDeploymentManager(s *service, lease mtypes.LeaseID, mgroup *maniv2beta2. return dm } -func (dm *deploymentManager) update(mgroup *maniv2beta2.Group) error { +func (dm *deploymentManager) update(mgroup *mani.Group) error { select { case dm.updatech <- mgroup: return nil @@ -319,7 +319,7 @@ func (dm *deploymentManager) startTeardown() <-chan error { } type serviceExposeWithServiceName struct { - expose maniv2beta2.ServiceExpose + expose mani.ServiceExpose name string } @@ -394,7 +394,7 @@ func (dm *deploymentManager) doDeploy(ctx context.Context) ([]string, []string, for _, hostname := range withheldHostnames { blockedHostnames[hostname] = struct{}{} } - hosts := make(map[string]maniv2beta2.ServiceExpose) + hosts := make(map[string]mani.ServiceExpose) leasedIPs := make([]serviceExposeWithServiceName, 0) hostToServiceName := make(map[string]string) @@ -435,7 +435,7 @@ func (dm *deploymentManager) doDeploy(ctx context.Context) ([]string, []string, // Check if the IP exists in the compute cluster but not in the presently used set of IPs _, stillInUse := ipsInThisRequest[currentIP.SharingKey] if !stillInUse { - proto, err := maniv2beta2.ParseServiceProtocol(currentIP.Protocol) + proto, err := mani.ParseServiceProtocol(currentIP.Protocol) if err != nil { return withheldHostnames, nil, err } diff --git a/cluster/mocks/client.go b/cluster/mocks/client.go index d2babeedf..784da12cf 100644 --- a/cluster/mocks/client.go +++ b/cluster/mocks/client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks @@ -9,13 +9,13 @@ import ( io "io" + marketv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" + mock "github.com/stretchr/testify/mock" remotecommand "k8s.io/client-go/tools/remotecommand" - v1beta2 "github.com/akash-network/provider/cluster/types/v1beta3" - - v1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" + v1beta3 "github.com/akash-network/provider/cluster/types/v1beta3" v2beta2 "github.com/akash-network/akash-api/go/manifest/v2beta2" @@ -36,19 +36,19 @@ func (_m *Client) EXPECT() *Client_Expecter { } // AllHostnames provides a mock function with given fields: _a0 -func (_m *Client) AllHostnames(_a0 context.Context) ([]v1beta2.ActiveHostname, error) { +func (_m *Client) AllHostnames(_a0 context.Context) ([]v1beta3.ActiveHostname, error) { ret := _m.Called(_a0) - var r0 []v1beta2.ActiveHostname + var r0 []v1beta3.ActiveHostname var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta2.ActiveHostname, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta3.ActiveHostname, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func(context.Context) []v1beta2.ActiveHostname); ok { + if rf, ok := ret.Get(0).(func(context.Context) []v1beta3.ActiveHostname); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta2.ActiveHostname) + r0 = ret.Get(0).([]v1beta3.ActiveHostname) } } @@ -79,22 +79,22 @@ func (_c *Client_AllHostnames_Call) Run(run func(_a0 context.Context)) *Client_A return _c } -func (_c *Client_AllHostnames_Call) Return(_a0 []v1beta2.ActiveHostname, _a1 error) *Client_AllHostnames_Call { +func (_c *Client_AllHostnames_Call) Return(_a0 []v1beta3.ActiveHostname, _a1 error) *Client_AllHostnames_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_AllHostnames_Call) RunAndReturn(run func(context.Context) ([]v1beta2.ActiveHostname, error)) *Client_AllHostnames_Call { +func (_c *Client_AllHostnames_Call) RunAndReturn(run func(context.Context) ([]v1beta3.ActiveHostname, error)) *Client_AllHostnames_Call { _c.Call.Return(run) return _c } // ConnectHostnameToDeployment provides a mock function with given fields: ctx, directive -func (_m *Client) ConnectHostnameToDeployment(ctx context.Context, directive v1beta2.ConnectHostnameToDeploymentDirective) error { +func (_m *Client) ConnectHostnameToDeployment(ctx context.Context, directive v1beta3.ConnectHostnameToDeploymentDirective) error { ret := _m.Called(ctx, directive) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta2.ConnectHostnameToDeploymentDirective) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, v1beta3.ConnectHostnameToDeploymentDirective) error); ok { r0 = rf(ctx, directive) } else { r0 = ret.Error(0) @@ -110,14 +110,14 @@ type Client_ConnectHostnameToDeployment_Call struct { // ConnectHostnameToDeployment is a helper method to define mock.On call // - ctx context.Context -// - directive v1beta2.ConnectHostnameToDeploymentDirective +// - directive v1beta3.ConnectHostnameToDeploymentDirective func (_e *Client_Expecter) ConnectHostnameToDeployment(ctx interface{}, directive interface{}) *Client_ConnectHostnameToDeployment_Call { return &Client_ConnectHostnameToDeployment_Call{Call: _e.mock.On("ConnectHostnameToDeployment", ctx, directive)} } -func (_c *Client_ConnectHostnameToDeployment_Call) Run(run func(ctx context.Context, directive v1beta2.ConnectHostnameToDeploymentDirective)) *Client_ConnectHostnameToDeployment_Call { +func (_c *Client_ConnectHostnameToDeployment_Call) Run(run func(ctx context.Context, directive v1beta3.ConnectHostnameToDeploymentDirective)) *Client_ConnectHostnameToDeployment_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta2.ConnectHostnameToDeploymentDirective)) + run(args[0].(context.Context), args[1].(v1beta3.ConnectHostnameToDeploymentDirective)) }) return _c } @@ -127,17 +127,17 @@ func (_c *Client_ConnectHostnameToDeployment_Call) Return(_a0 error) *Client_Con return _c } -func (_c *Client_ConnectHostnameToDeployment_Call) RunAndReturn(run func(context.Context, v1beta2.ConnectHostnameToDeploymentDirective) error) *Client_ConnectHostnameToDeployment_Call { +func (_c *Client_ConnectHostnameToDeployment_Call) RunAndReturn(run func(context.Context, v1beta3.ConnectHostnameToDeploymentDirective) error) *Client_ConnectHostnameToDeployment_Call { _c.Call.Return(run) return _c } // DeclareHostname provides a mock function with given fields: ctx, lID, host, serviceName, externalPort -func (_m *Client) DeclareHostname(ctx context.Context, lID v1beta3.LeaseID, host string, serviceName string, externalPort uint32) error { +func (_m *Client) DeclareHostname(ctx context.Context, lID marketv1beta3.LeaseID, host string, serviceName string, externalPort uint32) error { ret := _m.Called(ctx, lID, host, serviceName, externalPort) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, string, uint32) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, string, uint32) error); ok { r0 = rf(ctx, lID, host, serviceName, externalPort) } else { r0 = ret.Error(0) @@ -153,7 +153,7 @@ type Client_DeclareHostname_Call struct { // DeclareHostname is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID // - host string // - serviceName string // - externalPort uint32 @@ -161,9 +161,9 @@ func (_e *Client_Expecter) DeclareHostname(ctx interface{}, lID interface{}, hos return &Client_DeclareHostname_Call{Call: _e.mock.On("DeclareHostname", ctx, lID, host, serviceName, externalPort)} } -func (_c *Client_DeclareHostname_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID, host string, serviceName string, externalPort uint32)) *Client_DeclareHostname_Call { +func (_c *Client_DeclareHostname_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID, host string, serviceName string, externalPort uint32)) *Client_DeclareHostname_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(string), args[4].(uint32)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(string), args[4].(uint32)) }) return _c } @@ -173,17 +173,17 @@ func (_c *Client_DeclareHostname_Call) Return(_a0 error) *Client_DeclareHostname return _c } -func (_c *Client_DeclareHostname_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, string, uint32) error) *Client_DeclareHostname_Call { +func (_c *Client_DeclareHostname_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, string, uint32) error) *Client_DeclareHostname_Call { _c.Call.Return(run) return _c } // DeclareIP provides a mock function with given fields: ctx, lID, serviceName, port, externalPort, proto, sharingKey, overwrite -func (_m *Client) DeclareIP(ctx context.Context, lID v1beta3.LeaseID, serviceName string, port uint32, externalPort uint32, proto v2beta2.ServiceProtocol, sharingKey string, overwrite bool) error { +func (_m *Client) DeclareIP(ctx context.Context, lID marketv1beta3.LeaseID, serviceName string, port uint32, externalPort uint32, proto v2beta2.ServiceProtocol, sharingKey string, overwrite bool) error { ret := _m.Called(ctx, lID, serviceName, port, externalPort, proto, sharingKey, overwrite) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, uint32, uint32, v2beta2.ServiceProtocol, string, bool) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, uint32, uint32, v2beta2.ServiceProtocol, string, bool) error); ok { r0 = rf(ctx, lID, serviceName, port, externalPort, proto, sharingKey, overwrite) } else { r0 = ret.Error(0) @@ -199,7 +199,7 @@ type Client_DeclareIP_Call struct { // DeclareIP is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID // - serviceName string // - port uint32 // - externalPort uint32 @@ -210,9 +210,9 @@ func (_e *Client_Expecter) DeclareIP(ctx interface{}, lID interface{}, serviceNa return &Client_DeclareIP_Call{Call: _e.mock.On("DeclareIP", ctx, lID, serviceName, port, externalPort, proto, sharingKey, overwrite)} } -func (_c *Client_DeclareIP_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID, serviceName string, port uint32, externalPort uint32, proto v2beta2.ServiceProtocol, sharingKey string, overwrite bool)) *Client_DeclareIP_Call { +func (_c *Client_DeclareIP_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID, serviceName string, port uint32, externalPort uint32, proto v2beta2.ServiceProtocol, sharingKey string, overwrite bool)) *Client_DeclareIP_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(uint32), args[4].(uint32), args[5].(v2beta2.ServiceProtocol), args[6].(string), args[7].(bool)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(uint32), args[4].(uint32), args[5].(v2beta2.ServiceProtocol), args[6].(string), args[7].(bool)) }) return _c } @@ -222,17 +222,17 @@ func (_c *Client_DeclareIP_Call) Return(_a0 error) *Client_DeclareIP_Call { return _c } -func (_c *Client_DeclareIP_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, uint32, uint32, v2beta2.ServiceProtocol, string, bool) error) *Client_DeclareIP_Call { +func (_c *Client_DeclareIP_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, uint32, uint32, v2beta2.ServiceProtocol, string, bool) error) *Client_DeclareIP_Call { _c.Call.Return(run) return _c } // Deploy provides a mock function with given fields: ctx, lID, mgroup -func (_m *Client) Deploy(ctx context.Context, lID v1beta3.LeaseID, mgroup *v2beta2.Group) error { +func (_m *Client) Deploy(ctx context.Context, lID marketv1beta3.LeaseID, mgroup *v2beta2.Group) error { ret := _m.Called(ctx, lID, mgroup) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, *v2beta2.Group) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, *v2beta2.Group) error); ok { r0 = rf(ctx, lID, mgroup) } else { r0 = ret.Error(0) @@ -248,15 +248,15 @@ type Client_Deploy_Call struct { // Deploy is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID // - mgroup *v2beta2.Group func (_e *Client_Expecter) Deploy(ctx interface{}, lID interface{}, mgroup interface{}) *Client_Deploy_Call { return &Client_Deploy_Call{Call: _e.mock.On("Deploy", ctx, lID, mgroup)} } -func (_c *Client_Deploy_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID, mgroup *v2beta2.Group)) *Client_Deploy_Call { +func (_c *Client_Deploy_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID, mgroup *v2beta2.Group)) *Client_Deploy_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(*v2beta2.Group)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(*v2beta2.Group)) }) return _c } @@ -266,25 +266,25 @@ func (_c *Client_Deploy_Call) Return(_a0 error) *Client_Deploy_Call { return _c } -func (_c *Client_Deploy_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, *v2beta2.Group) error) *Client_Deploy_Call { +func (_c *Client_Deploy_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, *v2beta2.Group) error) *Client_Deploy_Call { _c.Call.Return(run) return _c } // Deployments provides a mock function with given fields: _a0 -func (_m *Client) Deployments(_a0 context.Context) ([]v1beta2.Deployment, error) { +func (_m *Client) Deployments(_a0 context.Context) ([]v1beta3.Deployment, error) { ret := _m.Called(_a0) - var r0 []v1beta2.Deployment + var r0 []v1beta3.Deployment var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta2.Deployment, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta3.Deployment, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func(context.Context) []v1beta2.Deployment); ok { + if rf, ok := ret.Get(0).(func(context.Context) []v1beta3.Deployment); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta2.Deployment) + r0 = ret.Get(0).([]v1beta3.Deployment) } } @@ -315,34 +315,34 @@ func (_c *Client_Deployments_Call) Run(run func(_a0 context.Context)) *Client_De return _c } -func (_c *Client_Deployments_Call) Return(_a0 []v1beta2.Deployment, _a1 error) *Client_Deployments_Call { +func (_c *Client_Deployments_Call) Return(_a0 []v1beta3.Deployment, _a1 error) *Client_Deployments_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_Deployments_Call) RunAndReturn(run func(context.Context) ([]v1beta2.Deployment, error)) *Client_Deployments_Call { +func (_c *Client_Deployments_Call) RunAndReturn(run func(context.Context) ([]v1beta3.Deployment, error)) *Client_Deployments_Call { _c.Call.Return(run) return _c } // Exec provides a mock function with given fields: ctx, lID, service, podIndex, cmd, stdin, stdout, stderr, tty, tsq -func (_m *Client) Exec(ctx context.Context, lID v1beta3.LeaseID, service string, podIndex uint, cmd []string, stdin io.Reader, stdout io.Writer, stderr io.Writer, tty bool, tsq remotecommand.TerminalSizeQueue) (v1beta2.ExecResult, error) { +func (_m *Client) Exec(ctx context.Context, lID marketv1beta3.LeaseID, service string, podIndex uint, cmd []string, stdin io.Reader, stdout io.Writer, stderr io.Writer, tty bool, tsq remotecommand.TerminalSizeQueue) (v1beta3.ExecResult, error) { ret := _m.Called(ctx, lID, service, podIndex, cmd, stdin, stdout, stderr, tty, tsq) - var r0 v1beta2.ExecResult + var r0 v1beta3.ExecResult var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) (v1beta2.ExecResult, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) (v1beta3.ExecResult, error)); ok { return rf(ctx, lID, service, podIndex, cmd, stdin, stdout, stderr, tty, tsq) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) v1beta2.ExecResult); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) v1beta3.ExecResult); ok { r0 = rf(ctx, lID, service, podIndex, cmd, stdin, stdout, stderr, tty, tsq) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.ExecResult) + r0 = ret.Get(0).(v1beta3.ExecResult) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) error); ok { r1 = rf(ctx, lID, service, podIndex, cmd, stdin, stdout, stderr, tty, tsq) } else { r1 = ret.Error(1) @@ -358,7 +358,7 @@ type Client_Exec_Call struct { // Exec is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID // - service string // - podIndex uint // - cmd []string @@ -371,41 +371,41 @@ func (_e *Client_Expecter) Exec(ctx interface{}, lID interface{}, service interf return &Client_Exec_Call{Call: _e.mock.On("Exec", ctx, lID, service, podIndex, cmd, stdin, stdout, stderr, tty, tsq)} } -func (_c *Client_Exec_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID, service string, podIndex uint, cmd []string, stdin io.Reader, stdout io.Writer, stderr io.Writer, tty bool, tsq remotecommand.TerminalSizeQueue)) *Client_Exec_Call { +func (_c *Client_Exec_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID, service string, podIndex uint, cmd []string, stdin io.Reader, stdout io.Writer, stderr io.Writer, tty bool, tsq remotecommand.TerminalSizeQueue)) *Client_Exec_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(uint), args[4].([]string), args[5].(io.Reader), args[6].(io.Writer), args[7].(io.Writer), args[8].(bool), args[9].(remotecommand.TerminalSizeQueue)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(uint), args[4].([]string), args[5].(io.Reader), args[6].(io.Writer), args[7].(io.Writer), args[8].(bool), args[9].(remotecommand.TerminalSizeQueue)) }) return _c } -func (_c *Client_Exec_Call) Return(_a0 v1beta2.ExecResult, _a1 error) *Client_Exec_Call { +func (_c *Client_Exec_Call) Return(_a0 v1beta3.ExecResult, _a1 error) *Client_Exec_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_Exec_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) (v1beta2.ExecResult, error)) *Client_Exec_Call { +func (_c *Client_Exec_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, uint, []string, io.Reader, io.Writer, io.Writer, bool, remotecommand.TerminalSizeQueue) (v1beta3.ExecResult, error)) *Client_Exec_Call { _c.Call.Return(run) return _c } // ForwardedPortStatus provides a mock function with given fields: _a0, _a1 -func (_m *Client) ForwardedPortStatus(_a0 context.Context, _a1 v1beta3.LeaseID) (map[string][]v1beta2.ForwardedPortStatus, error) { +func (_m *Client) ForwardedPortStatus(_a0 context.Context, _a1 marketv1beta3.LeaseID) (map[string][]v1beta3.ForwardedPortStatus, error) { ret := _m.Called(_a0, _a1) - var r0 map[string][]v1beta2.ForwardedPortStatus + var r0 map[string][]v1beta3.ForwardedPortStatus var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) (map[string][]v1beta2.ForwardedPortStatus, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) (map[string][]v1beta3.ForwardedPortStatus, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) map[string][]v1beta2.ForwardedPortStatus); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) map[string][]v1beta3.ForwardedPortStatus); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string][]v1beta2.ForwardedPortStatus) + r0 = ret.Get(0).(map[string][]v1beta3.ForwardedPortStatus) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -421,38 +421,38 @@ type Client_ForwardedPortStatus_Call struct { // ForwardedPortStatus is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID func (_e *Client_Expecter) ForwardedPortStatus(_a0 interface{}, _a1 interface{}) *Client_ForwardedPortStatus_Call { return &Client_ForwardedPortStatus_Call{Call: _e.mock.On("ForwardedPortStatus", _a0, _a1)} } -func (_c *Client_ForwardedPortStatus_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID)) *Client_ForwardedPortStatus_Call { +func (_c *Client_ForwardedPortStatus_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID)) *Client_ForwardedPortStatus_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } -func (_c *Client_ForwardedPortStatus_Call) Return(_a0 map[string][]v1beta2.ForwardedPortStatus, _a1 error) *Client_ForwardedPortStatus_Call { +func (_c *Client_ForwardedPortStatus_Call) Return(_a0 map[string][]v1beta3.ForwardedPortStatus, _a1 error) *Client_ForwardedPortStatus_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_ForwardedPortStatus_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) (map[string][]v1beta2.ForwardedPortStatus, error)) *Client_ForwardedPortStatus_Call { +func (_c *Client_ForwardedPortStatus_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) (map[string][]v1beta3.ForwardedPortStatus, error)) *Client_ForwardedPortStatus_Call { _c.Call.Return(run) return _c } // GetDeclaredIPs provides a mock function with given fields: ctx, leaseID -func (_m *Client) GetDeclaredIPs(ctx context.Context, leaseID v1beta3.LeaseID) ([]akash_networkv2beta2.ProviderLeasedIPSpec, error) { +func (_m *Client) GetDeclaredIPs(ctx context.Context, leaseID marketv1beta3.LeaseID) ([]akash_networkv2beta2.ProviderLeasedIPSpec, error) { ret := _m.Called(ctx, leaseID) var r0 []akash_networkv2beta2.ProviderLeasedIPSpec var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) ([]akash_networkv2beta2.ProviderLeasedIPSpec, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) ([]akash_networkv2beta2.ProviderLeasedIPSpec, error)); ok { return rf(ctx, leaseID) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) []akash_networkv2beta2.ProviderLeasedIPSpec); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) []akash_networkv2beta2.ProviderLeasedIPSpec); ok { r0 = rf(ctx, leaseID) } else { if ret.Get(0) != nil { @@ -460,7 +460,7 @@ func (_m *Client) GetDeclaredIPs(ctx context.Context, leaseID v1beta3.LeaseID) ( } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) error); ok { r1 = rf(ctx, leaseID) } else { r1 = ret.Error(1) @@ -476,14 +476,14 @@ type Client_GetDeclaredIPs_Call struct { // GetDeclaredIPs is a helper method to define mock.On call // - ctx context.Context -// - leaseID v1beta3.LeaseID +// - leaseID marketv1beta3.LeaseID func (_e *Client_Expecter) GetDeclaredIPs(ctx interface{}, leaseID interface{}) *Client_GetDeclaredIPs_Call { return &Client_GetDeclaredIPs_Call{Call: _e.mock.On("GetDeclaredIPs", ctx, leaseID)} } -func (_c *Client_GetDeclaredIPs_Call) Run(run func(ctx context.Context, leaseID v1beta3.LeaseID)) *Client_GetDeclaredIPs_Call { +func (_c *Client_GetDeclaredIPs_Call) Run(run func(ctx context.Context, leaseID marketv1beta3.LeaseID)) *Client_GetDeclaredIPs_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } @@ -493,25 +493,25 @@ func (_c *Client_GetDeclaredIPs_Call) Return(_a0 []akash_networkv2beta2.Provider return _c } -func (_c *Client_GetDeclaredIPs_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) ([]akash_networkv2beta2.ProviderLeasedIPSpec, error)) *Client_GetDeclaredIPs_Call { +func (_c *Client_GetDeclaredIPs_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) ([]akash_networkv2beta2.ProviderLeasedIPSpec, error)) *Client_GetDeclaredIPs_Call { _c.Call.Return(run) return _c } // GetHostnameDeploymentConnections provides a mock function with given fields: ctx -func (_m *Client) GetHostnameDeploymentConnections(ctx context.Context) ([]v1beta2.LeaseIDHostnameConnection, error) { +func (_m *Client) GetHostnameDeploymentConnections(ctx context.Context) ([]v1beta3.LeaseIDHostnameConnection, error) { ret := _m.Called(ctx) - var r0 []v1beta2.LeaseIDHostnameConnection + var r0 []v1beta3.LeaseIDHostnameConnection var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta2.LeaseIDHostnameConnection, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta3.LeaseIDHostnameConnection, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) []v1beta2.LeaseIDHostnameConnection); ok { + if rf, ok := ret.Get(0).(func(context.Context) []v1beta3.LeaseIDHostnameConnection); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta2.LeaseIDHostnameConnection) + r0 = ret.Get(0).([]v1beta3.LeaseIDHostnameConnection) } } @@ -542,39 +542,39 @@ func (_c *Client_GetHostnameDeploymentConnections_Call) Run(run func(ctx context return _c } -func (_c *Client_GetHostnameDeploymentConnections_Call) Return(_a0 []v1beta2.LeaseIDHostnameConnection, _a1 error) *Client_GetHostnameDeploymentConnections_Call { +func (_c *Client_GetHostnameDeploymentConnections_Call) Return(_a0 []v1beta3.LeaseIDHostnameConnection, _a1 error) *Client_GetHostnameDeploymentConnections_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_GetHostnameDeploymentConnections_Call) RunAndReturn(run func(context.Context) ([]v1beta2.LeaseIDHostnameConnection, error)) *Client_GetHostnameDeploymentConnections_Call { +func (_c *Client_GetHostnameDeploymentConnections_Call) RunAndReturn(run func(context.Context) ([]v1beta3.LeaseIDHostnameConnection, error)) *Client_GetHostnameDeploymentConnections_Call { _c.Call.Return(run) return _c } // GetManifestGroup provides a mock function with given fields: _a0, _a1 -func (_m *Client) GetManifestGroup(_a0 context.Context, _a1 v1beta3.LeaseID) (bool, akash_networkv2beta2.ManifestGroup, error) { +func (_m *Client) GetManifestGroup(_a0 context.Context, _a1 marketv1beta3.LeaseID) (bool, akash_networkv2beta2.ManifestGroup, error) { ret := _m.Called(_a0, _a1) var r0 bool var r1 akash_networkv2beta2.ManifestGroup var r2 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) (bool, akash_networkv2beta2.ManifestGroup, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) (bool, akash_networkv2beta2.ManifestGroup, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) bool); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) bool); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) akash_networkv2beta2.ManifestGroup); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) akash_networkv2beta2.ManifestGroup); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Get(1).(akash_networkv2beta2.ManifestGroup) } - if rf, ok := ret.Get(2).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(2).(func(context.Context, marketv1beta3.LeaseID) error); ok { r2 = rf(_a0, _a1) } else { r2 = ret.Error(2) @@ -590,14 +590,14 @@ type Client_GetManifestGroup_Call struct { // GetManifestGroup is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID func (_e *Client_Expecter) GetManifestGroup(_a0 interface{}, _a1 interface{}) *Client_GetManifestGroup_Call { return &Client_GetManifestGroup_Call{Call: _e.mock.On("GetManifestGroup", _a0, _a1)} } -func (_c *Client_GetManifestGroup_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID)) *Client_GetManifestGroup_Call { +func (_c *Client_GetManifestGroup_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID)) *Client_GetManifestGroup_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } @@ -607,25 +607,25 @@ func (_c *Client_GetManifestGroup_Call) Return(_a0 bool, _a1 akash_networkv2beta return _c } -func (_c *Client_GetManifestGroup_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) (bool, akash_networkv2beta2.ManifestGroup, error)) *Client_GetManifestGroup_Call { +func (_c *Client_GetManifestGroup_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) (bool, akash_networkv2beta2.ManifestGroup, error)) *Client_GetManifestGroup_Call { _c.Call.Return(run) return _c } // Inventory provides a mock function with given fields: _a0 -func (_m *Client) Inventory(_a0 context.Context) (v1beta2.Inventory, error) { +func (_m *Client) Inventory(_a0 context.Context) (v1beta3.Inventory, error) { ret := _m.Called(_a0) - var r0 v1beta2.Inventory + var r0 v1beta3.Inventory var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (v1beta2.Inventory, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (v1beta3.Inventory, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func(context.Context) v1beta2.Inventory); ok { + if rf, ok := ret.Get(0).(func(context.Context) v1beta3.Inventory); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.Inventory) + r0 = ret.Get(0).(v1beta3.Inventory) } } @@ -656,12 +656,12 @@ func (_c *Client_Inventory_Call) Run(run func(_a0 context.Context)) *Client_Inve return _c } -func (_c *Client_Inventory_Call) Return(_a0 v1beta2.Inventory, _a1 error) *Client_Inventory_Call { +func (_c *Client_Inventory_Call) Return(_a0 v1beta3.Inventory, _a1 error) *Client_Inventory_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_Inventory_Call) RunAndReturn(run func(context.Context) (v1beta2.Inventory, error)) *Client_Inventory_Call { +func (_c *Client_Inventory_Call) RunAndReturn(run func(context.Context) (v1beta3.Inventory, error)) *Client_Inventory_Call { _c.Call.Return(run) return _c } @@ -720,23 +720,23 @@ func (_c *Client_KubeVersion_Call) RunAndReturn(run func() (*version.Info, error } // LeaseEvents provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *Client) LeaseEvents(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool) (v1beta2.EventsWatcher, error) { +func (_m *Client) LeaseEvents(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool) (v1beta3.EventsWatcher, error) { ret := _m.Called(_a0, _a1, _a2, _a3) - var r0 v1beta2.EventsWatcher + var r0 v1beta3.EventsWatcher var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool) (v1beta2.EventsWatcher, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool) (v1beta3.EventsWatcher, error)); ok { return rf(_a0, _a1, _a2, _a3) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool) v1beta2.EventsWatcher); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool) v1beta3.EventsWatcher); ok { r0 = rf(_a0, _a1, _a2, _a3) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.EventsWatcher) + r0 = ret.Get(0).(v1beta3.EventsWatcher) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID, string, bool) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID, string, bool) error); ok { r1 = rf(_a0, _a1, _a2, _a3) } else { r1 = ret.Error(1) @@ -752,48 +752,48 @@ type Client_LeaseEvents_Call struct { // LeaseEvents is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID // - _a2 string // - _a3 bool func (_e *Client_Expecter) LeaseEvents(_a0 interface{}, _a1 interface{}, _a2 interface{}, _a3 interface{}) *Client_LeaseEvents_Call { return &Client_LeaseEvents_Call{Call: _e.mock.On("LeaseEvents", _a0, _a1, _a2, _a3)} } -func (_c *Client_LeaseEvents_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool)) *Client_LeaseEvents_Call { +func (_c *Client_LeaseEvents_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool)) *Client_LeaseEvents_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(bool)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(bool)) }) return _c } -func (_c *Client_LeaseEvents_Call) Return(_a0 v1beta2.EventsWatcher, _a1 error) *Client_LeaseEvents_Call { +func (_c *Client_LeaseEvents_Call) Return(_a0 v1beta3.EventsWatcher, _a1 error) *Client_LeaseEvents_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_LeaseEvents_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, bool) (v1beta2.EventsWatcher, error)) *Client_LeaseEvents_Call { +func (_c *Client_LeaseEvents_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, bool) (v1beta3.EventsWatcher, error)) *Client_LeaseEvents_Call { _c.Call.Return(run) return _c } // LeaseLogs provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *Client) LeaseLogs(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64) ([]*v1beta2.ServiceLog, error) { +func (_m *Client) LeaseLogs(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64) ([]*v1beta3.ServiceLog, error) { ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - var r0 []*v1beta2.ServiceLog + var r0 []*v1beta3.ServiceLog var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool, *int64) ([]*v1beta2.ServiceLog, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) ([]*v1beta3.ServiceLog, error)); ok { return rf(_a0, _a1, _a2, _a3, _a4) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool, *int64) []*v1beta2.ServiceLog); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) []*v1beta3.ServiceLog); ok { r0 = rf(_a0, _a1, _a2, _a3, _a4) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]*v1beta2.ServiceLog) + r0 = ret.Get(0).([]*v1beta3.ServiceLog) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID, string, bool, *int64) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) error); ok { r1 = rf(_a0, _a1, _a2, _a3, _a4) } else { r1 = ret.Error(1) @@ -809,7 +809,7 @@ type Client_LeaseLogs_Call struct { // LeaseLogs is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID // - _a2 string // - _a3 bool // - _a4 *int64 @@ -817,41 +817,41 @@ func (_e *Client_Expecter) LeaseLogs(_a0 interface{}, _a1 interface{}, _a2 inter return &Client_LeaseLogs_Call{Call: _e.mock.On("LeaseLogs", _a0, _a1, _a2, _a3, _a4)} } -func (_c *Client_LeaseLogs_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64)) *Client_LeaseLogs_Call { +func (_c *Client_LeaseLogs_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64)) *Client_LeaseLogs_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(bool), args[4].(*int64)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(bool), args[4].(*int64)) }) return _c } -func (_c *Client_LeaseLogs_Call) Return(_a0 []*v1beta2.ServiceLog, _a1 error) *Client_LeaseLogs_Call { +func (_c *Client_LeaseLogs_Call) Return(_a0 []*v1beta3.ServiceLog, _a1 error) *Client_LeaseLogs_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_LeaseLogs_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, bool, *int64) ([]*v1beta2.ServiceLog, error)) *Client_LeaseLogs_Call { +func (_c *Client_LeaseLogs_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) ([]*v1beta3.ServiceLog, error)) *Client_LeaseLogs_Call { _c.Call.Return(run) return _c } // LeaseStatus provides a mock function with given fields: _a0, _a1 -func (_m *Client) LeaseStatus(_a0 context.Context, _a1 v1beta3.LeaseID) (map[string]*v1beta2.ServiceStatus, error) { +func (_m *Client) LeaseStatus(_a0 context.Context, _a1 marketv1beta3.LeaseID) (map[string]*v1beta3.ServiceStatus, error) { ret := _m.Called(_a0, _a1) - var r0 map[string]*v1beta2.ServiceStatus + var r0 map[string]*v1beta3.ServiceStatus var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) (map[string]*v1beta2.ServiceStatus, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) (map[string]*v1beta3.ServiceStatus, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) map[string]*v1beta2.ServiceStatus); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) map[string]*v1beta3.ServiceStatus); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]*v1beta2.ServiceStatus) + r0 = ret.Get(0).(map[string]*v1beta3.ServiceStatus) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -867,42 +867,42 @@ type Client_LeaseStatus_Call struct { // LeaseStatus is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID func (_e *Client_Expecter) LeaseStatus(_a0 interface{}, _a1 interface{}) *Client_LeaseStatus_Call { return &Client_LeaseStatus_Call{Call: _e.mock.On("LeaseStatus", _a0, _a1)} } -func (_c *Client_LeaseStatus_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID)) *Client_LeaseStatus_Call { +func (_c *Client_LeaseStatus_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID)) *Client_LeaseStatus_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } -func (_c *Client_LeaseStatus_Call) Return(_a0 map[string]*v1beta2.ServiceStatus, _a1 error) *Client_LeaseStatus_Call { +func (_c *Client_LeaseStatus_Call) Return(_a0 map[string]*v1beta3.ServiceStatus, _a1 error) *Client_LeaseStatus_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_LeaseStatus_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) (map[string]*v1beta2.ServiceStatus, error)) *Client_LeaseStatus_Call { +func (_c *Client_LeaseStatus_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) (map[string]*v1beta3.ServiceStatus, error)) *Client_LeaseStatus_Call { _c.Call.Return(run) return _c } // ObserveHostnameState provides a mock function with given fields: ctx -func (_m *Client) ObserveHostnameState(ctx context.Context) (<-chan v1beta2.HostnameResourceEvent, error) { +func (_m *Client) ObserveHostnameState(ctx context.Context) (<-chan v1beta3.HostnameResourceEvent, error) { ret := _m.Called(ctx) - var r0 <-chan v1beta2.HostnameResourceEvent + var r0 <-chan v1beta3.HostnameResourceEvent var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta2.HostnameResourceEvent, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta3.HostnameResourceEvent, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta2.HostnameResourceEvent); ok { + if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta3.HostnameResourceEvent); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(<-chan v1beta2.HostnameResourceEvent) + r0 = ret.Get(0).(<-chan v1beta3.HostnameResourceEvent) } } @@ -933,30 +933,30 @@ func (_c *Client_ObserveHostnameState_Call) Run(run func(ctx context.Context)) * return _c } -func (_c *Client_ObserveHostnameState_Call) Return(_a0 <-chan v1beta2.HostnameResourceEvent, _a1 error) *Client_ObserveHostnameState_Call { +func (_c *Client_ObserveHostnameState_Call) Return(_a0 <-chan v1beta3.HostnameResourceEvent, _a1 error) *Client_ObserveHostnameState_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_ObserveHostnameState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta2.HostnameResourceEvent, error)) *Client_ObserveHostnameState_Call { +func (_c *Client_ObserveHostnameState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta3.HostnameResourceEvent, error)) *Client_ObserveHostnameState_Call { _c.Call.Return(run) return _c } // ObserveIPState provides a mock function with given fields: ctx -func (_m *Client) ObserveIPState(ctx context.Context) (<-chan v1beta2.IPResourceEvent, error) { +func (_m *Client) ObserveIPState(ctx context.Context) (<-chan v1beta3.IPResourceEvent, error) { ret := _m.Called(ctx) - var r0 <-chan v1beta2.IPResourceEvent + var r0 <-chan v1beta3.IPResourceEvent var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta2.IPResourceEvent, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta3.IPResourceEvent, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta2.IPResourceEvent); ok { + if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta3.IPResourceEvent); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(<-chan v1beta2.IPResourceEvent) + r0 = ret.Get(0).(<-chan v1beta3.IPResourceEvent) } } @@ -987,22 +987,22 @@ func (_c *Client_ObserveIPState_Call) Run(run func(ctx context.Context)) *Client return _c } -func (_c *Client_ObserveIPState_Call) Return(_a0 <-chan v1beta2.IPResourceEvent, _a1 error) *Client_ObserveIPState_Call { +func (_c *Client_ObserveIPState_Call) Return(_a0 <-chan v1beta3.IPResourceEvent, _a1 error) *Client_ObserveIPState_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_ObserveIPState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta2.IPResourceEvent, error)) *Client_ObserveIPState_Call { +func (_c *Client_ObserveIPState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta3.IPResourceEvent, error)) *Client_ObserveIPState_Call { _c.Call.Return(run) return _c } // PurgeDeclaredHostname provides a mock function with given fields: ctx, lID, hostname -func (_m *Client) PurgeDeclaredHostname(ctx context.Context, lID v1beta3.LeaseID, hostname string) error { +func (_m *Client) PurgeDeclaredHostname(ctx context.Context, lID marketv1beta3.LeaseID, hostname string) error { ret := _m.Called(ctx, lID, hostname) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string) error); ok { r0 = rf(ctx, lID, hostname) } else { r0 = ret.Error(0) @@ -1018,15 +1018,15 @@ type Client_PurgeDeclaredHostname_Call struct { // PurgeDeclaredHostname is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID // - hostname string func (_e *Client_Expecter) PurgeDeclaredHostname(ctx interface{}, lID interface{}, hostname interface{}) *Client_PurgeDeclaredHostname_Call { return &Client_PurgeDeclaredHostname_Call{Call: _e.mock.On("PurgeDeclaredHostname", ctx, lID, hostname)} } -func (_c *Client_PurgeDeclaredHostname_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID, hostname string)) *Client_PurgeDeclaredHostname_Call { +func (_c *Client_PurgeDeclaredHostname_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID, hostname string)) *Client_PurgeDeclaredHostname_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string)) }) return _c } @@ -1036,17 +1036,17 @@ func (_c *Client_PurgeDeclaredHostname_Call) Return(_a0 error) *Client_PurgeDecl return _c } -func (_c *Client_PurgeDeclaredHostname_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string) error) *Client_PurgeDeclaredHostname_Call { +func (_c *Client_PurgeDeclaredHostname_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string) error) *Client_PurgeDeclaredHostname_Call { _c.Call.Return(run) return _c } // PurgeDeclaredHostnames provides a mock function with given fields: ctx, lID -func (_m *Client) PurgeDeclaredHostnames(ctx context.Context, lID v1beta3.LeaseID) error { +func (_m *Client) PurgeDeclaredHostnames(ctx context.Context, lID marketv1beta3.LeaseID) error { ret := _m.Called(ctx, lID) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) error); ok { r0 = rf(ctx, lID) } else { r0 = ret.Error(0) @@ -1062,14 +1062,14 @@ type Client_PurgeDeclaredHostnames_Call struct { // PurgeDeclaredHostnames is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID func (_e *Client_Expecter) PurgeDeclaredHostnames(ctx interface{}, lID interface{}) *Client_PurgeDeclaredHostnames_Call { return &Client_PurgeDeclaredHostnames_Call{Call: _e.mock.On("PurgeDeclaredHostnames", ctx, lID)} } -func (_c *Client_PurgeDeclaredHostnames_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID)) *Client_PurgeDeclaredHostnames_Call { +func (_c *Client_PurgeDeclaredHostnames_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID)) *Client_PurgeDeclaredHostnames_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } @@ -1079,17 +1079,17 @@ func (_c *Client_PurgeDeclaredHostnames_Call) Return(_a0 error) *Client_PurgeDec return _c } -func (_c *Client_PurgeDeclaredHostnames_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) error) *Client_PurgeDeclaredHostnames_Call { +func (_c *Client_PurgeDeclaredHostnames_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) error) *Client_PurgeDeclaredHostnames_Call { _c.Call.Return(run) return _c } // PurgeDeclaredIP provides a mock function with given fields: ctx, lID, serviceName, externalPort, proto -func (_m *Client) PurgeDeclaredIP(ctx context.Context, lID v1beta3.LeaseID, serviceName string, externalPort uint32, proto v2beta2.ServiceProtocol) error { +func (_m *Client) PurgeDeclaredIP(ctx context.Context, lID marketv1beta3.LeaseID, serviceName string, externalPort uint32, proto v2beta2.ServiceProtocol) error { ret := _m.Called(ctx, lID, serviceName, externalPort, proto) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, uint32, v2beta2.ServiceProtocol) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, uint32, v2beta2.ServiceProtocol) error); ok { r0 = rf(ctx, lID, serviceName, externalPort, proto) } else { r0 = ret.Error(0) @@ -1105,7 +1105,7 @@ type Client_PurgeDeclaredIP_Call struct { // PurgeDeclaredIP is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID // - serviceName string // - externalPort uint32 // - proto v2beta2.ServiceProtocol @@ -1113,9 +1113,9 @@ func (_e *Client_Expecter) PurgeDeclaredIP(ctx interface{}, lID interface{}, ser return &Client_PurgeDeclaredIP_Call{Call: _e.mock.On("PurgeDeclaredIP", ctx, lID, serviceName, externalPort, proto)} } -func (_c *Client_PurgeDeclaredIP_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID, serviceName string, externalPort uint32, proto v2beta2.ServiceProtocol)) *Client_PurgeDeclaredIP_Call { +func (_c *Client_PurgeDeclaredIP_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID, serviceName string, externalPort uint32, proto v2beta2.ServiceProtocol)) *Client_PurgeDeclaredIP_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(uint32), args[4].(v2beta2.ServiceProtocol)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(uint32), args[4].(v2beta2.ServiceProtocol)) }) return _c } @@ -1125,17 +1125,17 @@ func (_c *Client_PurgeDeclaredIP_Call) Return(_a0 error) *Client_PurgeDeclaredIP return _c } -func (_c *Client_PurgeDeclaredIP_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, uint32, v2beta2.ServiceProtocol) error) *Client_PurgeDeclaredIP_Call { +func (_c *Client_PurgeDeclaredIP_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, uint32, v2beta2.ServiceProtocol) error) *Client_PurgeDeclaredIP_Call { _c.Call.Return(run) return _c } // PurgeDeclaredIPs provides a mock function with given fields: ctx, lID -func (_m *Client) PurgeDeclaredIPs(ctx context.Context, lID v1beta3.LeaseID) error { +func (_m *Client) PurgeDeclaredIPs(ctx context.Context, lID marketv1beta3.LeaseID) error { ret := _m.Called(ctx, lID) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) error); ok { r0 = rf(ctx, lID) } else { r0 = ret.Error(0) @@ -1151,14 +1151,14 @@ type Client_PurgeDeclaredIPs_Call struct { // PurgeDeclaredIPs is a helper method to define mock.On call // - ctx context.Context -// - lID v1beta3.LeaseID +// - lID marketv1beta3.LeaseID func (_e *Client_Expecter) PurgeDeclaredIPs(ctx interface{}, lID interface{}) *Client_PurgeDeclaredIPs_Call { return &Client_PurgeDeclaredIPs_Call{Call: _e.mock.On("PurgeDeclaredIPs", ctx, lID)} } -func (_c *Client_PurgeDeclaredIPs_Call) Run(run func(ctx context.Context, lID v1beta3.LeaseID)) *Client_PurgeDeclaredIPs_Call { +func (_c *Client_PurgeDeclaredIPs_Call) Run(run func(ctx context.Context, lID marketv1beta3.LeaseID)) *Client_PurgeDeclaredIPs_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } @@ -1168,17 +1168,17 @@ func (_c *Client_PurgeDeclaredIPs_Call) Return(_a0 error) *Client_PurgeDeclaredI return _c } -func (_c *Client_PurgeDeclaredIPs_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) error) *Client_PurgeDeclaredIPs_Call { +func (_c *Client_PurgeDeclaredIPs_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) error) *Client_PurgeDeclaredIPs_Call { _c.Call.Return(run) return _c } // RemoveHostnameFromDeployment provides a mock function with given fields: ctx, hostname, leaseID, allowMissing -func (_m *Client) RemoveHostnameFromDeployment(ctx context.Context, hostname string, leaseID v1beta3.LeaseID, allowMissing bool) error { +func (_m *Client) RemoveHostnameFromDeployment(ctx context.Context, hostname string, leaseID marketv1beta3.LeaseID, allowMissing bool) error { ret := _m.Called(ctx, hostname, leaseID, allowMissing) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, v1beta3.LeaseID, bool) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, string, marketv1beta3.LeaseID, bool) error); ok { r0 = rf(ctx, hostname, leaseID, allowMissing) } else { r0 = ret.Error(0) @@ -1195,15 +1195,15 @@ type Client_RemoveHostnameFromDeployment_Call struct { // RemoveHostnameFromDeployment is a helper method to define mock.On call // - ctx context.Context // - hostname string -// - leaseID v1beta3.LeaseID +// - leaseID marketv1beta3.LeaseID // - allowMissing bool func (_e *Client_Expecter) RemoveHostnameFromDeployment(ctx interface{}, hostname interface{}, leaseID interface{}, allowMissing interface{}) *Client_RemoveHostnameFromDeployment_Call { return &Client_RemoveHostnameFromDeployment_Call{Call: _e.mock.On("RemoveHostnameFromDeployment", ctx, hostname, leaseID, allowMissing)} } -func (_c *Client_RemoveHostnameFromDeployment_Call) Run(run func(ctx context.Context, hostname string, leaseID v1beta3.LeaseID, allowMissing bool)) *Client_RemoveHostnameFromDeployment_Call { +func (_c *Client_RemoveHostnameFromDeployment_Call) Run(run func(ctx context.Context, hostname string, leaseID marketv1beta3.LeaseID, allowMissing bool)) *Client_RemoveHostnameFromDeployment_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(v1beta3.LeaseID), args[3].(bool)) + run(args[0].(context.Context), args[1].(string), args[2].(marketv1beta3.LeaseID), args[3].(bool)) }) return _c } @@ -1213,29 +1213,29 @@ func (_c *Client_RemoveHostnameFromDeployment_Call) Return(_a0 error) *Client_Re return _c } -func (_c *Client_RemoveHostnameFromDeployment_Call) RunAndReturn(run func(context.Context, string, v1beta3.LeaseID, bool) error) *Client_RemoveHostnameFromDeployment_Call { +func (_c *Client_RemoveHostnameFromDeployment_Call) RunAndReturn(run func(context.Context, string, marketv1beta3.LeaseID, bool) error) *Client_RemoveHostnameFromDeployment_Call { _c.Call.Return(run) return _c } // ServiceStatus provides a mock function with given fields: _a0, _a1, _a2 -func (_m *Client) ServiceStatus(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string) (*v1beta2.ServiceStatus, error) { +func (_m *Client) ServiceStatus(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string) (*v1beta3.ServiceStatus, error) { ret := _m.Called(_a0, _a1, _a2) - var r0 *v1beta2.ServiceStatus + var r0 *v1beta3.ServiceStatus var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string) (*v1beta2.ServiceStatus, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string) (*v1beta3.ServiceStatus, error)); ok { return rf(_a0, _a1, _a2) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string) *v1beta2.ServiceStatus); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string) *v1beta3.ServiceStatus); ok { r0 = rf(_a0, _a1, _a2) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1beta2.ServiceStatus) + r0 = ret.Get(0).(*v1beta3.ServiceStatus) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID, string) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID, string) error); ok { r1 = rf(_a0, _a1, _a2) } else { r1 = ret.Error(1) @@ -1251,35 +1251,35 @@ type Client_ServiceStatus_Call struct { // ServiceStatus is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID // - _a2 string func (_e *Client_Expecter) ServiceStatus(_a0 interface{}, _a1 interface{}, _a2 interface{}) *Client_ServiceStatus_Call { return &Client_ServiceStatus_Call{Call: _e.mock.On("ServiceStatus", _a0, _a1, _a2)} } -func (_c *Client_ServiceStatus_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string)) *Client_ServiceStatus_Call { +func (_c *Client_ServiceStatus_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string)) *Client_ServiceStatus_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string)) }) return _c } -func (_c *Client_ServiceStatus_Call) Return(_a0 *v1beta2.ServiceStatus, _a1 error) *Client_ServiceStatus_Call { +func (_c *Client_ServiceStatus_Call) Return(_a0 *v1beta3.ServiceStatus, _a1 error) *Client_ServiceStatus_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Client_ServiceStatus_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string) (*v1beta2.ServiceStatus, error)) *Client_ServiceStatus_Call { +func (_c *Client_ServiceStatus_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string) (*v1beta3.ServiceStatus, error)) *Client_ServiceStatus_Call { _c.Call.Return(run) return _c } // TeardownLease provides a mock function with given fields: _a0, _a1 -func (_m *Client) TeardownLease(_a0 context.Context, _a1 v1beta3.LeaseID) error { +func (_m *Client) TeardownLease(_a0 context.Context, _a1 marketv1beta3.LeaseID) error { ret := _m.Called(_a0, _a1) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) error); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Error(0) @@ -1295,14 +1295,14 @@ type Client_TeardownLease_Call struct { // TeardownLease is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID func (_e *Client_Expecter) TeardownLease(_a0 interface{}, _a1 interface{}) *Client_TeardownLease_Call { return &Client_TeardownLease_Call{Call: _e.mock.On("TeardownLease", _a0, _a1)} } -func (_c *Client_TeardownLease_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID)) *Client_TeardownLease_Call { +func (_c *Client_TeardownLease_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID)) *Client_TeardownLease_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } @@ -1312,7 +1312,7 @@ func (_c *Client_TeardownLease_Call) Return(_a0 error) *Client_TeardownLease_Cal return _c } -func (_c *Client_TeardownLease_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) error) *Client_TeardownLease_Call { +func (_c *Client_TeardownLease_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) error) *Client_TeardownLease_Call { _c.Call.Return(run) return _c } diff --git a/cluster/mocks/cluster.go b/cluster/mocks/cluster.go index 67babcb9e..b8d306207 100644 --- a/cluster/mocks/cluster.go +++ b/cluster/mocks/cluster.go @@ -1,12 +1,13 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks import ( - typesv1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" - v1beta2 "github.com/akash-network/provider/cluster/types/v1beta3" + clustertypesv1beta3 "github.com/akash-network/provider/cluster/types/v1beta3" mock "github.com/stretchr/testify/mock" + typesv1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" + v1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" ) @@ -24,19 +25,19 @@ func (_m *Cluster) EXPECT() *Cluster_Expecter { } // Reserve provides a mock function with given fields: _a0, _a1 -func (_m *Cluster) Reserve(_a0 v1beta3.OrderID, _a1 typesv1beta3.ResourceGroup) (v1beta2.Reservation, error) { +func (_m *Cluster) Reserve(_a0 v1beta3.OrderID, _a1 typesv1beta3.ResourceGroup) (clustertypesv1beta3.Reservation, error) { ret := _m.Called(_a0, _a1) - var r0 v1beta2.Reservation + var r0 clustertypesv1beta3.Reservation var r1 error - if rf, ok := ret.Get(0).(func(v1beta3.OrderID, typesv1beta3.ResourceGroup) (v1beta2.Reservation, error)); ok { + if rf, ok := ret.Get(0).(func(v1beta3.OrderID, typesv1beta3.ResourceGroup) (clustertypesv1beta3.Reservation, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(v1beta3.OrderID, typesv1beta3.ResourceGroup) v1beta2.Reservation); ok { + if rf, ok := ret.Get(0).(func(v1beta3.OrderID, typesv1beta3.ResourceGroup) clustertypesv1beta3.Reservation); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.Reservation) + r0 = ret.Get(0).(clustertypesv1beta3.Reservation) } } @@ -68,12 +69,12 @@ func (_c *Cluster_Reserve_Call) Run(run func(_a0 v1beta3.OrderID, _a1 typesv1bet return _c } -func (_c *Cluster_Reserve_Call) Return(_a0 v1beta2.Reservation, _a1 error) *Cluster_Reserve_Call { +func (_c *Cluster_Reserve_Call) Return(_a0 clustertypesv1beta3.Reservation, _a1 error) *Cluster_Reserve_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Cluster_Reserve_Call) RunAndReturn(run func(v1beta3.OrderID, typesv1beta3.ResourceGroup) (v1beta2.Reservation, error)) *Cluster_Reserve_Call { +func (_c *Cluster_Reserve_Call) RunAndReturn(run func(v1beta3.OrderID, typesv1beta3.ResourceGroup) (clustertypesv1beta3.Reservation, error)) *Cluster_Reserve_Call { _c.Call.Return(run) return _c } diff --git a/cluster/mocks/deployment.go b/cluster/mocks/deployment.go index bb1f6f73f..10ca33433 100644 --- a/cluster/mocks/deployment.go +++ b/cluster/mocks/deployment.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks diff --git a/cluster/mocks/hostname_service_client.go b/cluster/mocks/hostname_service_client.go index 37fe9b287..9fa6dbcdf 100644 --- a/cluster/mocks/hostname_service_client.go +++ b/cluster/mocks/hostname_service_client.go @@ -1,14 +1,14 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks import ( context "context" - types "github.com/cosmos/cosmos-sdk/types" + marketv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" mock "github.com/stretchr/testify/mock" - v1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" + types "github.com/cosmos/cosmos-sdk/types" ) // HostnameServiceClient is an autogenerated mock type for the HostnameServiceClient type @@ -68,11 +68,11 @@ func (_c *HostnameServiceClient_CanReserveHostnames_Call) RunAndReturn(run func( } // PrepareHostnamesForTransfer provides a mock function with given fields: ctx, hostnames, leaseID -func (_m *HostnameServiceClient) PrepareHostnamesForTransfer(ctx context.Context, hostnames []string, leaseID v1beta3.LeaseID) error { +func (_m *HostnameServiceClient) PrepareHostnamesForTransfer(ctx context.Context, hostnames []string, leaseID marketv1beta3.LeaseID) error { ret := _m.Called(ctx, hostnames, leaseID) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, []string, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, []string, marketv1beta3.LeaseID) error); ok { r0 = rf(ctx, hostnames, leaseID) } else { r0 = ret.Error(0) @@ -89,14 +89,14 @@ type HostnameServiceClient_PrepareHostnamesForTransfer_Call struct { // PrepareHostnamesForTransfer is a helper method to define mock.On call // - ctx context.Context // - hostnames []string -// - leaseID v1beta3.LeaseID +// - leaseID marketv1beta3.LeaseID func (_e *HostnameServiceClient_Expecter) PrepareHostnamesForTransfer(ctx interface{}, hostnames interface{}, leaseID interface{}) *HostnameServiceClient_PrepareHostnamesForTransfer_Call { return &HostnameServiceClient_PrepareHostnamesForTransfer_Call{Call: _e.mock.On("PrepareHostnamesForTransfer", ctx, hostnames, leaseID)} } -func (_c *HostnameServiceClient_PrepareHostnamesForTransfer_Call) Run(run func(ctx context.Context, hostnames []string, leaseID v1beta3.LeaseID)) *HostnameServiceClient_PrepareHostnamesForTransfer_Call { +func (_c *HostnameServiceClient_PrepareHostnamesForTransfer_Call) Run(run func(ctx context.Context, hostnames []string, leaseID marketv1beta3.LeaseID)) *HostnameServiceClient_PrepareHostnamesForTransfer_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].([]string), args[2].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].([]string), args[2].(marketv1beta3.LeaseID)) }) return _c } @@ -106,17 +106,17 @@ func (_c *HostnameServiceClient_PrepareHostnamesForTransfer_Call) Return(_a0 err return _c } -func (_c *HostnameServiceClient_PrepareHostnamesForTransfer_Call) RunAndReturn(run func(context.Context, []string, v1beta3.LeaseID) error) *HostnameServiceClient_PrepareHostnamesForTransfer_Call { +func (_c *HostnameServiceClient_PrepareHostnamesForTransfer_Call) RunAndReturn(run func(context.Context, []string, marketv1beta3.LeaseID) error) *HostnameServiceClient_PrepareHostnamesForTransfer_Call { _c.Call.Return(run) return _c } // ReleaseHostnames provides a mock function with given fields: leaseID -func (_m *HostnameServiceClient) ReleaseHostnames(leaseID v1beta3.LeaseID) error { +func (_m *HostnameServiceClient) ReleaseHostnames(leaseID marketv1beta3.LeaseID) error { ret := _m.Called(leaseID) var r0 error - if rf, ok := ret.Get(0).(func(v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(0).(func(marketv1beta3.LeaseID) error); ok { r0 = rf(leaseID) } else { r0 = ret.Error(0) @@ -131,14 +131,14 @@ type HostnameServiceClient_ReleaseHostnames_Call struct { } // ReleaseHostnames is a helper method to define mock.On call -// - leaseID v1beta3.LeaseID +// - leaseID marketv1beta3.LeaseID func (_e *HostnameServiceClient_Expecter) ReleaseHostnames(leaseID interface{}) *HostnameServiceClient_ReleaseHostnames_Call { return &HostnameServiceClient_ReleaseHostnames_Call{Call: _e.mock.On("ReleaseHostnames", leaseID)} } -func (_c *HostnameServiceClient_ReleaseHostnames_Call) Run(run func(leaseID v1beta3.LeaseID)) *HostnameServiceClient_ReleaseHostnames_Call { +func (_c *HostnameServiceClient_ReleaseHostnames_Call) Run(run func(leaseID marketv1beta3.LeaseID)) *HostnameServiceClient_ReleaseHostnames_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(v1beta3.LeaseID)) + run(args[0].(marketv1beta3.LeaseID)) }) return _c } @@ -148,21 +148,21 @@ func (_c *HostnameServiceClient_ReleaseHostnames_Call) Return(_a0 error) *Hostna return _c } -func (_c *HostnameServiceClient_ReleaseHostnames_Call) RunAndReturn(run func(v1beta3.LeaseID) error) *HostnameServiceClient_ReleaseHostnames_Call { +func (_c *HostnameServiceClient_ReleaseHostnames_Call) RunAndReturn(run func(marketv1beta3.LeaseID) error) *HostnameServiceClient_ReleaseHostnames_Call { _c.Call.Return(run) return _c } // ReserveHostnames provides a mock function with given fields: ctx, hostnames, leaseID -func (_m *HostnameServiceClient) ReserveHostnames(ctx context.Context, hostnames []string, leaseID v1beta3.LeaseID) ([]string, error) { +func (_m *HostnameServiceClient) ReserveHostnames(ctx context.Context, hostnames []string, leaseID marketv1beta3.LeaseID) ([]string, error) { ret := _m.Called(ctx, hostnames, leaseID) var r0 []string var r1 error - if rf, ok := ret.Get(0).(func(context.Context, []string, v1beta3.LeaseID) ([]string, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, []string, marketv1beta3.LeaseID) ([]string, error)); ok { return rf(ctx, hostnames, leaseID) } - if rf, ok := ret.Get(0).(func(context.Context, []string, v1beta3.LeaseID) []string); ok { + if rf, ok := ret.Get(0).(func(context.Context, []string, marketv1beta3.LeaseID) []string); ok { r0 = rf(ctx, hostnames, leaseID) } else { if ret.Get(0) != nil { @@ -170,7 +170,7 @@ func (_m *HostnameServiceClient) ReserveHostnames(ctx context.Context, hostnames } } - if rf, ok := ret.Get(1).(func(context.Context, []string, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, []string, marketv1beta3.LeaseID) error); ok { r1 = rf(ctx, hostnames, leaseID) } else { r1 = ret.Error(1) @@ -187,14 +187,14 @@ type HostnameServiceClient_ReserveHostnames_Call struct { // ReserveHostnames is a helper method to define mock.On call // - ctx context.Context // - hostnames []string -// - leaseID v1beta3.LeaseID +// - leaseID marketv1beta3.LeaseID func (_e *HostnameServiceClient_Expecter) ReserveHostnames(ctx interface{}, hostnames interface{}, leaseID interface{}) *HostnameServiceClient_ReserveHostnames_Call { return &HostnameServiceClient_ReserveHostnames_Call{Call: _e.mock.On("ReserveHostnames", ctx, hostnames, leaseID)} } -func (_c *HostnameServiceClient_ReserveHostnames_Call) Run(run func(ctx context.Context, hostnames []string, leaseID v1beta3.LeaseID)) *HostnameServiceClient_ReserveHostnames_Call { +func (_c *HostnameServiceClient_ReserveHostnames_Call) Run(run func(ctx context.Context, hostnames []string, leaseID marketv1beta3.LeaseID)) *HostnameServiceClient_ReserveHostnames_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].([]string), args[2].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].([]string), args[2].(marketv1beta3.LeaseID)) }) return _c } @@ -204,7 +204,7 @@ func (_c *HostnameServiceClient_ReserveHostnames_Call) Return(_a0 []string, _a1 return _c } -func (_c *HostnameServiceClient_ReserveHostnames_Call) RunAndReturn(run func(context.Context, []string, v1beta3.LeaseID) ([]string, error)) *HostnameServiceClient_ReserveHostnames_Call { +func (_c *HostnameServiceClient_ReserveHostnames_Call) RunAndReturn(run func(context.Context, []string, marketv1beta3.LeaseID) ([]string, error)) *HostnameServiceClient_ReserveHostnames_Call { _c.Call.Return(run) return _c } diff --git a/cluster/mocks/ip_operator_client.go b/cluster/mocks/ip_operator_client.go index cb514a5e7..92514d150 100644 --- a/cluster/mocks/ip_operator_client.go +++ b/cluster/mocks/ip_operator_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks diff --git a/cluster/mocks/metallb_client.go b/cluster/mocks/metallb_client.go index 500c37241..6e13211cf 100644 --- a/cluster/mocks/metallb_client.go +++ b/cluster/mocks/metallb_client.go @@ -1,15 +1,15 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks import ( context "context" - mock "github.com/stretchr/testify/mock" + marketv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" - v1beta2 "github.com/akash-network/provider/cluster/types/v1beta3" + mock "github.com/stretchr/testify/mock" - v1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" + v1beta3 "github.com/akash-network/provider/cluster/types/v1beta3" ) // MetalLBClient is an autogenerated mock type for the Client type @@ -26,11 +26,11 @@ func (_m *MetalLBClient) EXPECT() *MetalLBClient_Expecter { } // CreateIPPassthrough provides a mock function with given fields: ctx, directive -func (_m *MetalLBClient) CreateIPPassthrough(ctx context.Context, directive v1beta2.ClusterIPPassthroughDirective) error { +func (_m *MetalLBClient) CreateIPPassthrough(ctx context.Context, directive v1beta3.ClusterIPPassthroughDirective) error { ret := _m.Called(ctx, directive) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta2.ClusterIPPassthroughDirective) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, v1beta3.ClusterIPPassthroughDirective) error); ok { r0 = rf(ctx, directive) } else { r0 = ret.Error(0) @@ -46,14 +46,14 @@ type MetalLBClient_CreateIPPassthrough_Call struct { // CreateIPPassthrough is a helper method to define mock.On call // - ctx context.Context -// - directive v1beta2.ClusterIPPassthroughDirective +// - directive v1beta3.ClusterIPPassthroughDirective func (_e *MetalLBClient_Expecter) CreateIPPassthrough(ctx interface{}, directive interface{}) *MetalLBClient_CreateIPPassthrough_Call { return &MetalLBClient_CreateIPPassthrough_Call{Call: _e.mock.On("CreateIPPassthrough", ctx, directive)} } -func (_c *MetalLBClient_CreateIPPassthrough_Call) Run(run func(ctx context.Context, directive v1beta2.ClusterIPPassthroughDirective)) *MetalLBClient_CreateIPPassthrough_Call { +func (_c *MetalLBClient_CreateIPPassthrough_Call) Run(run func(ctx context.Context, directive v1beta3.ClusterIPPassthroughDirective)) *MetalLBClient_CreateIPPassthrough_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta2.ClusterIPPassthroughDirective)) + run(args[0].(context.Context), args[1].(v1beta3.ClusterIPPassthroughDirective)) }) return _c } @@ -63,7 +63,7 @@ func (_c *MetalLBClient_CreateIPPassthrough_Call) Return(_a0 error) *MetalLBClie return _c } -func (_c *MetalLBClient_CreateIPPassthrough_Call) RunAndReturn(run func(context.Context, v1beta2.ClusterIPPassthroughDirective) error) *MetalLBClient_CreateIPPassthrough_Call { +func (_c *MetalLBClient_CreateIPPassthrough_Call) RunAndReturn(run func(context.Context, v1beta3.ClusterIPPassthroughDirective) error) *MetalLBClient_CreateIPPassthrough_Call { _c.Call.Return(run) return _c } @@ -123,23 +123,23 @@ func (_c *MetalLBClient_DetectPoolChanges_Call) RunAndReturn(run func(context.Co } // GetIPAddressStatusForLease provides a mock function with given fields: ctx, leaseID -func (_m *MetalLBClient) GetIPAddressStatusForLease(ctx context.Context, leaseID v1beta3.LeaseID) ([]v1beta2.IPLeaseState, error) { +func (_m *MetalLBClient) GetIPAddressStatusForLease(ctx context.Context, leaseID marketv1beta3.LeaseID) ([]v1beta3.IPLeaseState, error) { ret := _m.Called(ctx, leaseID) - var r0 []v1beta2.IPLeaseState + var r0 []v1beta3.IPLeaseState var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) ([]v1beta2.IPLeaseState, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) ([]v1beta3.IPLeaseState, error)); ok { return rf(ctx, leaseID) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) []v1beta2.IPLeaseState); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) []v1beta3.IPLeaseState); ok { r0 = rf(ctx, leaseID) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta2.IPLeaseState) + r0 = ret.Get(0).([]v1beta3.IPLeaseState) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) error); ok { r1 = rf(ctx, leaseID) } else { r1 = ret.Error(1) @@ -155,24 +155,24 @@ type MetalLBClient_GetIPAddressStatusForLease_Call struct { // GetIPAddressStatusForLease is a helper method to define mock.On call // - ctx context.Context -// - leaseID v1beta3.LeaseID +// - leaseID marketv1beta3.LeaseID func (_e *MetalLBClient_Expecter) GetIPAddressStatusForLease(ctx interface{}, leaseID interface{}) *MetalLBClient_GetIPAddressStatusForLease_Call { return &MetalLBClient_GetIPAddressStatusForLease_Call{Call: _e.mock.On("GetIPAddressStatusForLease", ctx, leaseID)} } -func (_c *MetalLBClient_GetIPAddressStatusForLease_Call) Run(run func(ctx context.Context, leaseID v1beta3.LeaseID)) *MetalLBClient_GetIPAddressStatusForLease_Call { +func (_c *MetalLBClient_GetIPAddressStatusForLease_Call) Run(run func(ctx context.Context, leaseID marketv1beta3.LeaseID)) *MetalLBClient_GetIPAddressStatusForLease_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } -func (_c *MetalLBClient_GetIPAddressStatusForLease_Call) Return(_a0 []v1beta2.IPLeaseState, _a1 error) *MetalLBClient_GetIPAddressStatusForLease_Call { +func (_c *MetalLBClient_GetIPAddressStatusForLease_Call) Return(_a0 []v1beta3.IPLeaseState, _a1 error) *MetalLBClient_GetIPAddressStatusForLease_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MetalLBClient_GetIPAddressStatusForLease_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) ([]v1beta2.IPLeaseState, error)) *MetalLBClient_GetIPAddressStatusForLease_Call { +func (_c *MetalLBClient_GetIPAddressStatusForLease_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) ([]v1beta3.IPLeaseState, error)) *MetalLBClient_GetIPAddressStatusForLease_Call { _c.Call.Return(run) return _c } @@ -237,19 +237,19 @@ func (_c *MetalLBClient_GetIPAddressUsage_Call) RunAndReturn(run func(context.Co } // GetIPPassthroughs provides a mock function with given fields: ctx -func (_m *MetalLBClient) GetIPPassthroughs(ctx context.Context) ([]v1beta2.IPPassthrough, error) { +func (_m *MetalLBClient) GetIPPassthroughs(ctx context.Context) ([]v1beta3.IPPassthrough, error) { ret := _m.Called(ctx) - var r0 []v1beta2.IPPassthrough + var r0 []v1beta3.IPPassthrough var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta2.IPPassthrough, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta3.IPPassthrough, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) []v1beta2.IPPassthrough); ok { + if rf, ok := ret.Get(0).(func(context.Context) []v1beta3.IPPassthrough); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta2.IPPassthrough) + r0 = ret.Get(0).([]v1beta3.IPPassthrough) } } @@ -280,22 +280,22 @@ func (_c *MetalLBClient_GetIPPassthroughs_Call) Run(run func(ctx context.Context return _c } -func (_c *MetalLBClient_GetIPPassthroughs_Call) Return(_a0 []v1beta2.IPPassthrough, _a1 error) *MetalLBClient_GetIPPassthroughs_Call { +func (_c *MetalLBClient_GetIPPassthroughs_Call) Return(_a0 []v1beta3.IPPassthrough, _a1 error) *MetalLBClient_GetIPPassthroughs_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MetalLBClient_GetIPPassthroughs_Call) RunAndReturn(run func(context.Context) ([]v1beta2.IPPassthrough, error)) *MetalLBClient_GetIPPassthroughs_Call { +func (_c *MetalLBClient_GetIPPassthroughs_Call) RunAndReturn(run func(context.Context) ([]v1beta3.IPPassthrough, error)) *MetalLBClient_GetIPPassthroughs_Call { _c.Call.Return(run) return _c } // PurgeIPPassthrough provides a mock function with given fields: ctx, directive -func (_m *MetalLBClient) PurgeIPPassthrough(ctx context.Context, directive v1beta2.ClusterIPPassthroughDirective) error { +func (_m *MetalLBClient) PurgeIPPassthrough(ctx context.Context, directive v1beta3.ClusterIPPassthroughDirective) error { ret := _m.Called(ctx, directive) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta2.ClusterIPPassthroughDirective) error); ok { + if rf, ok := ret.Get(0).(func(context.Context, v1beta3.ClusterIPPassthroughDirective) error); ok { r0 = rf(ctx, directive) } else { r0 = ret.Error(0) @@ -311,14 +311,14 @@ type MetalLBClient_PurgeIPPassthrough_Call struct { // PurgeIPPassthrough is a helper method to define mock.On call // - ctx context.Context -// - directive v1beta2.ClusterIPPassthroughDirective +// - directive v1beta3.ClusterIPPassthroughDirective func (_e *MetalLBClient_Expecter) PurgeIPPassthrough(ctx interface{}, directive interface{}) *MetalLBClient_PurgeIPPassthrough_Call { return &MetalLBClient_PurgeIPPassthrough_Call{Call: _e.mock.On("PurgeIPPassthrough", ctx, directive)} } -func (_c *MetalLBClient_PurgeIPPassthrough_Call) Run(run func(ctx context.Context, directive v1beta2.ClusterIPPassthroughDirective)) *MetalLBClient_PurgeIPPassthrough_Call { +func (_c *MetalLBClient_PurgeIPPassthrough_Call) Run(run func(ctx context.Context, directive v1beta3.ClusterIPPassthroughDirective)) *MetalLBClient_PurgeIPPassthrough_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta2.ClusterIPPassthroughDirective)) + run(args[0].(context.Context), args[1].(v1beta3.ClusterIPPassthroughDirective)) }) return _c } @@ -328,7 +328,7 @@ func (_c *MetalLBClient_PurgeIPPassthrough_Call) Return(_a0 error) *MetalLBClien return _c } -func (_c *MetalLBClient_PurgeIPPassthrough_Call) RunAndReturn(run func(context.Context, v1beta2.ClusterIPPassthroughDirective) error) *MetalLBClient_PurgeIPPassthrough_Call { +func (_c *MetalLBClient_PurgeIPPassthrough_Call) RunAndReturn(run func(context.Context, v1beta3.ClusterIPPassthroughDirective) error) *MetalLBClient_PurgeIPPassthrough_Call { _c.Call.Return(run) return _c } diff --git a/cluster/mocks/read_client.go b/cluster/mocks/read_client.go index 4c918f8fa..9cbc62b8a 100644 --- a/cluster/mocks/read_client.go +++ b/cluster/mocks/read_client.go @@ -1,14 +1,14 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks import ( context "context" - v1beta2 "github.com/akash-network/provider/cluster/types/v1beta3" + marketv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" mock "github.com/stretchr/testify/mock" - v1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" + v1beta3 "github.com/akash-network/provider/cluster/types/v1beta3" v2beta2 "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" ) @@ -27,19 +27,19 @@ func (_m *ReadClient) EXPECT() *ReadClient_Expecter { } // AllHostnames provides a mock function with given fields: _a0 -func (_m *ReadClient) AllHostnames(_a0 context.Context) ([]v1beta2.ActiveHostname, error) { +func (_m *ReadClient) AllHostnames(_a0 context.Context) ([]v1beta3.ActiveHostname, error) { ret := _m.Called(_a0) - var r0 []v1beta2.ActiveHostname + var r0 []v1beta3.ActiveHostname var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta2.ActiveHostname, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta3.ActiveHostname, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func(context.Context) []v1beta2.ActiveHostname); ok { + if rf, ok := ret.Get(0).(func(context.Context) []v1beta3.ActiveHostname); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta2.ActiveHostname) + r0 = ret.Get(0).([]v1beta3.ActiveHostname) } } @@ -70,34 +70,34 @@ func (_c *ReadClient_AllHostnames_Call) Run(run func(_a0 context.Context)) *Read return _c } -func (_c *ReadClient_AllHostnames_Call) Return(_a0 []v1beta2.ActiveHostname, _a1 error) *ReadClient_AllHostnames_Call { +func (_c *ReadClient_AllHostnames_Call) Return(_a0 []v1beta3.ActiveHostname, _a1 error) *ReadClient_AllHostnames_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_AllHostnames_Call) RunAndReturn(run func(context.Context) ([]v1beta2.ActiveHostname, error)) *ReadClient_AllHostnames_Call { +func (_c *ReadClient_AllHostnames_Call) RunAndReturn(run func(context.Context) ([]v1beta3.ActiveHostname, error)) *ReadClient_AllHostnames_Call { _c.Call.Return(run) return _c } // ForwardedPortStatus provides a mock function with given fields: _a0, _a1 -func (_m *ReadClient) ForwardedPortStatus(_a0 context.Context, _a1 v1beta3.LeaseID) (map[string][]v1beta2.ForwardedPortStatus, error) { +func (_m *ReadClient) ForwardedPortStatus(_a0 context.Context, _a1 marketv1beta3.LeaseID) (map[string][]v1beta3.ForwardedPortStatus, error) { ret := _m.Called(_a0, _a1) - var r0 map[string][]v1beta2.ForwardedPortStatus + var r0 map[string][]v1beta3.ForwardedPortStatus var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) (map[string][]v1beta2.ForwardedPortStatus, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) (map[string][]v1beta3.ForwardedPortStatus, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) map[string][]v1beta2.ForwardedPortStatus); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) map[string][]v1beta3.ForwardedPortStatus); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string][]v1beta2.ForwardedPortStatus) + r0 = ret.Get(0).(map[string][]v1beta3.ForwardedPortStatus) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -113,38 +113,38 @@ type ReadClient_ForwardedPortStatus_Call struct { // ForwardedPortStatus is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID func (_e *ReadClient_Expecter) ForwardedPortStatus(_a0 interface{}, _a1 interface{}) *ReadClient_ForwardedPortStatus_Call { return &ReadClient_ForwardedPortStatus_Call{Call: _e.mock.On("ForwardedPortStatus", _a0, _a1)} } -func (_c *ReadClient_ForwardedPortStatus_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID)) *ReadClient_ForwardedPortStatus_Call { +func (_c *ReadClient_ForwardedPortStatus_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID)) *ReadClient_ForwardedPortStatus_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } -func (_c *ReadClient_ForwardedPortStatus_Call) Return(_a0 map[string][]v1beta2.ForwardedPortStatus, _a1 error) *ReadClient_ForwardedPortStatus_Call { +func (_c *ReadClient_ForwardedPortStatus_Call) Return(_a0 map[string][]v1beta3.ForwardedPortStatus, _a1 error) *ReadClient_ForwardedPortStatus_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_ForwardedPortStatus_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) (map[string][]v1beta2.ForwardedPortStatus, error)) *ReadClient_ForwardedPortStatus_Call { +func (_c *ReadClient_ForwardedPortStatus_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) (map[string][]v1beta3.ForwardedPortStatus, error)) *ReadClient_ForwardedPortStatus_Call { _c.Call.Return(run) return _c } // GetDeclaredIPs provides a mock function with given fields: ctx, leaseID -func (_m *ReadClient) GetDeclaredIPs(ctx context.Context, leaseID v1beta3.LeaseID) ([]v2beta2.ProviderLeasedIPSpec, error) { +func (_m *ReadClient) GetDeclaredIPs(ctx context.Context, leaseID marketv1beta3.LeaseID) ([]v2beta2.ProviderLeasedIPSpec, error) { ret := _m.Called(ctx, leaseID) var r0 []v2beta2.ProviderLeasedIPSpec var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) ([]v2beta2.ProviderLeasedIPSpec, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) ([]v2beta2.ProviderLeasedIPSpec, error)); ok { return rf(ctx, leaseID) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) []v2beta2.ProviderLeasedIPSpec); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) []v2beta2.ProviderLeasedIPSpec); ok { r0 = rf(ctx, leaseID) } else { if ret.Get(0) != nil { @@ -152,7 +152,7 @@ func (_m *ReadClient) GetDeclaredIPs(ctx context.Context, leaseID v1beta3.LeaseI } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) error); ok { r1 = rf(ctx, leaseID) } else { r1 = ret.Error(1) @@ -168,14 +168,14 @@ type ReadClient_GetDeclaredIPs_Call struct { // GetDeclaredIPs is a helper method to define mock.On call // - ctx context.Context -// - leaseID v1beta3.LeaseID +// - leaseID marketv1beta3.LeaseID func (_e *ReadClient_Expecter) GetDeclaredIPs(ctx interface{}, leaseID interface{}) *ReadClient_GetDeclaredIPs_Call { return &ReadClient_GetDeclaredIPs_Call{Call: _e.mock.On("GetDeclaredIPs", ctx, leaseID)} } -func (_c *ReadClient_GetDeclaredIPs_Call) Run(run func(ctx context.Context, leaseID v1beta3.LeaseID)) *ReadClient_GetDeclaredIPs_Call { +func (_c *ReadClient_GetDeclaredIPs_Call) Run(run func(ctx context.Context, leaseID marketv1beta3.LeaseID)) *ReadClient_GetDeclaredIPs_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } @@ -185,25 +185,25 @@ func (_c *ReadClient_GetDeclaredIPs_Call) Return(_a0 []v2beta2.ProviderLeasedIPS return _c } -func (_c *ReadClient_GetDeclaredIPs_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) ([]v2beta2.ProviderLeasedIPSpec, error)) *ReadClient_GetDeclaredIPs_Call { +func (_c *ReadClient_GetDeclaredIPs_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) ([]v2beta2.ProviderLeasedIPSpec, error)) *ReadClient_GetDeclaredIPs_Call { _c.Call.Return(run) return _c } // GetHostnameDeploymentConnections provides a mock function with given fields: ctx -func (_m *ReadClient) GetHostnameDeploymentConnections(ctx context.Context) ([]v1beta2.LeaseIDHostnameConnection, error) { +func (_m *ReadClient) GetHostnameDeploymentConnections(ctx context.Context) ([]v1beta3.LeaseIDHostnameConnection, error) { ret := _m.Called(ctx) - var r0 []v1beta2.LeaseIDHostnameConnection + var r0 []v1beta3.LeaseIDHostnameConnection var r1 error - if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta2.LeaseIDHostnameConnection, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) ([]v1beta3.LeaseIDHostnameConnection, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) []v1beta2.LeaseIDHostnameConnection); ok { + if rf, ok := ret.Get(0).(func(context.Context) []v1beta3.LeaseIDHostnameConnection); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]v1beta2.LeaseIDHostnameConnection) + r0 = ret.Get(0).([]v1beta3.LeaseIDHostnameConnection) } } @@ -234,39 +234,39 @@ func (_c *ReadClient_GetHostnameDeploymentConnections_Call) Run(run func(ctx con return _c } -func (_c *ReadClient_GetHostnameDeploymentConnections_Call) Return(_a0 []v1beta2.LeaseIDHostnameConnection, _a1 error) *ReadClient_GetHostnameDeploymentConnections_Call { +func (_c *ReadClient_GetHostnameDeploymentConnections_Call) Return(_a0 []v1beta3.LeaseIDHostnameConnection, _a1 error) *ReadClient_GetHostnameDeploymentConnections_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_GetHostnameDeploymentConnections_Call) RunAndReturn(run func(context.Context) ([]v1beta2.LeaseIDHostnameConnection, error)) *ReadClient_GetHostnameDeploymentConnections_Call { +func (_c *ReadClient_GetHostnameDeploymentConnections_Call) RunAndReturn(run func(context.Context) ([]v1beta3.LeaseIDHostnameConnection, error)) *ReadClient_GetHostnameDeploymentConnections_Call { _c.Call.Return(run) return _c } // GetManifestGroup provides a mock function with given fields: _a0, _a1 -func (_m *ReadClient) GetManifestGroup(_a0 context.Context, _a1 v1beta3.LeaseID) (bool, v2beta2.ManifestGroup, error) { +func (_m *ReadClient) GetManifestGroup(_a0 context.Context, _a1 marketv1beta3.LeaseID) (bool, v2beta2.ManifestGroup, error) { ret := _m.Called(_a0, _a1) var r0 bool var r1 v2beta2.ManifestGroup var r2 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) (bool, v2beta2.ManifestGroup, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) (bool, v2beta2.ManifestGroup, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) bool); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) bool); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) v2beta2.ManifestGroup); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) v2beta2.ManifestGroup); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Get(1).(v2beta2.ManifestGroup) } - if rf, ok := ret.Get(2).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(2).(func(context.Context, marketv1beta3.LeaseID) error); ok { r2 = rf(_a0, _a1) } else { r2 = ret.Error(2) @@ -282,14 +282,14 @@ type ReadClient_GetManifestGroup_Call struct { // GetManifestGroup is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID func (_e *ReadClient_Expecter) GetManifestGroup(_a0 interface{}, _a1 interface{}) *ReadClient_GetManifestGroup_Call { return &ReadClient_GetManifestGroup_Call{Call: _e.mock.On("GetManifestGroup", _a0, _a1)} } -func (_c *ReadClient_GetManifestGroup_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID)) *ReadClient_GetManifestGroup_Call { +func (_c *ReadClient_GetManifestGroup_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID)) *ReadClient_GetManifestGroup_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } @@ -299,29 +299,29 @@ func (_c *ReadClient_GetManifestGroup_Call) Return(_a0 bool, _a1 v2beta2.Manifes return _c } -func (_c *ReadClient_GetManifestGroup_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) (bool, v2beta2.ManifestGroup, error)) *ReadClient_GetManifestGroup_Call { +func (_c *ReadClient_GetManifestGroup_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) (bool, v2beta2.ManifestGroup, error)) *ReadClient_GetManifestGroup_Call { _c.Call.Return(run) return _c } // LeaseEvents provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *ReadClient) LeaseEvents(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool) (v1beta2.EventsWatcher, error) { +func (_m *ReadClient) LeaseEvents(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool) (v1beta3.EventsWatcher, error) { ret := _m.Called(_a0, _a1, _a2, _a3) - var r0 v1beta2.EventsWatcher + var r0 v1beta3.EventsWatcher var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool) (v1beta2.EventsWatcher, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool) (v1beta3.EventsWatcher, error)); ok { return rf(_a0, _a1, _a2, _a3) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool) v1beta2.EventsWatcher); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool) v1beta3.EventsWatcher); ok { r0 = rf(_a0, _a1, _a2, _a3) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.EventsWatcher) + r0 = ret.Get(0).(v1beta3.EventsWatcher) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID, string, bool) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID, string, bool) error); ok { r1 = rf(_a0, _a1, _a2, _a3) } else { r1 = ret.Error(1) @@ -337,48 +337,48 @@ type ReadClient_LeaseEvents_Call struct { // LeaseEvents is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID // - _a2 string // - _a3 bool func (_e *ReadClient_Expecter) LeaseEvents(_a0 interface{}, _a1 interface{}, _a2 interface{}, _a3 interface{}) *ReadClient_LeaseEvents_Call { return &ReadClient_LeaseEvents_Call{Call: _e.mock.On("LeaseEvents", _a0, _a1, _a2, _a3)} } -func (_c *ReadClient_LeaseEvents_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool)) *ReadClient_LeaseEvents_Call { +func (_c *ReadClient_LeaseEvents_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool)) *ReadClient_LeaseEvents_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(bool)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(bool)) }) return _c } -func (_c *ReadClient_LeaseEvents_Call) Return(_a0 v1beta2.EventsWatcher, _a1 error) *ReadClient_LeaseEvents_Call { +func (_c *ReadClient_LeaseEvents_Call) Return(_a0 v1beta3.EventsWatcher, _a1 error) *ReadClient_LeaseEvents_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_LeaseEvents_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, bool) (v1beta2.EventsWatcher, error)) *ReadClient_LeaseEvents_Call { +func (_c *ReadClient_LeaseEvents_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, bool) (v1beta3.EventsWatcher, error)) *ReadClient_LeaseEvents_Call { _c.Call.Return(run) return _c } // LeaseLogs provides a mock function with given fields: _a0, _a1, _a2, _a3, _a4 -func (_m *ReadClient) LeaseLogs(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64) ([]*v1beta2.ServiceLog, error) { +func (_m *ReadClient) LeaseLogs(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64) ([]*v1beta3.ServiceLog, error) { ret := _m.Called(_a0, _a1, _a2, _a3, _a4) - var r0 []*v1beta2.ServiceLog + var r0 []*v1beta3.ServiceLog var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool, *int64) ([]*v1beta2.ServiceLog, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) ([]*v1beta3.ServiceLog, error)); ok { return rf(_a0, _a1, _a2, _a3, _a4) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string, bool, *int64) []*v1beta2.ServiceLog); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) []*v1beta3.ServiceLog); ok { r0 = rf(_a0, _a1, _a2, _a3, _a4) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]*v1beta2.ServiceLog) + r0 = ret.Get(0).([]*v1beta3.ServiceLog) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID, string, bool, *int64) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) error); ok { r1 = rf(_a0, _a1, _a2, _a3, _a4) } else { r1 = ret.Error(1) @@ -394,7 +394,7 @@ type ReadClient_LeaseLogs_Call struct { // LeaseLogs is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID // - _a2 string // - _a3 bool // - _a4 *int64 @@ -402,41 +402,41 @@ func (_e *ReadClient_Expecter) LeaseLogs(_a0 interface{}, _a1 interface{}, _a2 i return &ReadClient_LeaseLogs_Call{Call: _e.mock.On("LeaseLogs", _a0, _a1, _a2, _a3, _a4)} } -func (_c *ReadClient_LeaseLogs_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64)) *ReadClient_LeaseLogs_Call { +func (_c *ReadClient_LeaseLogs_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string, _a3 bool, _a4 *int64)) *ReadClient_LeaseLogs_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string), args[3].(bool), args[4].(*int64)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string), args[3].(bool), args[4].(*int64)) }) return _c } -func (_c *ReadClient_LeaseLogs_Call) Return(_a0 []*v1beta2.ServiceLog, _a1 error) *ReadClient_LeaseLogs_Call { +func (_c *ReadClient_LeaseLogs_Call) Return(_a0 []*v1beta3.ServiceLog, _a1 error) *ReadClient_LeaseLogs_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_LeaseLogs_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string, bool, *int64) ([]*v1beta2.ServiceLog, error)) *ReadClient_LeaseLogs_Call { +func (_c *ReadClient_LeaseLogs_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string, bool, *int64) ([]*v1beta3.ServiceLog, error)) *ReadClient_LeaseLogs_Call { _c.Call.Return(run) return _c } // LeaseStatus provides a mock function with given fields: _a0, _a1 -func (_m *ReadClient) LeaseStatus(_a0 context.Context, _a1 v1beta3.LeaseID) (map[string]*v1beta2.ServiceStatus, error) { +func (_m *ReadClient) LeaseStatus(_a0 context.Context, _a1 marketv1beta3.LeaseID) (map[string]*v1beta3.ServiceStatus, error) { ret := _m.Called(_a0, _a1) - var r0 map[string]*v1beta2.ServiceStatus + var r0 map[string]*v1beta3.ServiceStatus var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) (map[string]*v1beta2.ServiceStatus, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) (map[string]*v1beta3.ServiceStatus, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID) map[string]*v1beta2.ServiceStatus); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID) map[string]*v1beta3.ServiceStatus); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]*v1beta2.ServiceStatus) + r0 = ret.Get(0).(map[string]*v1beta3.ServiceStatus) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -452,42 +452,42 @@ type ReadClient_LeaseStatus_Call struct { // LeaseStatus is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID func (_e *ReadClient_Expecter) LeaseStatus(_a0 interface{}, _a1 interface{}) *ReadClient_LeaseStatus_Call { return &ReadClient_LeaseStatus_Call{Call: _e.mock.On("LeaseStatus", _a0, _a1)} } -func (_c *ReadClient_LeaseStatus_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID)) *ReadClient_LeaseStatus_Call { +func (_c *ReadClient_LeaseStatus_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID)) *ReadClient_LeaseStatus_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID)) }) return _c } -func (_c *ReadClient_LeaseStatus_Call) Return(_a0 map[string]*v1beta2.ServiceStatus, _a1 error) *ReadClient_LeaseStatus_Call { +func (_c *ReadClient_LeaseStatus_Call) Return(_a0 map[string]*v1beta3.ServiceStatus, _a1 error) *ReadClient_LeaseStatus_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_LeaseStatus_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID) (map[string]*v1beta2.ServiceStatus, error)) *ReadClient_LeaseStatus_Call { +func (_c *ReadClient_LeaseStatus_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID) (map[string]*v1beta3.ServiceStatus, error)) *ReadClient_LeaseStatus_Call { _c.Call.Return(run) return _c } // ObserveHostnameState provides a mock function with given fields: ctx -func (_m *ReadClient) ObserveHostnameState(ctx context.Context) (<-chan v1beta2.HostnameResourceEvent, error) { +func (_m *ReadClient) ObserveHostnameState(ctx context.Context) (<-chan v1beta3.HostnameResourceEvent, error) { ret := _m.Called(ctx) - var r0 <-chan v1beta2.HostnameResourceEvent + var r0 <-chan v1beta3.HostnameResourceEvent var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta2.HostnameResourceEvent, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta3.HostnameResourceEvent, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta2.HostnameResourceEvent); ok { + if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta3.HostnameResourceEvent); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(<-chan v1beta2.HostnameResourceEvent) + r0 = ret.Get(0).(<-chan v1beta3.HostnameResourceEvent) } } @@ -518,30 +518,30 @@ func (_c *ReadClient_ObserveHostnameState_Call) Run(run func(ctx context.Context return _c } -func (_c *ReadClient_ObserveHostnameState_Call) Return(_a0 <-chan v1beta2.HostnameResourceEvent, _a1 error) *ReadClient_ObserveHostnameState_Call { +func (_c *ReadClient_ObserveHostnameState_Call) Return(_a0 <-chan v1beta3.HostnameResourceEvent, _a1 error) *ReadClient_ObserveHostnameState_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_ObserveHostnameState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta2.HostnameResourceEvent, error)) *ReadClient_ObserveHostnameState_Call { +func (_c *ReadClient_ObserveHostnameState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta3.HostnameResourceEvent, error)) *ReadClient_ObserveHostnameState_Call { _c.Call.Return(run) return _c } // ObserveIPState provides a mock function with given fields: ctx -func (_m *ReadClient) ObserveIPState(ctx context.Context) (<-chan v1beta2.IPResourceEvent, error) { +func (_m *ReadClient) ObserveIPState(ctx context.Context) (<-chan v1beta3.IPResourceEvent, error) { ret := _m.Called(ctx) - var r0 <-chan v1beta2.IPResourceEvent + var r0 <-chan v1beta3.IPResourceEvent var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta2.IPResourceEvent, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (<-chan v1beta3.IPResourceEvent, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta2.IPResourceEvent); ok { + if rf, ok := ret.Get(0).(func(context.Context) <-chan v1beta3.IPResourceEvent); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(<-chan v1beta2.IPResourceEvent) + r0 = ret.Get(0).(<-chan v1beta3.IPResourceEvent) } } @@ -572,34 +572,34 @@ func (_c *ReadClient_ObserveIPState_Call) Run(run func(ctx context.Context)) *Re return _c } -func (_c *ReadClient_ObserveIPState_Call) Return(_a0 <-chan v1beta2.IPResourceEvent, _a1 error) *ReadClient_ObserveIPState_Call { +func (_c *ReadClient_ObserveIPState_Call) Return(_a0 <-chan v1beta3.IPResourceEvent, _a1 error) *ReadClient_ObserveIPState_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_ObserveIPState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta2.IPResourceEvent, error)) *ReadClient_ObserveIPState_Call { +func (_c *ReadClient_ObserveIPState_Call) RunAndReturn(run func(context.Context) (<-chan v1beta3.IPResourceEvent, error)) *ReadClient_ObserveIPState_Call { _c.Call.Return(run) return _c } // ServiceStatus provides a mock function with given fields: _a0, _a1, _a2 -func (_m *ReadClient) ServiceStatus(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string) (*v1beta2.ServiceStatus, error) { +func (_m *ReadClient) ServiceStatus(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string) (*v1beta3.ServiceStatus, error) { ret := _m.Called(_a0, _a1, _a2) - var r0 *v1beta2.ServiceStatus + var r0 *v1beta3.ServiceStatus var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string) (*v1beta2.ServiceStatus, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string) (*v1beta3.ServiceStatus, error)); ok { return rf(_a0, _a1, _a2) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.LeaseID, string) *v1beta2.ServiceStatus); ok { + if rf, ok := ret.Get(0).(func(context.Context, marketv1beta3.LeaseID, string) *v1beta3.ServiceStatus); ok { r0 = rf(_a0, _a1, _a2) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1beta2.ServiceStatus) + r0 = ret.Get(0).(*v1beta3.ServiceStatus) } } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.LeaseID, string) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, marketv1beta3.LeaseID, string) error); ok { r1 = rf(_a0, _a1, _a2) } else { r1 = ret.Error(1) @@ -615,25 +615,25 @@ type ReadClient_ServiceStatus_Call struct { // ServiceStatus is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.LeaseID +// - _a1 marketv1beta3.LeaseID // - _a2 string func (_e *ReadClient_Expecter) ServiceStatus(_a0 interface{}, _a1 interface{}, _a2 interface{}) *ReadClient_ServiceStatus_Call { return &ReadClient_ServiceStatus_Call{Call: _e.mock.On("ServiceStatus", _a0, _a1, _a2)} } -func (_c *ReadClient_ServiceStatus_Call) Run(run func(_a0 context.Context, _a1 v1beta3.LeaseID, _a2 string)) *ReadClient_ServiceStatus_Call { +func (_c *ReadClient_ServiceStatus_Call) Run(run func(_a0 context.Context, _a1 marketv1beta3.LeaseID, _a2 string)) *ReadClient_ServiceStatus_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.LeaseID), args[2].(string)) + run(args[0].(context.Context), args[1].(marketv1beta3.LeaseID), args[2].(string)) }) return _c } -func (_c *ReadClient_ServiceStatus_Call) Return(_a0 *v1beta2.ServiceStatus, _a1 error) *ReadClient_ServiceStatus_Call { +func (_c *ReadClient_ServiceStatus_Call) Return(_a0 *v1beta3.ServiceStatus, _a1 error) *ReadClient_ServiceStatus_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *ReadClient_ServiceStatus_Call) RunAndReturn(run func(context.Context, v1beta3.LeaseID, string) (*v1beta2.ServiceStatus, error)) *ReadClient_ServiceStatus_Call { +func (_c *ReadClient_ServiceStatus_Call) RunAndReturn(run func(context.Context, marketv1beta3.LeaseID, string) (*v1beta3.ServiceStatus, error)) *ReadClient_ServiceStatus_Call { _c.Call.Return(run) return _c } diff --git a/cluster/mocks/reservation.go b/cluster/mocks/reservation.go index da8594a4e..3cad23ee7 100644 --- a/cluster/mocks/reservation.go +++ b/cluster/mocks/reservation.go @@ -1,12 +1,12 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks import ( - typesv1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" + marketv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" mock "github.com/stretchr/testify/mock" - v1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" + typesv1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" ) // Reservation is an autogenerated mock type for the Reservation type @@ -64,14 +64,14 @@ func (_c *Reservation_Allocated_Call) RunAndReturn(run func() bool) *Reservation } // OrderID provides a mock function with given fields: -func (_m *Reservation) OrderID() v1beta3.OrderID { +func (_m *Reservation) OrderID() marketv1beta3.OrderID { ret := _m.Called() - var r0 v1beta3.OrderID - if rf, ok := ret.Get(0).(func() v1beta3.OrderID); ok { + var r0 marketv1beta3.OrderID + if rf, ok := ret.Get(0).(func() marketv1beta3.OrderID); ok { r0 = rf() } else { - r0 = ret.Get(0).(v1beta3.OrderID) + r0 = ret.Get(0).(marketv1beta3.OrderID) } return r0 @@ -94,12 +94,12 @@ func (_c *Reservation_OrderID_Call) Run(run func()) *Reservation_OrderID_Call { return _c } -func (_c *Reservation_OrderID_Call) Return(_a0 v1beta3.OrderID) *Reservation_OrderID_Call { +func (_c *Reservation_OrderID_Call) Return(_a0 marketv1beta3.OrderID) *Reservation_OrderID_Call { _c.Call.Return(_a0) return _c } -func (_c *Reservation_OrderID_Call) RunAndReturn(run func() v1beta3.OrderID) *Reservation_OrderID_Call { +func (_c *Reservation_OrderID_Call) RunAndReturn(run func() marketv1beta3.OrderID) *Reservation_OrderID_Call { _c.Call.Return(run) return _c } diff --git a/cluster/mocks/service.go b/cluster/mocks/service.go index 3e7bdcd67..2098c8e74 100644 --- a/cluster/mocks/service.go +++ b/cluster/mocks/service.go @@ -1,16 +1,16 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks import ( context "context" - types "github.com/cosmos/cosmos-sdk/types" + nodetypesv1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" mock "github.com/stretchr/testify/mock" - typesv1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" + types "github.com/cosmos/cosmos-sdk/types" - v1beta2 "github.com/akash-network/provider/cluster/types/v1beta3" + typesv1beta3 "github.com/akash-network/provider/cluster/types/v1beta3" v1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" @@ -184,15 +184,15 @@ func (_c *Service_FindActiveLease_Call) RunAndReturn(run func(context.Context, t } // HostnameService provides a mock function with given fields: -func (_m *Service) HostnameService() v1beta2.HostnameServiceClient { +func (_m *Service) HostnameService() typesv1beta3.HostnameServiceClient { ret := _m.Called() - var r0 v1beta2.HostnameServiceClient - if rf, ok := ret.Get(0).(func() v1beta2.HostnameServiceClient); ok { + var r0 typesv1beta3.HostnameServiceClient + if rf, ok := ret.Get(0).(func() typesv1beta3.HostnameServiceClient); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.HostnameServiceClient) + r0 = ret.Get(0).(typesv1beta3.HostnameServiceClient) } } @@ -216,12 +216,12 @@ func (_c *Service_HostnameService_Call) Run(run func()) *Service_HostnameService return _c } -func (_c *Service_HostnameService_Call) Return(_a0 v1beta2.HostnameServiceClient) *Service_HostnameService_Call { +func (_c *Service_HostnameService_Call) Return(_a0 typesv1beta3.HostnameServiceClient) *Service_HostnameService_Call { _c.Call.Return(_a0) return _c } -func (_c *Service_HostnameService_Call) RunAndReturn(run func() v1beta2.HostnameServiceClient) *Service_HostnameService_Call { +func (_c *Service_HostnameService_Call) RunAndReturn(run func() typesv1beta3.HostnameServiceClient) *Service_HostnameService_Call { _c.Call.Return(run) return _c } @@ -270,23 +270,23 @@ func (_c *Service_Ready_Call) RunAndReturn(run func() <-chan struct{}) *Service_ } // Reserve provides a mock function with given fields: _a0, _a1 -func (_m *Service) Reserve(_a0 v1beta3.OrderID, _a1 typesv1beta3.ResourceGroup) (v1beta2.Reservation, error) { +func (_m *Service) Reserve(_a0 v1beta3.OrderID, _a1 nodetypesv1beta3.ResourceGroup) (typesv1beta3.Reservation, error) { ret := _m.Called(_a0, _a1) - var r0 v1beta2.Reservation + var r0 typesv1beta3.Reservation var r1 error - if rf, ok := ret.Get(0).(func(v1beta3.OrderID, typesv1beta3.ResourceGroup) (v1beta2.Reservation, error)); ok { + if rf, ok := ret.Get(0).(func(v1beta3.OrderID, nodetypesv1beta3.ResourceGroup) (typesv1beta3.Reservation, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(v1beta3.OrderID, typesv1beta3.ResourceGroup) v1beta2.Reservation); ok { + if rf, ok := ret.Get(0).(func(v1beta3.OrderID, nodetypesv1beta3.ResourceGroup) typesv1beta3.Reservation); ok { r0 = rf(_a0, _a1) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.Reservation) + r0 = ret.Get(0).(typesv1beta3.Reservation) } } - if rf, ok := ret.Get(1).(func(v1beta3.OrderID, typesv1beta3.ResourceGroup) error); ok { + if rf, ok := ret.Get(1).(func(v1beta3.OrderID, nodetypesv1beta3.ResourceGroup) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -302,42 +302,42 @@ type Service_Reserve_Call struct { // Reserve is a helper method to define mock.On call // - _a0 v1beta3.OrderID -// - _a1 typesv1beta3.ResourceGroup +// - _a1 nodetypesv1beta3.ResourceGroup func (_e *Service_Expecter) Reserve(_a0 interface{}, _a1 interface{}) *Service_Reserve_Call { return &Service_Reserve_Call{Call: _e.mock.On("Reserve", _a0, _a1)} } -func (_c *Service_Reserve_Call) Run(run func(_a0 v1beta3.OrderID, _a1 typesv1beta3.ResourceGroup)) *Service_Reserve_Call { +func (_c *Service_Reserve_Call) Run(run func(_a0 v1beta3.OrderID, _a1 nodetypesv1beta3.ResourceGroup)) *Service_Reserve_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(v1beta3.OrderID), args[1].(typesv1beta3.ResourceGroup)) + run(args[0].(v1beta3.OrderID), args[1].(nodetypesv1beta3.ResourceGroup)) }) return _c } -func (_c *Service_Reserve_Call) Return(_a0 v1beta2.Reservation, _a1 error) *Service_Reserve_Call { +func (_c *Service_Reserve_Call) Return(_a0 typesv1beta3.Reservation, _a1 error) *Service_Reserve_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Service_Reserve_Call) RunAndReturn(run func(v1beta3.OrderID, typesv1beta3.ResourceGroup) (v1beta2.Reservation, error)) *Service_Reserve_Call { +func (_c *Service_Reserve_Call) RunAndReturn(run func(v1beta3.OrderID, nodetypesv1beta3.ResourceGroup) (typesv1beta3.Reservation, error)) *Service_Reserve_Call { _c.Call.Return(run) return _c } // Status provides a mock function with given fields: _a0 -func (_m *Service) Status(_a0 context.Context) (*v1beta2.Status, error) { +func (_m *Service) Status(_a0 context.Context) (*typesv1beta3.Status, error) { ret := _m.Called(_a0) - var r0 *v1beta2.Status + var r0 *typesv1beta3.Status var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*v1beta2.Status, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (*typesv1beta3.Status, error)); ok { return rf(_a0) } - if rf, ok := ret.Get(0).(func(context.Context) *v1beta2.Status); ok { + if rf, ok := ret.Get(0).(func(context.Context) *typesv1beta3.Status); ok { r0 = rf(_a0) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1beta2.Status) + r0 = ret.Get(0).(*typesv1beta3.Status) } } @@ -368,12 +368,12 @@ func (_c *Service_Status_Call) Run(run func(_a0 context.Context)) *Service_Statu return _c } -func (_c *Service_Status_Call) Return(_a0 *v1beta2.Status, _a1 error) *Service_Status_Call { +func (_c *Service_Status_Call) Return(_a0 *typesv1beta3.Status, _a1 error) *Service_Status_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *Service_Status_Call) RunAndReturn(run func(context.Context) (*v1beta2.Status, error)) *Service_Status_Call { +func (_c *Service_Status_Call) RunAndReturn(run func(context.Context) (*typesv1beta3.Status, error)) *Service_Status_Call { _c.Call.Return(run) return _c } diff --git a/cluster/monitor_test.go b/cluster/monitor_test.go index e8d0d3a36..181652af3 100644 --- a/cluster/monitor_test.go +++ b/cluster/monitor_test.go @@ -52,7 +52,7 @@ func TestMonitorSendsClusterDeploymentPending(t *testing.T) { lid := testutil.LeaseID(t) group := &manifest.Group{} - group.Services = make([]manifest.Service, 1) + group.Services = make(manifest.Services, 1) group.Services[0].Name = serviceName group.Services[0].Expose = make([]manifest.ServiceExpose, 1) group.Services[0].Expose[0].ExternalPort = 2000 @@ -94,7 +94,7 @@ func TestMonitorSendsClusterDeploymentDeployed(t *testing.T) { lid := testutil.LeaseID(t) group := &manifest.Group{} - group.Services = make([]manifest.Service, 1) + group.Services = make(manifest.Services, 1) group.Services[0].Name = serviceName group.Services[0].Expose = make([]manifest.ServiceExpose, 1) group.Services[0].Expose[0].ExternalPort = 2000 diff --git a/cluster/types/v1beta2/types.go b/cluster/types/v1beta2/types.go index 5860c2361..c57e1e79a 100644 --- a/cluster/types/v1beta2/types.go +++ b/cluster/types/v1beta2/types.go @@ -5,12 +5,13 @@ import ( "context" "io" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" - eventsv1 "k8s.io/api/events/v1" + sdk "github.com/cosmos/cosmos-sdk/types" + manifest "github.com/akash-network/akash-api/go/manifest/v2beta1" + maniv2beta1 "github.com/akash-network/akash-api/go/manifest/v2beta1" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2" types "github.com/akash-network/akash-api/go/node/types/v1beta2" @@ -57,6 +58,15 @@ type InventoryNodeMetric struct { StorageEphemeral uint64 `json:"storage_ephemeral"` } +type Service struct { + maniv2beta1.Service `json:",inline"` +} + +type Group struct { + Name string + Services []Service +} + func (inv *InventoryMetricTotal) AddResources(res types.Resources) { cpu := sdk.NewIntFromUint64(inv.CPU) mem := sdk.NewIntFromUint64(inv.Memory) @@ -133,7 +143,7 @@ type Inventory interface { // Deployment interface defined with LeaseID and ManifestGroup methods type Deployment interface { LeaseID() mtypes.LeaseID - ManifestGroup() manifest.Group + ManifestGroup() Group } // ServiceLog stores name, stream and scanner diff --git a/cluster/types/v1beta3/deployment.go b/cluster/types/v1beta3/deployment.go new file mode 100644 index 000000000..59a836780 --- /dev/null +++ b/cluster/types/v1beta3/deployment.go @@ -0,0 +1,90 @@ +package v1beta3 + +import ( + maniv2beta2 "github.com/akash-network/akash-api/go/manifest/v2beta2" + mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" +) + +// Deployment interface defined with LeaseID and ManifestGroup methods +// +//go:generate mockery --name Deployment --output ../../mocks +type Deployment interface { + LeaseID() mtypes.LeaseID + ManifestGroup() maniv2beta2.Group +} + +// // ParamsLease provider specific parameters required by deployment for correct operation +// type LeaseServiceParams struct { +// RuntimeClass string `json:"runtime_class"` +// } + +// // Service extends manifest service with provider specific parameters +// type Service struct { +// maniv2beta2.Service `json:",inline"` +// ProviderParams ServiceProviderParams `json:"provider_params"` +// } +// +// type Services []Service +// +// type Group struct { +// Name string +// Services Services +// } +// +// type PGroup interface { +// maniv2beta2.IGroup +// ProviderGroup() *Group +// } +// +// var _ types.ResourceGroup = (*Group)(nil) +// var _ PGroup = (*Group)(nil) +// +// // GetName returns the name of group +// func (g Group) GetName() string { +// return g.Name +// } +// +// // GetResources returns list of resources in a group +// func (g Group) GetResources() []types.Resources { +// resources := make([]types.Resources, 0, len(g.Services)) +// for _, s := range g.Services { +// resources = append(resources, types.Resources{ +// Resources: s.Resources, +// Count: s.Count, +// }) +// } +// +// return resources +// } +// +// func (g Group) ProviderGroup() *Group { +// return &g +// } +// +// func (g Group) ManifestGroup() *maniv2beta2.Group { +// mgroup := &maniv2beta2.Group{ +// Name: g.Name, +// Services: make(maniv2beta2.Services, 0, len(g.Services)), +// } +// +// for _, svc := range g.Services { +// mgroup.Services = append(mgroup.Services, svc.Service) +// } +// +// return mgroup +// } +// +// func ProviderGroupFromManifest(mani *maniv2beta2.Group) *Group { +// g := &Group{ +// Name: mani.Name, +// Services: make(Services, 0, len(mani.Services)), +// } +// +// for _, svc := range mani.Services { +// g.Services = append(g.Services, Service{ +// Service: svc, +// }) +// } +// +// return g +// } diff --git a/cluster/types/v1beta3/directives.go b/cluster/types/v1beta3/directives.go index 4e5856122..2bef3d1a1 100644 --- a/cluster/types/v1beta3/directives.go +++ b/cluster/types/v1beta3/directives.go @@ -1,4 +1,4 @@ -package v1beta2 +package v1beta3 import ( manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" diff --git a/cluster/types/v1beta3/hostname.go b/cluster/types/v1beta3/hostname.go index 1e0fe416e..bc9ec27b6 100644 --- a/cluster/types/v1beta3/hostname.go +++ b/cluster/types/v1beta3/hostname.go @@ -1,4 +1,4 @@ -package v1beta2 +package v1beta3 import ( mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" diff --git a/cluster/types/v1beta3/interfaces.go b/cluster/types/v1beta3/interfaces.go index 11c6a912f..07c979249 100644 --- a/cluster/types/v1beta3/interfaces.go +++ b/cluster/types/v1beta3/interfaces.go @@ -1,10 +1,11 @@ -package v1beta2 +package v1beta3 import ( "context" sdktypes "github.com/cosmos/cosmos-sdk/types" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" ) @@ -15,3 +16,7 @@ type HostnameServiceClient interface { CanReserveHostnames(hostnames []string, ownerAddr sdktypes.Address) error PrepareHostnamesForTransfer(ctx context.Context, hostnames []string, leaseID mtypes.LeaseID) error } + +type MGroup interface { + ManifestGroup() mani.Group +} diff --git a/cluster/types/v1beta3/ip.go b/cluster/types/v1beta3/ip.go index 0c0d95d04..376b402c5 100644 --- a/cluster/types/v1beta3/ip.go +++ b/cluster/types/v1beta3/ip.go @@ -1,4 +1,4 @@ -package v1beta2 +package v1beta3 import ( manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" diff --git a/cluster/types/v1beta3/reservation.go b/cluster/types/v1beta3/reservation.go index 95df207fa..bc8eb2ad6 100644 --- a/cluster/types/v1beta3/reservation.go +++ b/cluster/types/v1beta3/reservation.go @@ -1,4 +1,4 @@ -package v1beta2 +package v1beta3 import ( mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" diff --git a/cluster/types/v1beta3/types.go b/cluster/types/v1beta3/types.go index 948927833..2fbabf04e 100644 --- a/cluster/types/v1beta3/types.go +++ b/cluster/types/v1beta3/types.go @@ -1,4 +1,4 @@ -package v1beta2 +package v1beta3 import ( "bufio" @@ -13,7 +13,6 @@ import ( "github.com/akash-network/node/sdl" manifest "github.com/akash-network/akash-api/go/manifest/v2beta2" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" types "github.com/akash-network/akash-api/go/node/types/v1beta3" ) @@ -138,14 +137,6 @@ type Inventory interface { Metrics() InventoryMetrics } -// Deployment interface defined with LeaseID and ManifestGroup methods -// -//go:generate mockery --name Deployment --output ../../mocks -type Deployment interface { - LeaseID() mtypes.LeaseID - ManifestGroup() manifest.Group -} - // ServiceLog stores name, stream and scanner type ServiceLog struct { Name string diff --git a/event/events.go b/event/events.go index 47564eb5e..93c2c53a2 100644 --- a/event/events.go +++ b/event/events.go @@ -3,7 +3,7 @@ package event import ( sdk "github.com/cosmos/cosmos-sdk/types" - maniv2beta1 "github.com/akash-network/akash-api/go/manifest/v2beta2" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" ) @@ -19,13 +19,13 @@ type LeaseWon struct { // to be provisioned by the Provider. type ManifestReceived struct { LeaseID mtypes.LeaseID - Manifest *maniv2beta1.Manifest + Manifest *mani.Manifest Deployment *dtypes.QueryDeploymentResponse Group *dtypes.Group } // ManifestGroup returns group if present in manifest or nil -func (ev ManifestReceived) ManifestGroup() *maniv2beta1.Group { +func (ev ManifestReceived) ManifestGroup() *mani.Group { for _, mgroup := range *ev.Manifest { if mgroup.Name == ev.Group.GroupSpec.Name { mgroup := mgroup @@ -50,7 +50,7 @@ const ( // ClusterDeployment stores leaseID, group details and deployment status type ClusterDeployment struct { LeaseID mtypes.LeaseID - Group *maniv2beta1.Group + Group *mani.Group Status ClusterDeploymentStatus } diff --git a/gateway/rest/integration_test.go b/gateway/rest/integration_test.go index 51c05019a..52d842a52 100644 --- a/gateway/rest/integration_test.go +++ b/gateway/rest/integration_test.go @@ -161,7 +161,7 @@ func mockManifestGroups(m integrationMocks, leaseID mtypes.LeaseID) { Resources: v2beta2.ResourceUnits{ CPU: 1000, Memory: "3333", - Storage: []v2beta2.ManifestServiceStorage{{ + Storage: []v2beta2.ResourceUnitsStorage{{ Name: "", Size: "4444", }}, diff --git a/gateway/rest/router_test.go b/gateway/rest/router_test.go index 45fdac2c3..d6eee817d 100644 --- a/gateway/rest/router_test.go +++ b/gateway/rest/router_test.go @@ -604,7 +604,7 @@ func mockManifestGroupsForRouterTest(rt *routerTest, leaseID mtypes.LeaseID) { Resources: v2beta2.ResourceUnits{ CPU: 1000, Memory: "3333", - Storage: []v2beta2.ManifestServiceStorage{{ + Storage: []v2beta2.ResourceUnitsStorage{{ Name: "", Size: "4444", }}, diff --git a/go.mod b/go.mod index 21f730526..c35004437 100644 --- a/go.mod +++ b/go.mod @@ -57,8 +57,6 @@ replace ( github.com/zondax/hid => github.com/troian/hid v0.13.2 github.com/zondax/ledger-go => github.com/akash-network/ledger-go v0.14.3 - -//google.golang.org/grpc => google.golang.org/grpc v1.33.2 ) require ( diff --git a/make/codegen.mk b/make/codegen.mk index dc34b7d82..3c49f7de9 100644 --- a/make/codegen.mk +++ b/make/codegen.mk @@ -1,26 +1,7 @@ .PHONY: generate -generate: $(MOCKERY) +generate: modvendor $(MOCKERY) $(GO) generate ./... -#$(MOCKERY) --srcpkg vendor/k8s.io/client-go/kubernetes --output testutil/kubernetes_mock --all --recursive --outpkg kubernetes_mocks - -.PHONY: mocks -mocks: $(MOCKERY) modvendor - #$(MOCKERY) --case=underscore --dir vendor/k8s.io/client-go/kubernetes --output testutil/kubernetes_mock --all --recursive --outpkg kubernetes_mocks --keeptree - #$(MOCKERY) --case=underscore --dir . --output mocks --name StatusClient - #$(MOCKERY) --case=underscore --dir . --output mocks --name Client - #$(MOCKERY) --case=underscore --dir cluster --output cluster/mocks --name Client - #$(MOCKERY) --case=underscore --dir cluster --output cluster/mocks --name ReadClient -# $(MOCKERY) --case=underscore --dir cluster --output cluster/mocks --name Cluster -# $(MOCKERY) --case=underscore --dir cluster --output cluster/mocks --name Service - #$(MOCKERY) --case=underscore --dir cluster/kube/metallb --output cluster/mocks --name Client --structname MetalLBClient --filename metallb_client.go - #$(MOCKERY) --case=underscore --dir cluster/operatorclients --output cluster/mocks --name IPOperatorClient - #$(MOCKERY) --case=underscore --dir cluster/types/v1beta3 --output cluster/mocks --name Deployment -# $(MOCKERY) --case=underscore --dir cluster/types/v1beta3 --output cluster/mocks --name HostnameServiceClient - #$(MOCKERY) --case=underscore --dir cluster/types/v1beta3 --output cluster/mocks --name Reservation - #$(MOCKERY) --case=underscore --dir manifest --output manifest/mocks --name Client - #$(MOCKERY) --case=underscore --dir manifest --output manifest/mocks --name StatusClient - .PHONY: kubetypes kubetypes: $(K8S_GENERATE_GROUPS) GOBIN=$(AP_DEVCACHE_BIN) $(K8S_GENERATE_GROUPS) all \ diff --git a/make/init.mk b/make/init.mk index 9f8e5dfd5..26906432b 100644 --- a/make/init.mk +++ b/make/init.mk @@ -57,7 +57,7 @@ GOLANG_VERSION ?= 1.16.1 STATIK_VERSION ?= v0.1.7 GIT_CHGLOG_VERSION ?= v0.15.1 MODVENDOR_VERSION ?= v0.3.0 -MOCKERY_VERSION ?= 2.23.1 +MOCKERY_VERSION ?= 2.24.0 K8S_CODE_GEN_VERSION ?= $(shell $(GO) list -mod=readonly -m -f '{{ .Version }}' k8s.io/code-generator) ifeq (0, $(shell which kind &>/dev/null; echo $$?)) diff --git a/make/test-integration.mk b/make/test-integration.mk index aa2a0cc65..4622f3fa8 100644 --- a/make/test-integration.mk +++ b/make/test-integration.mk @@ -16,7 +16,7 @@ INTEGRATION_VARS := TEST_INTEGRATION=true test-e2e-integration: # Assumes cluster created and configured: # ``` - # KUSTOMIZE_INSTALLS=akash-operator-inventory make kind-cluster-setup-e2e + # KUSTOMIZE_INSTALLS=akash-operator-inventory make kube-cluster-setup-e2e # ``` $(KIND_VARS) $(INTEGRATION_VARS) go test -count=1 -mod=readonly -p 4 -tags "e2e" -v ./integration/... -run TestIntegrationTestSuite -timeout 1500s @@ -32,7 +32,7 @@ test-query-app: test-k8s-integration: # Assumes cluster created and configured: # ``` - # KUSTOMIZE_INSTALLS=akash-operator-inventory make kind-cluster-setup-e2e + # KUSTOMIZE_INSTALLS=akash-operator-inventory make kube-cluster-setup-e2e # ``` go test -count=1 -v -tags "$(BUILD_TAGS_K8S_INTEGRATION)" ./pkg/apis/akash.network/v2beta2 go test -count=1 -v -tags "$(BUILD_TAGS_K8S_INTEGRATION)" ./cluster/kube diff --git a/manifest/mocks/client.go b/manifest/mocks/client.go index 4fc4d140f..079730965 100644 --- a/manifest/mocks/client.go +++ b/manifest/mocks/client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks diff --git a/manifest/mocks/status_client.go b/manifest/mocks/status_client.go index 970640d3e..6b1ef1464 100644 --- a/manifest/mocks/status_client.go +++ b/manifest/mocks/status_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks diff --git a/mocks/client.go b/mocks/client.go index 7247a5d97..f37c4fb67 100644 --- a/mocks/client.go +++ b/mocks/client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks @@ -7,15 +7,15 @@ import ( cluster "github.com/akash-network/provider/cluster" + deploymentv1beta3 "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + manifest "github.com/akash-network/provider/manifest" mock "github.com/stretchr/testify/mock" provider "github.com/akash-network/provider" - v1beta2 "github.com/akash-network/provider/cluster/types/v1beta3" - - v1beta3 "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + v1beta3 "github.com/akash-network/provider/cluster/types/v1beta3" ) // Client is an autogenerated mock type for the Client type @@ -118,15 +118,15 @@ func (_c *Client_ClusterService_Call) RunAndReturn(run func() cluster.Service) * } // Hostname provides a mock function with given fields: -func (_m *Client) Hostname() v1beta2.HostnameServiceClient { +func (_m *Client) Hostname() v1beta3.HostnameServiceClient { ret := _m.Called() - var r0 v1beta2.HostnameServiceClient - if rf, ok := ret.Get(0).(func() v1beta2.HostnameServiceClient); ok { + var r0 v1beta3.HostnameServiceClient + if rf, ok := ret.Get(0).(func() v1beta3.HostnameServiceClient); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(v1beta2.HostnameServiceClient) + r0 = ret.Get(0).(v1beta3.HostnameServiceClient) } } @@ -150,12 +150,12 @@ func (_c *Client_Hostname_Call) Run(run func()) *Client_Hostname_Call { return _c } -func (_c *Client_Hostname_Call) Return(_a0 v1beta2.HostnameServiceClient) *Client_Hostname_Call { +func (_c *Client_Hostname_Call) Return(_a0 v1beta3.HostnameServiceClient) *Client_Hostname_Call { _c.Call.Return(_a0) return _c } -func (_c *Client_Hostname_Call) RunAndReturn(run func() v1beta2.HostnameServiceClient) *Client_Hostname_Call { +func (_c *Client_Hostname_Call) RunAndReturn(run func() v1beta3.HostnameServiceClient) *Client_Hostname_Call { _c.Call.Return(run) return _c } @@ -258,21 +258,21 @@ func (_c *Client_Status_Call) RunAndReturn(run func(context.Context) (*provider. } // Validate provides a mock function with given fields: _a0, _a1 -func (_m *Client) Validate(_a0 context.Context, _a1 v1beta3.GroupSpec) (provider.ValidateGroupSpecResult, error) { +func (_m *Client) Validate(_a0 context.Context, _a1 deploymentv1beta3.GroupSpec) (provider.ValidateGroupSpecResult, error) { ret := _m.Called(_a0, _a1) var r0 provider.ValidateGroupSpecResult var r1 error - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.GroupSpec) (provider.ValidateGroupSpecResult, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, deploymentv1beta3.GroupSpec) (provider.ValidateGroupSpecResult, error)); ok { return rf(_a0, _a1) } - if rf, ok := ret.Get(0).(func(context.Context, v1beta3.GroupSpec) provider.ValidateGroupSpecResult); ok { + if rf, ok := ret.Get(0).(func(context.Context, deploymentv1beta3.GroupSpec) provider.ValidateGroupSpecResult); ok { r0 = rf(_a0, _a1) } else { r0 = ret.Get(0).(provider.ValidateGroupSpecResult) } - if rf, ok := ret.Get(1).(func(context.Context, v1beta3.GroupSpec) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, deploymentv1beta3.GroupSpec) error); ok { r1 = rf(_a0, _a1) } else { r1 = ret.Error(1) @@ -288,14 +288,14 @@ type Client_Validate_Call struct { // Validate is a helper method to define mock.On call // - _a0 context.Context -// - _a1 v1beta3.GroupSpec +// - _a1 deploymentv1beta3.GroupSpec func (_e *Client_Expecter) Validate(_a0 interface{}, _a1 interface{}) *Client_Validate_Call { return &Client_Validate_Call{Call: _e.mock.On("Validate", _a0, _a1)} } -func (_c *Client_Validate_Call) Run(run func(_a0 context.Context, _a1 v1beta3.GroupSpec)) *Client_Validate_Call { +func (_c *Client_Validate_Call) Run(run func(_a0 context.Context, _a1 deploymentv1beta3.GroupSpec)) *Client_Validate_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(v1beta3.GroupSpec)) + run(args[0].(context.Context), args[1].(deploymentv1beta3.GroupSpec)) }) return _c } @@ -305,7 +305,7 @@ func (_c *Client_Validate_Call) Return(_a0 provider.ValidateGroupSpecResult, _a1 return _c } -func (_c *Client_Validate_Call) RunAndReturn(run func(context.Context, v1beta3.GroupSpec) (provider.ValidateGroupSpecResult, error)) *Client_Validate_Call { +func (_c *Client_Validate_Call) RunAndReturn(run func(context.Context, deploymentv1beta3.GroupSpec) (provider.ValidateGroupSpecResult, error)) *Client_Validate_Call { _c.Call.Return(run) return _c } diff --git a/mocks/status_client.go b/mocks/status_client.go index 10d3efdd6..5d8e7cd49 100644 --- a/mocks/status_client.go +++ b/mocks/status_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.23.1. DO NOT EDIT. +// Code generated by mockery v2.24.0. DO NOT EDIT. package mocks diff --git a/operator/ipoperator/ip_operator.go b/operator/ipoperator/ip_operator.go index 68ecdd656..eee9674ec 100644 --- a/operator/ipoperator/ip_operator.go +++ b/operator/ipoperator/ip_operator.go @@ -27,7 +27,6 @@ import ( "github.com/akash-network/provider/cluster" clusterClient "github.com/akash-network/provider/cluster/kube" "github.com/akash-network/provider/cluster/kube/metallb" - "github.com/akash-network/provider/cluster/types/v1beta3" ctypes "github.com/akash-network/provider/cluster/types/v1beta3" clusterutil "github.com/akash-network/provider/cluster/util" providerflags "github.com/akash-network/provider/cmd/provider-services/cmd/flags" @@ -211,7 +210,7 @@ func (op *ipOperator) updateCounts(parentCtx context.Context) error { return nil } -func (op *ipOperator) recordEventError(ev v1beta2.IPResourceEvent, failure error) { +func (op *ipOperator) recordEventError(ev ctypes.IPResourceEvent, failure error) { // ff no error, no action if failure == nil { return @@ -228,11 +227,11 @@ func (op *ipOperator) recordEventError(ev v1beta2.IPResourceEvent, failure error op.flagIgnoredLeases() } -func (op *ipOperator) applyEvent(ctx context.Context, ev v1beta2.IPResourceEvent) error { +func (op *ipOperator) applyEvent(ctx context.Context, ev ctypes.IPResourceEvent) error { op.log.Debug("apply event", "event-type", ev.GetEventType(), "lease", ev.GetLeaseID()) switch ev.GetEventType() { case ctypes.ProviderResourceDelete: - // note that on delete the resource might be gone anyways because the namespace is deleted + // note that on delete the resource might be gone anyway because the namespace is deleted return op.applyDeleteEvent(ctx, ev) case ctypes.ProviderResourceAdd, ctypes.ProviderResourceUpdate: if op.leasesIgnored.IsFlagged(ev.GetLeaseID()) { @@ -247,7 +246,7 @@ func (op *ipOperator) applyEvent(ctx context.Context, ev v1beta2.IPResourceEvent } } -func (op *ipOperator) applyDeleteEvent(parentCtx context.Context, ev v1beta2.IPResourceEvent) error { +func (op *ipOperator) applyDeleteEvent(parentCtx context.Context, ev ctypes.IPResourceEvent) error { directive := buildIPDirective(ev) // Delete events are a one-shot type thing. The operator always queries for existing CRDs but can't @@ -267,7 +266,7 @@ func (op *ipOperator) applyDeleteEvent(parentCtx context.Context, ev v1beta2.IPR return err } -func buildIPDirective(ev v1beta2.IPResourceEvent) ctypes.ClusterIPPassthroughDirective { +func buildIPDirective(ev ctypes.IPResourceEvent) ctypes.ClusterIPPassthroughDirective { return ctypes.ClusterIPPassthroughDirective{ LeaseID: ev.GetLeaseID(), ServiceName: ev.GetServiceName(), @@ -283,7 +282,7 @@ func getStateKey(leaseID mtypes.LeaseID, sharingKey string, externalPort uint32) return fmt.Sprintf("%v-%s-%d", leaseID.GetOwner(), sharingKey, externalPort) } -func (op *ipOperator) applyAddOrUpdateEvent(ctx context.Context, ev v1beta2.IPResourceEvent) error { +func (op *ipOperator) applyAddOrUpdateEvent(ctx context.Context, ev ctypes.IPResourceEvent) error { leaseID := ev.GetLeaseID() uid := getStateKey(ev.GetLeaseID(), ev.GetSharingKey(), ev.GetExternalPort()) diff --git a/operator/ipoperator/ip_operator_test.go b/operator/ipoperator/ip_operator_test.go index 4768b8cbd..f6c24e403 100644 --- a/operator/ipoperator/ip_operator_test.go +++ b/operator/ipoperator/ip_operator_test.go @@ -15,7 +15,7 @@ import ( "github.com/akash-network/node/testutil" "github.com/akash-network/provider/cluster/mocks" - "github.com/akash-network/provider/cluster/types/v1beta3" + ctypes "github.com/akash-network/provider/cluster/types/v1beta3" "github.com/akash-network/provider/operator/operatorcommon" ) @@ -100,7 +100,7 @@ type fakeIPEvent struct { sharingKey string serviceName string protocol manifest.ServiceProtocol - eventType v1beta2.ProviderResourceEvent + eventType ctypes.ProviderResourceEvent } func (fipe fakeIPEvent) GetLeaseID() mtypes.LeaseID { @@ -125,7 +125,7 @@ func (fipe fakeIPEvent) GetProtocol() manifest.ServiceProtocol { return fipe.protocol } -func (fipe fakeIPEvent) GetEventType() v1beta2.ProviderResourceEvent { +func (fipe fakeIPEvent) GetEventType() ctypes.ProviderResourceEvent { return fipe.eventType } @@ -135,7 +135,7 @@ func TestIPOperatorAddEvent(t *testing.T) { leaseID := testutil.LeaseID(t) s.metalMock.On("CreateIPPassthrough", mock.Anything, - v1beta2.ClusterIPPassthroughDirective{ + ctypes.ClusterIPPassthroughDirective{ LeaseID: leaseID, ServiceName: "aservice", Port: 10000, @@ -151,7 +151,7 @@ func TestIPOperatorAddEvent(t *testing.T) { sharingKey: "akey", serviceName: "aservice", protocol: manifest.TCP, - eventType: v1beta2.ProviderResourceAdd, + eventType: ctypes.ProviderResourceAdd, }) require.NoError(t, err) }) @@ -164,7 +164,7 @@ func TestIPOperatorUpdateEvent(t *testing.T) { leaseID := testutil.LeaseID(t) s.metalMock.On("CreateIPPassthrough", mock.Anything, - v1beta2.ClusterIPPassthroughDirective{ + ctypes.ClusterIPPassthroughDirective{ LeaseID: leaseID, ServiceName: "aservice", Port: 10000, @@ -180,7 +180,7 @@ func TestIPOperatorUpdateEvent(t *testing.T) { sharingKey: "akey", serviceName: "aservice", protocol: manifest.TCP, - eventType: v1beta2.ProviderResourceUpdate, + eventType: ctypes.ProviderResourceUpdate, }) require.NoError(t, err) }) @@ -192,7 +192,7 @@ func TestIPOperatorDeleteEvent(t *testing.T) { leaseID := testutil.LeaseID(t) s.metalMock.On("PurgeIPPassthrough", mock.Anything, - v1beta2.ClusterIPPassthroughDirective{ + ctypes.ClusterIPPassthroughDirective{ LeaseID: leaseID, ServiceName: "aservice", Port: 10000, @@ -208,7 +208,7 @@ func TestIPOperatorDeleteEvent(t *testing.T) { sharingKey: "akey", serviceName: "aservice", protocol: manifest.TCP, - eventType: v1beta2.ProviderResourceDelete, + eventType: ctypes.ProviderResourceDelete, }) require.NoError(t, err) }) @@ -224,7 +224,7 @@ func TestIPOperatorGivesUpOnErrors(t *testing.T) { leaseID := testutil.LeaseID(t) s.metalMock.On("CreateIPPassthrough", mock.Anything, - v1beta2.ClusterIPPassthroughDirective{ + ctypes.ClusterIPPassthroughDirective{ LeaseID: leaseID, ServiceName: "aservice", Port: 10000, @@ -242,7 +242,7 @@ func TestIPOperatorGivesUpOnErrors(t *testing.T) { sharingKey: "akey", serviceName: "aservice", protocol: manifest.TCP, - eventType: v1beta2.ProviderResourceAdd, + eventType: ctypes.ProviderResourceAdd, } for i := uint(0); i != s.ilc.FailureLimit; i++ { err := s.op.applyEvent(ctx, fakeEvent) @@ -260,7 +260,7 @@ func TestIPOperatorRun(t *testing.T) { runIPOperator(t, true, func(ctx context.Context, s ipOperatorScaffold) { s.metalMock.On("GetIPPassthroughs", mock.Anything).Return(nil, nil) s.metalMock.On("GetIPAddressUsage", mock.Anything).Return(uint(0), uint(3), nil) - events := make(chan v1beta2.IPResourceEvent) + events := make(chan ctypes.IPResourceEvent) go func() { select { case events <- fakeIPEvent{ @@ -270,7 +270,7 @@ func TestIPOperatorRun(t *testing.T) { sharingKey: "akey", serviceName: "aservice", protocol: "UDP", - eventType: v1beta2.ProviderResourceAdd, + eventType: ctypes.ProviderResourceAdd, }: case <-ctx.Done(): return @@ -282,12 +282,12 @@ func TestIPOperatorRun(t *testing.T) { } }() // nolint: golint, gosimple - var eventsRead <-chan v1beta2.IPResourceEvent + var eventsRead <-chan ctypes.IPResourceEvent eventsRead = events s.clusterMock.On("ObserveIPState", mock.Anything).Return(eventsRead, nil) s.metalMock.On("CreateIPPassthrough", mock.Anything, - v1beta2.ClusterIPPassthroughDirective{ + ctypes.ClusterIPPassthroughDirective{ LeaseID: leaseID, ServiceName: "aservice", Port: 101, diff --git a/operator/ipoperator/ip_operator_types.go b/operator/ipoperator/ip_operator_types.go index 1182139fb..af6a6a8c9 100644 --- a/operator/ipoperator/ip_operator_types.go +++ b/operator/ipoperator/ip_operator_types.go @@ -8,7 +8,7 @@ import ( "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" - "github.com/akash-network/provider/cluster/types/v1beta3" + ctypes "github.com/akash-network/provider/cluster/types/v1beta3" ) /* @@ -18,7 +18,7 @@ import ( type managedIP struct { presentLease mtypes.LeaseID presentServiceName string - lastEvent v1beta2.IPResourceEvent + lastEvent ctypes.IPResourceEvent presentSharingKey string presentExternalPort uint32 presentPort uint32 diff --git a/pkg/apis/akash.network/crd.yaml b/pkg/apis/akash.network/crd.yaml index baac8b460..d60c5586b 100644 --- a/pkg/apis/akash.network/crd.yaml +++ b/pkg/apis/akash.network/crd.yaml @@ -148,6 +148,12 @@ spec: type: boolean mount: type: string + provider_params: + type: object + nullable: false + properties: + runtime_class: + type: string - name: v2beta1 served: true storage: false @@ -281,6 +287,69 @@ spec: --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition +metadata: + # name must match the spec fields below, and be in the form: . + name: leaseparamsservices.akash.network + # DO NOT REMOVE resource-policy annotation! + annotations: + "helm.sh/resource-policy": keep +spec: + # group name to use for REST API: /apis// + group: akash.network + scope: Namespaced + names: + # plural name to be used in the URL: /apis/// + plural: leaseparamsservices + # singular name to be used as an alias on the CLI and for display + singular: leaseparamsservice + # kind is normally the CamelCased singular type. Your resource manifests use this. + kind: LeaseParamsService + # shortNames allow shorter string to match your resource on the CLI + shortNames: + - pls + # list of versions supported by this CustomResourceDefinition + versions: + - name: v2beta2 + # Each version can be enabled/disabled by Served flag. + served: true + # One and only one version must be marked as the storage version. + storage: true + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + properties: + lease_id: + type: object + properties: + owner: + type: string + dseq: + type: string + format: uint64 + gseq: + type: integer + oseq: + type: integer + provider: + type: string + services: + type: array + items: + type: object + properties: + name: + type: string + params: + type: object + properties: + runtime_class: + type: string +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition metadata: # name must match the spec fields below, and be in the form: . name: providerhosts.akash.network diff --git a/pkg/apis/akash.network/v2beta1/types.go b/pkg/apis/akash.network/v2beta1/types.go index 7139e07df..5d7466994 100644 --- a/pkg/apis/akash.network/v2beta1/types.go +++ b/pkg/apis/akash.network/v2beta1/types.go @@ -9,11 +9,12 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - maniv2beta1 "github.com/akash-network/akash-api/go/manifest/v2beta2" - mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" - types "github.com/akash-network/akash-api/go/node/types/v1beta3" + maniv2beta1 "github.com/akash-network/akash-api/go/manifest/v2beta1" + mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2" + mtypesv1beta3 "github.com/akash-network/akash-api/go/node/market/v1beta3" + types "github.com/akash-network/akash-api/go/node/types/v1beta2" - ctypes "github.com/akash-network/provider/cluster/types/v1beta3" + ctypes "github.com/akash-network/provider/cluster/types/v1beta2" clusterutil "github.com/akash-network/provider/cluster/util" ) @@ -57,19 +58,19 @@ func (m Manifest) Deployment() (ctypes.Deployment, error) { type deployment struct { lid mtypes.LeaseID - group maniv2beta1.Group + group ctypes.Group } func (d deployment) LeaseID() mtypes.LeaseID { return d.lid } -func (d deployment) ManifestGroup() maniv2beta1.Group { +func (d deployment) ManifestGroup() ctypes.Group { return d.group } // NewManifest creates new manifest with provided details. Returns error in case of failure. -func NewManifest(ns string, lid mtypes.LeaseID, mgroup *maniv2beta1.Group) (*Manifest, error) { +func NewManifest(ns string, lid mtypes.LeaseID, mgroup *ctypes.Group) (*Manifest, error) { group, err := manifestGroupFromAkash(mgroup) if err != nil { return nil, err @@ -81,7 +82,7 @@ func NewManifest(ns string, lid mtypes.LeaseID, mgroup *maniv2beta1.Group) (*Man APIVersion: "akash.network/v1", }, ObjectMeta: metav1.ObjectMeta{ - Name: clusterutil.LeaseIDToNamespace(lid), + Name: clusterutil.LeaseIDToNamespace(mtypesv1beta3.LeaseID(lid)), Namespace: ns, }, Spec: ManifestSpec{ @@ -146,10 +147,10 @@ type ManifestGroup struct { } // ToAkash returns akash group details formatted from manifest group -func (m ManifestGroup) toAkash() (maniv2beta1.Group, error) { - am := maniv2beta1.Group{ +func (m ManifestGroup) toAkash() (ctypes.Group, error) { + am := ctypes.Group{ Name: m.Name, - Services: make([]maniv2beta1.Service, 0, len(m.Services)), + Services: make([]ctypes.Service, 0, len(m.Services)), } for _, svc := range m.Services { @@ -164,7 +165,7 @@ func (m ManifestGroup) toAkash() (maniv2beta1.Group, error) { } // ManifestGroupFromAkash returns manifest group instance from akash group -func manifestGroupFromAkash(m *maniv2beta1.Group) (ManifestGroup, error) { +func manifestGroupFromAkash(m *ctypes.Group) (ManifestGroup, error) { ma := ManifestGroup{ Name: m.Name, Services: make([]ManifestService, 0, len(m.Services)), @@ -212,27 +213,29 @@ type ManifestService struct { Params *ManifestServiceParams `json:"params,omitempty"` } -func (ms ManifestService) toAkash() (maniv2beta1.Service, error) { +func (ms ManifestService) toAkash() (ctypes.Service, error) { res, err := ms.Resources.toAkash() if err != nil { - return maniv2beta1.Service{}, err + return ctypes.Service{}, err } - ams := &maniv2beta1.Service{ - Name: ms.Name, - Image: ms.Image, - Command: ms.Command, - Args: ms.Args, - Env: ms.Env, - Resources: res, - Count: ms.Count, - Expose: make([]maniv2beta1.ServiceExpose, 0, len(ms.Expose)), + ams := &ctypes.Service{ + Service: maniv2beta1.Service{ + Name: ms.Name, + Image: ms.Image, + Command: ms.Command, + Args: ms.Args, + Env: ms.Env, + Resources: res, + Count: ms.Count, + Expose: make([]maniv2beta1.ServiceExpose, 0, len(ms.Expose)), + }, } for _, expose := range ms.Expose { value, err := expose.toAkash() if err != nil { - return maniv2beta1.Service{}, err + return ctypes.Service{}, err } ams.Expose = append(ams.Expose, value) @@ -261,7 +264,7 @@ func (ms ManifestService) toAkash() (maniv2beta1.Service, error) { return *ams, nil } -func manifestServiceFromAkash(ams maniv2beta1.Service) (ManifestService, error) { +func manifestServiceFromAkash(ams ctypes.Service) (ManifestService, error) { resources, err := resourceUnitsFromAkash(ams.Resources) if err != nil { return ManifestService{}, err diff --git a/pkg/apis/akash.network/v2beta2/k8s_integration_test.go b/pkg/apis/akash.network/v2beta2/k8s_integration_test.go index 809b8deef..e655970c5 100644 --- a/pkg/apis/akash.network/v2beta2/k8s_integration_test.go +++ b/pkg/apis/akash.network/v2beta2/k8s_integration_test.go @@ -1,5 +1,4 @@ //go:build k8s_integration -// +build k8s_integration package v2beta2_test @@ -37,12 +36,9 @@ func TestWriteRead(t *testing.T) { for _, spec := range mtestutil.Generators { // ensure decode(encode(obj)) == obj - var ( - lid = atestutil.LeaseID(t) - group = spec.Generator.Group(t) - ) + lid := atestutil.LeaseID(t) + group := spec.Generator.Group(t) - // create local k8s manifest object kmani, err := crd.NewManifest(ns, lid, &group) require.NoError(t, err, spec.Name) @@ -95,8 +91,8 @@ func withNamespace(ctx context.Context, t testing.TB, fn func(*rest.Config, stri func kubeConfig(t testing.TB) *rest.Config { t.Helper() - cfgpath := path.Join(homedir.HomeDir(), ".kube", "config") - config, err := clientcmd.BuildConfigFromFlags("", cfgpath) + cfgPath := path.Join(homedir.HomeDir(), ".kube", "config") + config, err := clientcmd.BuildConfigFromFlags("", cfgPath) require.NoError(t, err) return config } diff --git a/pkg/apis/akash.network/v2beta2/lease_params_service.go b/pkg/apis/akash.network/v2beta2/lease_params_service.go new file mode 100644 index 000000000..9e69cfce8 --- /dev/null +++ b/pkg/apis/akash.network/v2beta2/lease_params_service.go @@ -0,0 +1,45 @@ +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LeaseParamsService +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type LeaseParamsService struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec LeaseParamsServiceSpec `json:"spec,omitempty"` + Status LeaseParamsServiceStatus `json:"status,omitempty"` +} + +// LeaseParamsServiceList +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type LeaseParamsServiceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []LeaseParamsService `json:"items"` +} + +type Params struct { + RuntimeClass string `json:"runtime_class"` +} + +type ParamsService struct { + Name string `json:"name"` + Params Params `json:"params"` +} + +type ParamsServices []ParamsService + +type LeaseParamsServiceSpec struct { + LeaseID LeaseID `json:"lease_id"` + Services ParamsServices `json:"services"` +} + +type LeaseParamsServiceStatus struct { + State string `json:"state,omitempty"` + Message string `json:"message,omitempty"` +} diff --git a/pkg/apis/akash.network/v2beta2/manifest.go b/pkg/apis/akash.network/v2beta2/manifest.go new file mode 100644 index 000000000..9a38b4ce7 --- /dev/null +++ b/pkg/apis/akash.network/v2beta2/manifest.go @@ -0,0 +1,316 @@ +package v2beta2 + +import ( + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" + mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" + types "github.com/akash-network/akash-api/go/node/types/v1beta3" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + ctypes "github.com/akash-network/provider/cluster/types/v1beta3" + clusterutil "github.com/akash-network/provider/cluster/util" +) + +// Manifest store metadata, specifications and status of the Lease +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type Manifest struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ManifestSpec `json:"spec,omitempty"` + Status ManifestStatus `json:"status,omitempty"` +} + +// ManifestList stores metadata and items list of manifest +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ManifestList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []Manifest `json:"items"` +} + +// ManifestService stores name, image, args, env, unit, count and expose list of service +type ManifestService struct { + // Service name + Name string `json:"name,omitempty"` + // Docker image + Image string `json:"image,omitempty"` + Command []string `json:"command,omitempty"` + Args []string `json:"args,omitempty"` + Env []string `json:"env,omitempty"` + // Resource requirements + // in current version of CRD it is named as unit + Resources ResourceUnits `json:"unit"` + // Number of instances + Count uint32 `json:"count,omitempty"` + // Overlay Network Links + Expose []ManifestServiceExpose `json:"expose,omitempty"` + // Miscellaneous service parameters + Params *ManifestServiceParams `json:"params,omitempty"` +} + +// ManifestGroup stores metadata, name and list of SDL manifest services +type ManifestGroup struct { + // Placement profile name + Name string `json:"name,omitempty"` + // Service definitions + Services []ManifestService `json:"services,omitempty"` +} + +// ManifestSpec stores LeaseID, Group and metadata details +type ManifestSpec struct { + LeaseID LeaseID `json:"lease_id"` + Group ManifestGroup `json:"group"` +} + +// ManifestStatus stores state and message of manifest +type ManifestStatus struct { + State string `json:"state,omitempty"` + Message string `json:"message,omitempty"` +} + +type ManifestStorageParams struct { + Name string `json:"name" yaml:"name"` + Mount string `json:"mount" yaml:"mount"` + ReadOnly bool `json:"readOnly" yaml:"readOnly"` +} + +type ManifestServiceParams struct { + Storage []ManifestStorageParams `json:"storage,omitempty"` +} + +// ManifestServiceExpose stores exposed ports and accepted hosts details +type ManifestServiceExpose struct { + Port uint16 `json:"port,omitempty"` + ExternalPort uint16 `json:"external_port,omitempty"` + Proto string `json:"proto,omitempty"` + Service string `json:"service,omitempty"` + Global bool `json:"global,omitempty"` + Hosts []string `json:"hosts,omitempty"` + HTTPOptions ManifestServiceExposeHTTPOptions `json:"http_options,omitempty"` + IP string `json:"ip,omitempty"` + EndpointSequenceNumber uint32 `json:"endpoint_sequence_number"` +} + +type ManifestServiceExposeHTTPOptions struct { + MaxBodySize uint32 `json:"max_body_size,omitempty"` + ReadTimeout uint32 `json:"read_timeout,omitempty"` + SendTimeout uint32 `json:"send_timeout,omitempty"` + NextTries uint32 `json:"next_tries,omitempty"` + NextTimeout uint32 `json:"next_timeout,omitempty"` + NextCases []string `json:"next_cases,omitempty"` +} + +// NewManifest creates new manifest with provided details. Returns error in case of failure. +func NewManifest(ns string, lid mtypes.LeaseID, mgroup *mani.Group) (*Manifest, error) { + group, err := manifestGroupToCRD(mgroup) + if err != nil { + return nil, err + } + + return &Manifest{ + TypeMeta: metav1.TypeMeta{ + Kind: "Manifest", + APIVersion: "akash.network/v2beta2", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: clusterutil.LeaseIDToNamespace(lid), + Namespace: ns, + }, + Spec: ManifestSpec{ + Group: group, + LeaseID: LeaseIDFromAkash(lid), + }, + }, nil +} + +// Deployment returns the cluster.Deployment that the saved manifest represents. +func (m *Manifest) Deployment() (ctypes.Deployment, error) { + lid, err := m.Spec.LeaseID.FromCRD() + if err != nil { + return nil, err + } + + group, err := m.Spec.Group.fromCRD() + if err != nil { + return nil, err + } + return deployment{lid: lid, group: group}, nil +} + +// toAkash returns akash group details formatted from manifest group +func (m *ManifestGroup) fromCRD() (mani.Group, error) { + am := mani.Group{ + Name: m.Name, + Services: make([]mani.Service, 0, len(m.Services)), + } + + for _, svc := range m.Services { + asvc, err := svc.fromCRD() + if err != nil { + return am, err + } + am.Services = append(am.Services, asvc) + } + + return am, nil +} + +// manifestGroupToCRD returns manifest group instance from akash group +func manifestGroupToCRD(m *mani.Group) (ManifestGroup, error) { + ma := ManifestGroup{ + Name: m.Name, + Services: make([]ManifestService, 0, len(m.Services)), + } + + for _, svc := range m.Services { + service, err := manifestServiceFromProvider(svc) + if err != nil { + return ManifestGroup{}, err + } + + ma.Services = append(ma.Services, service) + } + + return ma, nil +} + +func (ms *ManifestService) fromCRD() (mani.Service, error) { + res, err := ms.Resources.fromCRD() + if err != nil { + return mani.Service{}, err + } + + ams := &mani.Service{ + Name: ms.Name, + Image: ms.Image, + Command: ms.Command, + Args: ms.Args, + Env: ms.Env, + Resources: res, + Count: ms.Count, + Expose: make([]mani.ServiceExpose, 0, len(ms.Expose)), + } + + for _, expose := range ms.Expose { + value, err := expose.toAkash() + if err != nil { + return mani.Service{}, err + } + ams.Expose = append(ams.Expose, value) + + if len(value.IP) != 0 { + res.Endpoints = append(res.Endpoints, types.Endpoint{ + Kind: types.Endpoint_LEASED_IP, + SequenceNumber: value.EndpointSequenceNumber, + }) + } + } + + if ms.Params != nil { + ams.Params = &mani.ServiceParams{ + Storage: make([]mani.StorageParams, 0, len(ms.Params.Storage)), + } + + for _, storage := range ms.Params.Storage { + ams.Params.Storage = append(ams.Params.Storage, mani.StorageParams{ + Name: storage.Name, + Mount: storage.Mount, + ReadOnly: storage.ReadOnly, + }) + } + } + + return *ams, nil +} + +func manifestServiceFromProvider(ams mani.Service) (ManifestService, error) { + resources, err := resourceUnitsFromAkash(ams.Resources) + if err != nil { + return ManifestService{}, err + } + + ms := ManifestService{ + Name: ams.Name, + Image: ams.Image, + Command: ams.Command, + Args: ams.Args, + Env: ams.Env, + Resources: resources, + Count: ams.Count, + Expose: make([]ManifestServiceExpose, 0, len(ams.Expose)), + } + + for _, expose := range ams.Expose { + ms.Expose = append(ms.Expose, manifestServiceExposeFromAkash(expose)) + } + + if ams.Params != nil { + ms.Params = &ManifestServiceParams{ + Storage: make([]ManifestStorageParams, 0, len(ams.Params.Storage)), + } + + for _, storage := range ams.Params.Storage { + ms.Params.Storage = append(ms.Params.Storage, ManifestStorageParams{ + Name: storage.Name, + Mount: storage.Mount, + ReadOnly: storage.ReadOnly, + }) + } + } + + return ms, nil +} + +func (mse ManifestServiceExpose) toAkash() (mani.ServiceExpose, error) { + proto, err := mani.ParseServiceProtocol(mse.Proto) + if err != nil { + return mani.ServiceExpose{}, err + } + return mani.ServiceExpose{ + Port: uint32(mse.Port), + ExternalPort: uint32(mse.ExternalPort), + Proto: proto, + Service: mse.Service, + Global: mse.Global, + Hosts: mse.Hosts, + EndpointSequenceNumber: mse.EndpointSequenceNumber, + IP: mse.IP, + HTTPOptions: mani.ServiceExposeHTTPOptions{ + MaxBodySize: mse.HTTPOptions.MaxBodySize, + ReadTimeout: mse.HTTPOptions.ReadTimeout, + SendTimeout: mse.HTTPOptions.SendTimeout, + NextTries: mse.HTTPOptions.NextTries, + NextTimeout: mse.HTTPOptions.NextTimeout, + NextCases: mse.HTTPOptions.NextCases, + }, + }, nil +} + +func (mse ManifestServiceExpose) DetermineExposedExternalPort() uint16 { + if mse.ExternalPort == 0 { + return mse.Port + } + return mse.ExternalPort +} + +func manifestServiceExposeFromAkash(amse mani.ServiceExpose) ManifestServiceExpose { + return ManifestServiceExpose{ + Port: uint16(amse.Port), + ExternalPort: uint16(amse.ExternalPort), + Proto: amse.Proto.ToString(), + Service: amse.Service, + Global: amse.Global, + Hosts: amse.Hosts, + IP: amse.IP, + EndpointSequenceNumber: amse.EndpointSequenceNumber, + HTTPOptions: ManifestServiceExposeHTTPOptions{ + MaxBodySize: amse.HTTPOptions.MaxBodySize, + ReadTimeout: amse.HTTPOptions.ReadTimeout, + SendTimeout: amse.HTTPOptions.SendTimeout, + NextTries: amse.HTTPOptions.NextTries, + NextTimeout: amse.HTTPOptions.NextTimeout, + NextCases: amse.HTTPOptions.NextCases, + }, + } +} diff --git a/pkg/apis/akash.network/v2beta2/provider_host.go b/pkg/apis/akash.network/v2beta2/provider_host.go new file mode 100644 index 000000000..97f2da699 --- /dev/null +++ b/pkg/apis/akash.network/v2beta2/provider_host.go @@ -0,0 +1,40 @@ +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ProviderHost +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ProviderHost struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ProviderHostSpec `json:"spec,omitempty"` + Status ProviderHostStatus `json:"status,omitempty"` +} + +// ProviderHostList +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ProviderHostList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []ProviderHost `json:"items"` +} + +type ProviderHostStatus struct { + State string `json:"state,omitempty"` + Message string `json:"message,omitempty"` +} + +type ProviderHostSpec struct { + Owner string `json:"owner"` + Provider string `json:"provider"` + Hostname string `json:"hostname"` + Dseq uint64 `json:"dseq"` + Gseq uint32 `json:"gseq"` + Oseq uint32 `json:"oseq"` + ServiceName string `json:"service_name"` + ExternalPort uint32 `json:"external_port"` +} diff --git a/pkg/apis/akash.network/v2beta2/provider_lease_ip.go b/pkg/apis/akash.network/v2beta2/provider_lease_ip.go new file mode 100644 index 000000000..cba3d87b4 --- /dev/null +++ b/pkg/apis/akash.network/v2beta2/provider_lease_ip.go @@ -0,0 +1,38 @@ +package v2beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ProviderLeasedIP +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ProviderLeasedIP struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata"` + + Spec ProviderLeasedIPSpec `json:"spec,omitempty"` + Status ProviderLeasedIPStatus `json:"status,omitempty"` +} + +// ProviderLeasedIPList +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type ProviderLeasedIPList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []ProviderLeasedIP `json:"items"` +} + +type ProviderLeasedIPStatus struct { + State string `json:"state,omitempty"` + Message string `json:"message,omitempty"` +} + +type ProviderLeasedIPSpec struct { + LeaseID LeaseID `json:"lease_id"` + ServiceName string `json:"service_name"` + Port uint32 `json:"port"` + ExternalPort uint32 `json:"external_port"` + SharingKey string `json:"sharing_key"` + Protocol string `json:"protocol"` +} diff --git a/pkg/apis/akash.network/v2beta2/register.go b/pkg/apis/akash.network/v2beta2/register.go index 26cab2471..43b069ca6 100644 --- a/pkg/apis/akash.network/v2beta2/register.go +++ b/pkg/apis/akash.network/v2beta2/register.go @@ -26,6 +26,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { &Manifest{}, &ManifestList{}, ) + scheme.AddKnownTypes(SchemeGroupVersion, + &LeaseParamsService{}, + &LeaseParamsServiceList{}) + scheme.AddKnownTypes(SchemeGroupVersion, &InventoryRequest{}, &InventoryRequestList{}, diff --git a/pkg/apis/akash.network/v2beta2/types.go b/pkg/apis/akash.network/v2beta2/types.go index 599df5ad3..a12bf3981 100644 --- a/pkg/apis/akash.network/v2beta2/types.go +++ b/pkg/apis/akash.network/v2beta2/types.go @@ -4,93 +4,27 @@ import ( "math" "strconv" - "github.com/pkg/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pkg/errors" - maniv2beta2 "github.com/akash-network/akash-api/go/manifest/v2beta2" + mani "github.com/akash-network/akash-api/go/manifest/v2beta2" mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3" types "github.com/akash-network/akash-api/go/node/types/v1beta3" - - ctypes "github.com/akash-network/provider/cluster/types/v1beta3" - clusterutil "github.com/akash-network/provider/cluster/util" ) -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Manifest store metadata, specifications and status of the Lease -type Manifest struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - - Spec ManifestSpec `json:"spec,omitempty"` - Status ManifestStatus `json:"status,omitempty"` -} - -// ManifestStatus stores state and message of manifest -type ManifestStatus struct { - State string `json:"state,omitempty"` - Message string `json:"message,omitempty"` -} - -// ManifestSpec stores LeaseID, Group and metadata details -type ManifestSpec struct { - LeaseID LeaseID `json:"lease_id"` - Group ManifestGroup `json:"group"` -} - -// Deployment returns the cluster.Deployment that the saved manifest represents. -func (m *Manifest) Deployment() (ctypes.Deployment, error) { - lid, err := m.Spec.LeaseID.ToAkash() - if err != nil { - return nil, err - } - - group, err := m.Spec.Group.toAkash() - if err != nil { - return nil, err - } - return deployment{lid: lid, group: group}, nil -} - type deployment struct { lid mtypes.LeaseID - group maniv2beta2.Group + group mani.Group } func (d deployment) LeaseID() mtypes.LeaseID { return d.lid } -func (d deployment) ManifestGroup() maniv2beta2.Group { +func (d deployment) ManifestGroup() mani.Group { return d.group } -// NewManifest creates new manifest with provided details. Returns error in case of failure. -func NewManifest(ns string, lid mtypes.LeaseID, mgroup *maniv2beta2.Group) (*Manifest, error) { - group, err := manifestGroupFromAkash(mgroup) - if err != nil { - return nil, err - } - - return &Manifest{ - TypeMeta: metav1.TypeMeta{ - Kind: "Manifest", - APIVersion: "akash.network/v2beta2", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: clusterutil.LeaseIDToNamespace(lid), - Namespace: ns, - }, - Spec: ManifestSpec{ - Group: group, - LeaseID: LeaseIDFromAkash(lid), - }, - }, nil -} - // LeaseID stores deployment, group sequence, order, provider and metadata type LeaseID struct { Owner string `json:"owner"` @@ -100,8 +34,8 @@ type LeaseID struct { Provider string `json:"provider"` } -// ToAkash returns LeaseID from LeaseID details -func (id LeaseID) ToAkash() (mtypes.LeaseID, error) { +// FromCRD returns LeaseID from LeaseID details +func (id LeaseID) FromCRD() (mtypes.LeaseID, error) { owner, err := sdk.AccAddressFromBech32(id.Owner) if err != nil { return mtypes.LeaseID{}, err @@ -137,257 +71,20 @@ func LeaseIDFromAkash(id mtypes.LeaseID) LeaseID { } } -// ManifestGroup stores metadata, name and list of SDL manifest services -type ManifestGroup struct { - // Placement profile name - Name string `json:"name,omitempty"` - // Service definitions - Services []ManifestService `json:"services,omitempty"` -} - -// toAkash returns akash group details formatted from manifest group -func (m *ManifestGroup) toAkash() (maniv2beta2.Group, error) { - am := maniv2beta2.Group{ - Name: m.Name, - Services: make([]maniv2beta2.Service, 0, len(m.Services)), - } - - for _, svc := range m.Services { - asvc, err := svc.toAkash() - if err != nil { - return am, err - } - am.Services = append(am.Services, asvc) - } - - return am, nil -} - -// ManifestGroupFromAkash returns manifest group instance from akash group -func manifestGroupFromAkash(m *maniv2beta2.Group) (ManifestGroup, error) { - ma := ManifestGroup{ - Name: m.Name, - Services: make([]ManifestService, 0, len(m.Services)), - } - - for _, svc := range m.Services { - service, err := manifestServiceFromAkash(svc) - if err != nil { - return ManifestGroup{}, err - } - - ma.Services = append(ma.Services, service) - } - - return ma, nil -} - -type ManifestStorageParams struct { - Name string `json:"name" yaml:"name"` - Mount string `json:"mount" yaml:"mount"` - ReadOnly bool `json:"readOnly" yaml:"readOnly"` -} - -type ManifestServiceParams struct { - Storage []ManifestStorageParams `json:"storage,omitempty"` -} - -// ManifestService stores name, image, args, env, unit, count and expose list of service -type ManifestService struct { - // Service name - Name string `json:"name,omitempty"` - // Docker image - Image string `json:"image,omitempty"` - Command []string `json:"command,omitempty"` - Args []string `json:"args,omitempty"` - Env []string `json:"env,omitempty"` - // Resource requirements - // in current version of CRD it is named as unit - Resources ResourceUnits `json:"unit"` - // Number of instances - Count uint32 `json:"count,omitempty"` - // Overlay Network Links - Expose []ManifestServiceExpose `json:"expose,omitempty"` - // Miscellaneous service parameters - Params *ManifestServiceParams `json:"params,omitempty"` -} - -func (ms *ManifestService) toAkash() (maniv2beta2.Service, error) { - res, err := ms.Resources.toAkash() - if err != nil { - return maniv2beta2.Service{}, err - } - - ams := &maniv2beta2.Service{ - Name: ms.Name, - Image: ms.Image, - Command: ms.Command, - Args: ms.Args, - Env: ms.Env, - Resources: res, - Count: ms.Count, - Expose: make([]maniv2beta2.ServiceExpose, 0, len(ms.Expose)), - } - - for _, expose := range ms.Expose { - value, err := expose.toAkash() - if err != nil { - return maniv2beta2.Service{}, err - } - ams.Expose = append(ams.Expose, value) - - if len(value.IP) != 0 { - res.Endpoints = append(res.Endpoints, types.Endpoint{ - Kind: types.Endpoint_LEASED_IP, - SequenceNumber: value.EndpointSequenceNumber, - }) - } - } - - if ms.Params != nil { - ams.Params = &maniv2beta2.ServiceParams{ - Storage: make([]maniv2beta2.StorageParams, 0, len(ms.Params.Storage)), - } - - for _, storage := range ms.Params.Storage { - ams.Params.Storage = append(ams.Params.Storage, maniv2beta2.StorageParams{ - Name: storage.Name, - Mount: storage.Mount, - ReadOnly: storage.ReadOnly, - }) - } - } - - return *ams, nil -} - -func manifestServiceFromAkash(ams maniv2beta2.Service) (ManifestService, error) { - resources, err := resourceUnitsFromAkash(ams.Resources) - if err != nil { - return ManifestService{}, err - } - - ms := ManifestService{ - Name: ams.Name, - Image: ams.Image, - Command: ams.Command, - Args: ams.Args, - Env: ams.Env, - Resources: resources, - Count: ams.Count, - Expose: make([]ManifestServiceExpose, 0, len(ams.Expose)), - } - - for _, expose := range ams.Expose { - ms.Expose = append(ms.Expose, manifestServiceExposeFromAkash(expose)) - } - - if ams.Params != nil { - ms.Params = &ManifestServiceParams{ - Storage: make([]ManifestStorageParams, 0, len(ams.Params.Storage)), - } - - for _, storage := range ams.Params.Storage { - ms.Params.Storage = append(ms.Params.Storage, ManifestStorageParams{ - Name: storage.Name, - Mount: storage.Mount, - ReadOnly: storage.ReadOnly, - }) - } - } - - return ms, nil -} - -// ManifestServiceExpose stores exposed ports and accepted hosts details -type ManifestServiceExpose struct { - Port uint16 `json:"port,omitempty"` - ExternalPort uint16 `json:"external_port,omitempty"` - Proto string `json:"proto,omitempty"` - Service string `json:"service,omitempty"` - Global bool `json:"global,omitempty"` - Hosts []string `json:"hosts,omitempty"` - HTTPOptions ManifestServiceExposeHTTPOptions `json:"http_options,omitempty"` - IP string `json:"ip,omitempty"` - EndpointSequenceNumber uint32 `json:"endpoint_sequence_number"` -} - -type ManifestServiceExposeHTTPOptions struct { - MaxBodySize uint32 `json:"max_body_size,omitempty"` - ReadTimeout uint32 `json:"read_timeout,omitempty"` - SendTimeout uint32 `json:"send_timeout,omitempty"` - NextTries uint32 `json:"next_tries,omitempty"` - NextTimeout uint32 `json:"next_timeout,omitempty"` - NextCases []string `json:"next_cases,omitempty"` -} - -func (mse ManifestServiceExpose) toAkash() (maniv2beta2.ServiceExpose, error) { - proto, err := maniv2beta2.ParseServiceProtocol(mse.Proto) - if err != nil { - return maniv2beta2.ServiceExpose{}, err - } - return maniv2beta2.ServiceExpose{ - Port: uint32(mse.Port), - ExternalPort: uint32(mse.ExternalPort), - Proto: proto, - Service: mse.Service, - Global: mse.Global, - Hosts: mse.Hosts, - EndpointSequenceNumber: mse.EndpointSequenceNumber, - IP: mse.IP, - HTTPOptions: maniv2beta2.ServiceExposeHTTPOptions{ - MaxBodySize: mse.HTTPOptions.MaxBodySize, - ReadTimeout: mse.HTTPOptions.ReadTimeout, - SendTimeout: mse.HTTPOptions.SendTimeout, - NextTries: mse.HTTPOptions.NextTries, - NextTimeout: mse.HTTPOptions.NextTimeout, - NextCases: mse.HTTPOptions.NextCases, - }, - }, nil -} - -func (mse ManifestServiceExpose) DetermineExposedExternalPort() uint16 { - if mse.ExternalPort == 0 { - return mse.Port - } - return mse.ExternalPort -} - -func manifestServiceExposeFromAkash(amse maniv2beta2.ServiceExpose) ManifestServiceExpose { - return ManifestServiceExpose{ - Port: uint16(amse.Port), - ExternalPort: uint16(amse.ExternalPort), - Proto: amse.Proto.ToString(), - Service: amse.Service, - Global: amse.Global, - Hosts: amse.Hosts, - IP: amse.IP, - EndpointSequenceNumber: amse.EndpointSequenceNumber, - HTTPOptions: ManifestServiceExposeHTTPOptions{ - MaxBodySize: amse.HTTPOptions.MaxBodySize, - ReadTimeout: amse.HTTPOptions.ReadTimeout, - SendTimeout: amse.HTTPOptions.SendTimeout, - NextTries: amse.HTTPOptions.NextTries, - NextTimeout: amse.HTTPOptions.NextTimeout, - NextCases: amse.HTTPOptions.NextCases, - }, - } -} - -type ManifestServiceStorage struct { +type ResourceUnitsStorage struct { Name string `json:"name"` Size string `json:"size"` } // ResourceUnits stores cpu, memory and storage details type ResourceUnits struct { - CPU uint32 `json:"cpu,omitempty"` - Memory string `json:"memory,omitempty"` - Storage []ManifestServiceStorage `json:"storage,omitempty"` - GPU uint32 `json:"gpu,omitempty"` + CPU uint32 `json:"cpu,omitempty"` + Memory string `json:"memory,omitempty"` + Storage []ResourceUnitsStorage `json:"storage,omitempty"` + GPU uint32 `json:"gpu,omitempty"` } -func (ru ResourceUnits) toAkash() (types.ResourceUnits, error) { +func (ru ResourceUnits) fromCRD() (types.ResourceUnits, error) { memory, err := strconv.ParseUint(ru.Memory, 10, 64) if err != nil { return types.ResourceUnits{}, err @@ -440,9 +137,9 @@ func resourceUnitsFromAkash(aru types.ResourceUnits) (ResourceUnits, error) { res.GPU = uint32(aru.GPU.Units.Value()) } - res.Storage = make([]ManifestServiceStorage, 0, len(aru.Storage)) + res.Storage = make([]ResourceUnitsStorage, 0, len(aru.Storage)) for _, storage := range aru.Storage { - res.Storage = append(res.Storage, ManifestServiceStorage{ + res.Storage = append(res.Storage, ResourceUnitsStorage{ Name: storage.Name, Size: strconv.FormatUint(storage.Quantity.Value(), 10), }) @@ -450,75 +147,3 @@ func resourceUnitsFromAkash(aru types.ResourceUnits) (ResourceUnits, error) { return res, nil } - -// ManifestList stores metadata and items list of manifest -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ManifestList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - Items []Manifest `json:"items"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ProviderHost struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - - Spec ProviderHostSpec `json:"spec,omitempty"` - Status ProviderHostStatus `json:"status,omitempty"` -} - -type ProviderHostStatus struct { - State string `json:"state,omitempty"` - Message string `json:"message,omitempty"` -} - -type ProviderHostSpec struct { - Owner string `json:"owner"` - Provider string `json:"provider"` - Hostname string `json:"hostname"` - Dseq uint64 `json:"dseq"` - Gseq uint32 `json:"gseq"` - Oseq uint32 `json:"oseq"` - ServiceName string `json:"service_name"` - ExternalPort uint32 `json:"external_port"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ProviderHostList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - Items []ProviderHost `json:"items"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ProviderLeasedIP struct { - metav1.TypeMeta `json:",inline"` - metav1.ObjectMeta `json:"metadata"` - - Spec ProviderLeasedIPSpec `json:"spec,omitempty"` - Status ProviderLeasedIPStatus `json:"status,omitempty"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type ProviderLeasedIPList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata"` - Items []ProviderLeasedIP `json:"items"` -} - -type ProviderLeasedIPStatus struct { - State string `json:"state,omitempty"` - Message string `json:"message,omitempty"` -} - -type ProviderLeasedIPSpec struct { - LeaseID LeaseID `json:"lease_id"` - ServiceName string `json:"service_name"` - Port uint32 `json:"port"` - ExternalPort uint32 `json:"external_port"` - SharingKey string `json:"sharing_key"` - Protocol string `json:"protocol"` -} diff --git a/pkg/apis/akash.network/v2beta2/types_test.go b/pkg/apis/akash.network/v2beta2/types_test.go index 74116cb6b..0bbc52cfd 100644 --- a/pkg/apis/akash.network/v2beta2/types_test.go +++ b/pkg/apis/akash.network/v2beta2/types_test.go @@ -15,18 +15,16 @@ func Test_Manifest_encoding(t *testing.T) { for _, spec := range mtestutil.Generators { // ensure decode(encode(obj)) == obj - var ( - lid = atestutil.LeaseID(t) - mgrp = spec.Generator.Group(t) - ) + lid := atestutil.LeaseID(t) + mgroup := spec.Generator.Group(t) - kmani, err := NewManifest("foo", lid, &mgrp) + kmani, err := NewManifest("foo", lid, &mgroup) require.NoError(t, err, spec.Name) deployment, err := kmani.Deployment() require.NoError(t, err, spec.Name) assert.Equal(t, lid, deployment.LeaseID(), spec.Name) - assert.Equal(t, mgrp, deployment.ManifestGroup(), spec.Name) + assert.Equal(t, mgroup, deployment.ManifestGroup(), spec.Name) } } diff --git a/pkg/apis/akash.network/v2beta2/zz_generated.deepcopy.go b/pkg/apis/akash.network/v2beta2/zz_generated.deepcopy.go index d5538e404..28982e2ac 100644 --- a/pkg/apis/akash.network/v2beta2/zz_generated.deepcopy.go +++ b/pkg/apis/akash.network/v2beta2/zz_generated.deepcopy.go @@ -254,6 +254,105 @@ func (in *LeaseID) DeepCopy() *LeaseID { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LeaseParamsService) DeepCopyInto(out *LeaseParamsService) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaseParamsService. +func (in *LeaseParamsService) DeepCopy() *LeaseParamsService { + if in == nil { + return nil + } + out := new(LeaseParamsService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LeaseParamsService) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LeaseParamsServiceList) DeepCopyInto(out *LeaseParamsServiceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LeaseParamsService, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaseParamsServiceList. +func (in *LeaseParamsServiceList) DeepCopy() *LeaseParamsServiceList { + if in == nil { + return nil + } + out := new(LeaseParamsServiceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LeaseParamsServiceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LeaseParamsServiceSpec) DeepCopyInto(out *LeaseParamsServiceSpec) { + *out = *in + out.LeaseID = in.LeaseID + if in.Services != nil { + in, out := &in.Services, &out.Services + *out = make(ParamsServices, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaseParamsServiceSpec. +func (in *LeaseParamsServiceSpec) DeepCopy() *LeaseParamsServiceSpec { + if in == nil { + return nil + } + out := new(LeaseParamsServiceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LeaseParamsServiceStatus) DeepCopyInto(out *LeaseParamsServiceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaseParamsServiceStatus. +func (in *LeaseParamsServiceStatus) DeepCopy() *LeaseParamsServiceStatus { + if in == nil { + return nil + } + out := new(LeaseParamsServiceStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Manifest) DeepCopyInto(out *Manifest) { *out = *in @@ -446,22 +545,6 @@ func (in *ManifestServiceParams) DeepCopy() *ManifestServiceParams { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ManifestServiceStorage) DeepCopyInto(out *ManifestServiceStorage) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManifestServiceStorage. -func (in *ManifestServiceStorage) DeepCopy() *ManifestServiceStorage { - if in == nil { - return nil - } - out := new(ManifestServiceStorage) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ManifestSpec) DeepCopyInto(out *ManifestSpec) { *out = *in @@ -512,6 +595,59 @@ func (in *ManifestStorageParams) DeepCopy() *ManifestStorageParams { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Params) DeepCopyInto(out *Params) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Params. +func (in *Params) DeepCopy() *Params { + if in == nil { + return nil + } + out := new(Params) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ParamsService) DeepCopyInto(out *ParamsService) { + *out = *in + out.Params = in.Params + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParamsService. +func (in *ParamsService) DeepCopy() *ParamsService { + if in == nil { + return nil + } + out := new(ParamsService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in ParamsServices) DeepCopyInto(out *ParamsServices) { + { + in := &in + *out = make(ParamsServices, len(*in)) + copy(*out, *in) + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ParamsServices. +func (in ParamsServices) DeepCopy() ParamsServices { + if in == nil { + return nil + } + out := new(ParamsServices) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProviderHost) DeepCopyInto(out *ProviderHost) { *out = *in @@ -720,7 +856,7 @@ func (in *ResourceUnits) DeepCopyInto(out *ResourceUnits) { *out = *in if in.Storage != nil { in, out := &in.Storage, &out.Storage - *out = make([]ManifestServiceStorage, len(*in)) + *out = make([]ResourceUnitsStorage, len(*in)) copy(*out, *in) } return @@ -735,3 +871,19 @@ func (in *ResourceUnits) DeepCopy() *ResourceUnits { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceUnitsStorage) DeepCopyInto(out *ResourceUnitsStorage) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceUnitsStorage. +func (in *ResourceUnitsStorage) DeepCopy() *ResourceUnitsStorage { + if in == nil { + return nil + } + out := new(ResourceUnitsStorage) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/akash.network_client.go b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/akash.network_client.go index e7470cd56..e7be2676b 100644 --- a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/akash.network_client.go +++ b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/akash.network_client.go @@ -30,6 +30,7 @@ type AkashV2beta2Interface interface { RESTClient() rest.Interface InventoriesGetter InventoryRequestsGetter + LeaseParamsServicesGetter ManifestsGetter ProviderHostsGetter ProviderLeasedIPsGetter @@ -48,6 +49,10 @@ func (c *AkashV2beta2Client) InventoryRequests() InventoryRequestInterface { return newInventoryRequests(c) } +func (c *AkashV2beta2Client) LeaseParamsServices(namespace string) LeaseParamsServiceInterface { + return newLeaseParamsServices(c, namespace) +} + func (c *AkashV2beta2Client) Manifests(namespace string) ManifestInterface { return newManifests(c, namespace) } diff --git a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_akash.network_client.go b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_akash.network_client.go index 34a8a12ce..867b80987 100644 --- a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_akash.network_client.go +++ b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_akash.network_client.go @@ -36,6 +36,10 @@ func (c *FakeAkashV2beta2) InventoryRequests() v2beta2.InventoryRequestInterface return &FakeInventoryRequests{c} } +func (c *FakeAkashV2beta2) LeaseParamsServices(namespace string) v2beta2.LeaseParamsServiceInterface { + return &FakeLeaseParamsServices{c, namespace} +} + func (c *FakeAkashV2beta2) Manifests(namespace string) v2beta2.ManifestInterface { return &FakeManifests{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_leaseparamsservice.go b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_leaseparamsservice.go new file mode 100644 index 000000000..a04234b24 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/fake_leaseparamsservice.go @@ -0,0 +1,142 @@ +/* +Copyright The Akash Network Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v2beta2 "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeLeaseParamsServices implements LeaseParamsServiceInterface +type FakeLeaseParamsServices struct { + Fake *FakeAkashV2beta2 + ns string +} + +var leaseparamsservicesResource = schema.GroupVersionResource{Group: "akash.network", Version: "v2beta2", Resource: "leaseparamsservices"} + +var leaseparamsservicesKind = schema.GroupVersionKind{Group: "akash.network", Version: "v2beta2", Kind: "LeaseParamsService"} + +// Get takes name of the leaseParamsService, and returns the corresponding leaseParamsService object, and an error if there is any. +func (c *FakeLeaseParamsServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.LeaseParamsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(leaseparamsservicesResource, c.ns, name), &v2beta2.LeaseParamsService{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.LeaseParamsService), err +} + +// List takes label and field selectors, and returns the list of LeaseParamsServices that match those selectors. +func (c *FakeLeaseParamsServices) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.LeaseParamsServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(leaseparamsservicesResource, leaseparamsservicesKind, c.ns, opts), &v2beta2.LeaseParamsServiceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v2beta2.LeaseParamsServiceList{ListMeta: obj.(*v2beta2.LeaseParamsServiceList).ListMeta} + for _, item := range obj.(*v2beta2.LeaseParamsServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested leaseParamsServices. +func (c *FakeLeaseParamsServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(leaseparamsservicesResource, c.ns, opts)) + +} + +// Create takes the representation of a leaseParamsService and creates it. Returns the server's representation of the leaseParamsService, and an error, if there is any. +func (c *FakeLeaseParamsServices) Create(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.CreateOptions) (result *v2beta2.LeaseParamsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(leaseparamsservicesResource, c.ns, leaseParamsService), &v2beta2.LeaseParamsService{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.LeaseParamsService), err +} + +// Update takes the representation of a leaseParamsService and updates it. Returns the server's representation of the leaseParamsService, and an error, if there is any. +func (c *FakeLeaseParamsServices) Update(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.UpdateOptions) (result *v2beta2.LeaseParamsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(leaseparamsservicesResource, c.ns, leaseParamsService), &v2beta2.LeaseParamsService{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.LeaseParamsService), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeLeaseParamsServices) UpdateStatus(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.UpdateOptions) (*v2beta2.LeaseParamsService, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(leaseparamsservicesResource, "status", c.ns, leaseParamsService), &v2beta2.LeaseParamsService{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.LeaseParamsService), err +} + +// Delete takes name of the leaseParamsService and deletes it. Returns an error if one occurs. +func (c *FakeLeaseParamsServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(leaseparamsservicesResource, c.ns, name, opts), &v2beta2.LeaseParamsService{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeLeaseParamsServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(leaseparamsservicesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v2beta2.LeaseParamsServiceList{}) + return err +} + +// Patch applies the patch and returns the patched leaseParamsService. +func (c *FakeLeaseParamsServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.LeaseParamsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(leaseparamsservicesResource, c.ns, name, pt, data, subresources...), &v2beta2.LeaseParamsService{}) + + if obj == nil { + return nil, err + } + return obj.(*v2beta2.LeaseParamsService), err +} diff --git a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/generated_expansion.go b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/generated_expansion.go index 75cfc83c1..09ef02088 100644 --- a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/generated_expansion.go @@ -22,6 +22,8 @@ type InventoryExpansion interface{} type InventoryRequestExpansion interface{} +type LeaseParamsServiceExpansion interface{} + type ManifestExpansion interface{} type ProviderHostExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/akash.network/v2beta2/leaseparamsservice.go b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/leaseparamsservice.go new file mode 100644 index 000000000..64be937e1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/akash.network/v2beta2/leaseparamsservice.go @@ -0,0 +1,195 @@ +/* +Copyright The Akash Network Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + "time" + + v2beta2 "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" + scheme "github.com/akash-network/provider/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// LeaseParamsServicesGetter has a method to return a LeaseParamsServiceInterface. +// A group's client should implement this interface. +type LeaseParamsServicesGetter interface { + LeaseParamsServices(namespace string) LeaseParamsServiceInterface +} + +// LeaseParamsServiceInterface has methods to work with LeaseParamsService resources. +type LeaseParamsServiceInterface interface { + Create(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.CreateOptions) (*v2beta2.LeaseParamsService, error) + Update(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.UpdateOptions) (*v2beta2.LeaseParamsService, error) + UpdateStatus(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.UpdateOptions) (*v2beta2.LeaseParamsService, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v2beta2.LeaseParamsService, error) + List(ctx context.Context, opts v1.ListOptions) (*v2beta2.LeaseParamsServiceList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.LeaseParamsService, err error) + LeaseParamsServiceExpansion +} + +// leaseParamsServices implements LeaseParamsServiceInterface +type leaseParamsServices struct { + client rest.Interface + ns string +} + +// newLeaseParamsServices returns a LeaseParamsServices +func newLeaseParamsServices(c *AkashV2beta2Client, namespace string) *leaseParamsServices { + return &leaseParamsServices{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the leaseParamsService, and returns the corresponding leaseParamsService object, and an error if there is any. +func (c *leaseParamsServices) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2beta2.LeaseParamsService, err error) { + result = &v2beta2.LeaseParamsService{} + err = c.client.Get(). + Namespace(c.ns). + Resource("leaseparamsservices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of LeaseParamsServices that match those selectors. +func (c *leaseParamsServices) List(ctx context.Context, opts v1.ListOptions) (result *v2beta2.LeaseParamsServiceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v2beta2.LeaseParamsServiceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("leaseparamsservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested leaseParamsServices. +func (c *leaseParamsServices) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("leaseparamsservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a leaseParamsService and creates it. Returns the server's representation of the leaseParamsService, and an error, if there is any. +func (c *leaseParamsServices) Create(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.CreateOptions) (result *v2beta2.LeaseParamsService, err error) { + result = &v2beta2.LeaseParamsService{} + err = c.client.Post(). + Namespace(c.ns). + Resource("leaseparamsservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(leaseParamsService). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a leaseParamsService and updates it. Returns the server's representation of the leaseParamsService, and an error, if there is any. +func (c *leaseParamsServices) Update(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.UpdateOptions) (result *v2beta2.LeaseParamsService, err error) { + result = &v2beta2.LeaseParamsService{} + err = c.client.Put(). + Namespace(c.ns). + Resource("leaseparamsservices"). + Name(leaseParamsService.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(leaseParamsService). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *leaseParamsServices) UpdateStatus(ctx context.Context, leaseParamsService *v2beta2.LeaseParamsService, opts v1.UpdateOptions) (result *v2beta2.LeaseParamsService, err error) { + result = &v2beta2.LeaseParamsService{} + err = c.client.Put(). + Namespace(c.ns). + Resource("leaseparamsservices"). + Name(leaseParamsService.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(leaseParamsService). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the leaseParamsService and deletes it. Returns an error if one occurs. +func (c *leaseParamsServices) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("leaseparamsservices"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *leaseParamsServices) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("leaseparamsservices"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched leaseParamsService. +func (c *leaseParamsServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2beta2.LeaseParamsService, err error) { + result = &v2beta2.LeaseParamsService{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("leaseparamsservices"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/akash.network/v2beta2/interface.go b/pkg/client/informers/externalversions/akash.network/v2beta2/interface.go index 98218b5fe..ef083d672 100644 --- a/pkg/client/informers/externalversions/akash.network/v2beta2/interface.go +++ b/pkg/client/informers/externalversions/akash.network/v2beta2/interface.go @@ -28,6 +28,8 @@ type Interface interface { Inventories() InventoryInformer // InventoryRequests returns a InventoryRequestInformer. InventoryRequests() InventoryRequestInformer + // LeaseParamsServices returns a LeaseParamsServiceInformer. + LeaseParamsServices() LeaseParamsServiceInformer // Manifests returns a ManifestInformer. Manifests() ManifestInformer // ProviderHosts returns a ProviderHostInformer. @@ -57,6 +59,11 @@ func (v *version) InventoryRequests() InventoryRequestInformer { return &inventoryRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// LeaseParamsServices returns a LeaseParamsServiceInformer. +func (v *version) LeaseParamsServices() LeaseParamsServiceInformer { + return &leaseParamsServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // Manifests returns a ManifestInformer. func (v *version) Manifests() ManifestInformer { return &manifestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/akash.network/v2beta2/leaseparamsservice.go b/pkg/client/informers/externalversions/akash.network/v2beta2/leaseparamsservice.go new file mode 100644 index 000000000..d34a6657f --- /dev/null +++ b/pkg/client/informers/externalversions/akash.network/v2beta2/leaseparamsservice.go @@ -0,0 +1,90 @@ +/* +Copyright The Akash Network Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v2beta2 + +import ( + "context" + time "time" + + akashnetworkv2beta2 "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" + versioned "github.com/akash-network/provider/pkg/client/clientset/versioned" + internalinterfaces "github.com/akash-network/provider/pkg/client/informers/externalversions/internalinterfaces" + v2beta2 "github.com/akash-network/provider/pkg/client/listers/akash.network/v2beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// LeaseParamsServiceInformer provides access to a shared informer and lister for +// LeaseParamsServices. +type LeaseParamsServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v2beta2.LeaseParamsServiceLister +} + +type leaseParamsServiceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewLeaseParamsServiceInformer constructs a new informer for LeaseParamsService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseParamsServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredLeaseParamsServiceInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredLeaseParamsServiceInformer constructs a new informer for LeaseParamsService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredLeaseParamsServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AkashV2beta2().LeaseParamsServices(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AkashV2beta2().LeaseParamsServices(namespace).Watch(context.TODO(), options) + }, + }, + &akashnetworkv2beta2.LeaseParamsService{}, + resyncPeriod, + indexers, + ) +} + +func (f *leaseParamsServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredLeaseParamsServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *leaseParamsServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&akashnetworkv2beta2.LeaseParamsService{}, f.defaultInformer) +} + +func (f *leaseParamsServiceInformer) Lister() v2beta2.LeaseParamsServiceLister { + return v2beta2.NewLeaseParamsServiceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 00ef08a71..c26decdf5 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -70,6 +70,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Akash().V2beta2().Inventories().Informer()}, nil case v2beta2.SchemeGroupVersion.WithResource("inventoryrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Akash().V2beta2().InventoryRequests().Informer()}, nil + case v2beta2.SchemeGroupVersion.WithResource("leaseparamsservices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Akash().V2beta2().LeaseParamsServices().Informer()}, nil case v2beta2.SchemeGroupVersion.WithResource("manifests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Akash().V2beta2().Manifests().Informer()}, nil case v2beta2.SchemeGroupVersion.WithResource("providerhosts"): diff --git a/pkg/client/listers/akash.network/v2beta2/expansion_generated.go b/pkg/client/listers/akash.network/v2beta2/expansion_generated.go index 54f1bd76a..47f329d09 100644 --- a/pkg/client/listers/akash.network/v2beta2/expansion_generated.go +++ b/pkg/client/listers/akash.network/v2beta2/expansion_generated.go @@ -26,6 +26,14 @@ type InventoryListerExpansion interface{} // InventoryRequestLister. type InventoryRequestListerExpansion interface{} +// LeaseParamsServiceListerExpansion allows custom methods to be added to +// LeaseParamsServiceLister. +type LeaseParamsServiceListerExpansion interface{} + +// LeaseParamsServiceNamespaceListerExpansion allows custom methods to be added to +// LeaseParamsServiceNamespaceLister. +type LeaseParamsServiceNamespaceListerExpansion interface{} + // ManifestListerExpansion allows custom methods to be added to // ManifestLister. type ManifestListerExpansion interface{} diff --git a/pkg/client/listers/akash.network/v2beta2/leaseparamsservice.go b/pkg/client/listers/akash.network/v2beta2/leaseparamsservice.go new file mode 100644 index 000000000..0ba750bf6 --- /dev/null +++ b/pkg/client/listers/akash.network/v2beta2/leaseparamsservice.go @@ -0,0 +1,99 @@ +/* +Copyright The Akash Network Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v2beta2 + +import ( + v2beta2 "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// LeaseParamsServiceLister helps list LeaseParamsServices. +// All objects returned here must be treated as read-only. +type LeaseParamsServiceLister interface { + // List lists all LeaseParamsServices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.LeaseParamsService, err error) + // LeaseParamsServices returns an object that can list and get LeaseParamsServices. + LeaseParamsServices(namespace string) LeaseParamsServiceNamespaceLister + LeaseParamsServiceListerExpansion +} + +// leaseParamsServiceLister implements the LeaseParamsServiceLister interface. +type leaseParamsServiceLister struct { + indexer cache.Indexer +} + +// NewLeaseParamsServiceLister returns a new LeaseParamsServiceLister. +func NewLeaseParamsServiceLister(indexer cache.Indexer) LeaseParamsServiceLister { + return &leaseParamsServiceLister{indexer: indexer} +} + +// List lists all LeaseParamsServices in the indexer. +func (s *leaseParamsServiceLister) List(selector labels.Selector) (ret []*v2beta2.LeaseParamsService, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.LeaseParamsService)) + }) + return ret, err +} + +// LeaseParamsServices returns an object that can list and get LeaseParamsServices. +func (s *leaseParamsServiceLister) LeaseParamsServices(namespace string) LeaseParamsServiceNamespaceLister { + return leaseParamsServiceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// LeaseParamsServiceNamespaceLister helps list and get LeaseParamsServices. +// All objects returned here must be treated as read-only. +type LeaseParamsServiceNamespaceLister interface { + // List lists all LeaseParamsServices in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v2beta2.LeaseParamsService, err error) + // Get retrieves the LeaseParamsService from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v2beta2.LeaseParamsService, error) + LeaseParamsServiceNamespaceListerExpansion +} + +// leaseParamsServiceNamespaceLister implements the LeaseParamsServiceNamespaceLister +// interface. +type leaseParamsServiceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all LeaseParamsServices in the indexer for a given namespace. +func (s leaseParamsServiceNamespaceLister) List(selector labels.Selector) (ret []*v2beta2.LeaseParamsService, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v2beta2.LeaseParamsService)) + }) + return ret, err +} + +// Get retrieves the LeaseParamsService from the indexer for a given namespace and name. +func (s leaseParamsServiceNamespaceLister) Get(name string) (*v2beta2.LeaseParamsService, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v2beta2.Resource("leaseparamsservice"), name) + } + return obj.(*v2beta2.LeaseParamsService), nil +} diff --git a/tools.go b/tools.go index c7520a6c9..f1e8ed9e1 100644 --- a/tools.go +++ b/tools.go @@ -1,5 +1,4 @@ //go:build tools -// +build tools package tools