kubecrd

package
v0.0.0-...-8023bdc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2019 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNetworkCRD

func CreateTenantCRD

func WaitForNetworkInstanceProcessed

func WaitForNetworkInstanceProcessed(networkClient *rest.RESTClient, name, namespace string) error

func WaitForTenantInstanceProcessed

func WaitForTenantInstanceProcessed(tenantClient *rest.RESTClient, name string) error

Types

type CRDClient

type CRDClient struct {
	// contains filtered or unexported fields
}

CRDClient implements the Interface.

func (*CRDClient) AddNetwork

func (c *CRDClient) AddNetwork(network *crv1.Network) error

AddNetwork adds Network CRD object by given object.

func (*CRDClient) AddTenant

func (c *CRDClient) AddTenant(tenant *crv1.Tenant) error

AddTenant adds Tenant CRD object by given object. NOTE: all tenant are added to system namespace.

func (*CRDClient) Client

func (c *CRDClient) Client() *rest.RESTClient

Client returns the RESTClient.

func (*CRDClient) DeleteNetwork

func (c *CRDClient) DeleteNetwork(networkName string) error

DeleteNetwork deletes Network CRD object by networkName. NOTE: the automatically created network for tenant use namespace as name.

func (*CRDClient) GetTenant

func (c *CRDClient) GetTenant(tenantName string) (*crv1.Tenant, error)

GetTenant returns Tenant CRD object by tenantName. NOTE: all tenant are stored under system namespace.

func (*CRDClient) Scheme

func (c *CRDClient) Scheme() *runtime.Scheme

Scheme returns runtime scheme.

func (*CRDClient) UpdateNetwork

func (c *CRDClient) UpdateNetwork(network *crv1.Network) error

UpdateNetwork updates Network CRD object by given object.

func (*CRDClient) UpdateTenant

func (c *CRDClient) UpdateTenant(tenant *crv1.Tenant) error

UpdateTenant updates Network CRD object by given object.

type CalledDetail

type CalledDetail struct {
	// Name of the function called.
	Name string
	// Argument of the function called.
	Argument interface{}
}

CalledDetail is the struct contains called function name and arguments.

type FakeCRDClient

type FakeCRDClient struct {
	sync.Mutex

	Tenants  map[string]*crv1.Tenant
	Networks map[string]*crv1.Network
	// contains filtered or unexported fields
}

FakeCRDClient is a simple fake CRD client, so that stackube can be run for testing without requiring a real kubernetes setup.

func NewFake

func NewFake() (*FakeCRDClient, error)

NewFake creates a new FakeCRDClient.

func (*FakeCRDClient) AddNetwork

func (f *FakeCRDClient) AddNetwork(network *crv1.Network) error

AddNetwork is a test implementation of Interface.AddNetwork.

func (*FakeCRDClient) AddTenant

func (f *FakeCRDClient) AddTenant(tenant *crv1.Tenant) error

AddTenant is a test implementation of Interface.AddTenant.

func (*FakeCRDClient) ClearErrors

func (f *FakeCRDClient) ClearErrors()

ClearErrors clear errors for call

func (*FakeCRDClient) Client

func (f *FakeCRDClient) Client() *rest.RESTClient

Client is a test implementation of Interface.Client.

func (*FakeCRDClient) DeleteNetwork

func (f *FakeCRDClient) DeleteNetwork(networkName string) error

DeleteNetwork is a test implementation of Interface.DeleteNetwork.

func (*FakeCRDClient) DeleteTenant

func (f *FakeCRDClient) DeleteTenant(tenantName string) error

DeleteTenant is a test implementation of Interface.DeleteTenant.

func (*FakeCRDClient) GetCalledDetails

func (f *FakeCRDClient) GetCalledDetails() []CalledDetail

GetCalledDetails get detail of each call.

func (*FakeCRDClient) GetCalledNames

func (f *FakeCRDClient) GetCalledNames() []string

GetCalledNames get names of call

func (*FakeCRDClient) GetTenant

func (f *FakeCRDClient) GetTenant(tenantName string) (*crv1.Tenant, error)

GetTenant is a test implementation of Interface.GetTenant.

func (*FakeCRDClient) InjectError

func (f *FakeCRDClient) InjectError(fn string, err error)

InjectError inject error for call

func (*FakeCRDClient) InjectErrors

func (f *FakeCRDClient) InjectErrors(errs map[string]error)

InjectErrors inject errors for calls

func (*FakeCRDClient) Scheme

func (f *FakeCRDClient) Scheme() *runtime.Scheme

Scheme is a test implementation of Interface.Scheme.

func (*FakeCRDClient) SetNetworks

func (f *FakeCRDClient) SetNetworks(networks ...*crv1.Network)

SetNetworks injects fake network.

func (*FakeCRDClient) SetTenants

func (f *FakeCRDClient) SetTenants(tenants ...*crv1.Tenant)

SetTenants injects fake tenant.

func (*FakeCRDClient) UpdateNetwork

func (f *FakeCRDClient) UpdateNetwork(network *crv1.Network) error

UpdateNetwork is a test implementation of Interface.UpdateNetwork.

func (*FakeCRDClient) UpdateTenant

func (f *FakeCRDClient) UpdateTenant(tenant *crv1.Tenant) error

UpdateTenant is a test implementation of Interface.UpdateTenant.

type Interface

type Interface interface {
	// AddTenant adds Tenant CRD object by given object.
	AddTenant(tenant *crv1.Tenant) error
	// GetTenant returns Tenant CRD object by tenantName.
	GetTenant(tenantName string) (*crv1.Tenant, error)
	// UpdateTenant updates Tenant CRD object by given object.
	UpdateTenant(tenant *crv1.Tenant) error
	// AddNetwork adds Network CRD object by given object.
	AddNetwork(network *crv1.Network) error
	// UpdateNetwork updates Network CRD object by given object.
	UpdateNetwork(network *crv1.Network) error
	// DeleteNetwork deletes Network CRD object by networkName.
	DeleteNetwork(networkName string) error
	// Client returns the RESTClient.
	Client() *rest.RESTClient
	// Scheme returns runtime scheme.
	Scheme() *runtime.Scheme
}

Interface should be implemented by a CRD client.

func NewCRDClient

func NewCRDClient(cfg *rest.Config) (Interface, error)

NewCRDClient returns a new CRD client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL