Documentation ¶
Index ¶
- func CreateNetworkCRD(clientset apiextensionsclient.Interface) (*apiextensionsv1beta1.CustomResourceDefinition, error)
- func CreateTenantCRD(clientset apiextensionsclient.Interface) (*apiextensionsv1beta1.CustomResourceDefinition, error)
- func WaitForNetworkInstanceProcessed(networkClient *rest.RESTClient, name, namespace string) error
- func WaitForTenantInstanceProcessed(tenantClient *rest.RESTClient, name string) error
- type CRDClient
- func (c *CRDClient) AddNetwork(network *crv1.Network) error
- func (c *CRDClient) AddTenant(tenant *crv1.Tenant) error
- func (c *CRDClient) Client() *rest.RESTClient
- func (c *CRDClient) DeleteNetwork(networkName string) error
- func (c *CRDClient) GetTenant(tenantName string) (*crv1.Tenant, error)
- func (c *CRDClient) Scheme() *runtime.Scheme
- func (c *CRDClient) UpdateNetwork(network *crv1.Network) error
- func (c *CRDClient) UpdateTenant(tenant *crv1.Tenant) error
- type CalledDetail
- type FakeCRDClient
- func (f *FakeCRDClient) AddNetwork(network *crv1.Network) error
- func (f *FakeCRDClient) AddTenant(tenant *crv1.Tenant) error
- func (f *FakeCRDClient) ClearErrors()
- func (f *FakeCRDClient) Client() *rest.RESTClient
- func (f *FakeCRDClient) DeleteNetwork(networkName string) error
- func (f *FakeCRDClient) DeleteTenant(tenantName string) error
- func (f *FakeCRDClient) GetCalledDetails() []CalledDetail
- func (f *FakeCRDClient) GetCalledNames() []string
- func (f *FakeCRDClient) GetTenant(tenantName string) (*crv1.Tenant, error)
- func (f *FakeCRDClient) InjectError(fn string, err error)
- func (f *FakeCRDClient) InjectErrors(errs map[string]error)
- func (f *FakeCRDClient) Scheme() *runtime.Scheme
- func (f *FakeCRDClient) SetNetworks(networks ...*crv1.Network)
- func (f *FakeCRDClient) SetTenants(tenants ...*crv1.Tenant)
- func (f *FakeCRDClient) UpdateNetwork(network *crv1.Network) error
- func (f *FakeCRDClient) UpdateTenant(tenant *crv1.Tenant) error
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNetworkCRD ¶
func CreateNetworkCRD(clientset apiextensionsclient.Interface) (*apiextensionsv1beta1.CustomResourceDefinition, error)
func CreateTenantCRD ¶
func CreateTenantCRD(clientset apiextensionsclient.Interface) (*apiextensionsv1beta1.CustomResourceDefinition, error)
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 ¶
AddNetwork adds Network CRD object by given object.
func (*CRDClient) AddTenant ¶
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 ¶
DeleteNetwork deletes Network CRD object by networkName. NOTE: the automatically created network for tenant use namespace as name.
func (*CRDClient) GetTenant ¶
GetTenant returns Tenant CRD object by tenantName. NOTE: all tenant are stored under system namespace.
func (*CRDClient) Scheme ¶
Scheme returns runtime scheme.
func (*CRDClient) UpdateNetwork ¶
UpdateNetwork 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 (*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.