Documentation ¶
Overview ¶
Package fake is a test-double implementation of cloudprovider Interface, LoadBalancer and Instances. It is useful for testing.
Index ¶
- type FakeBalancer
- type FakeCloud
- func (f *FakeCloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error
- func (f *FakeCloud) ClearCalls()
- func (f *FakeCloud) Clusters() (cloudprovider.Clusters, bool)
- func (f *FakeCloud) CreateRoute(ctx context.Context, clusterName string, nameHint string, ...) error
- func (f *FakeCloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error)
- func (f *FakeCloud) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error
- func (f *FakeCloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
- func (f *FakeCloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error
- func (c *FakeCloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error)
- func (f *FakeCloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error)
- func (f *FakeCloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string
- func (f *FakeCloud) GetZone(ctx context.Context) (cloudprovider.Zone, error)
- func (f *FakeCloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)
- func (f *FakeCloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
- func (f *FakeCloud) HasClusterID() bool
- func (f *FakeCloud) Initialize(clientBuilder controller.ControllerClientBuilder)
- func (f *FakeCloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
- func (f *FakeCloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error)
- func (f *FakeCloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
- func (f *FakeCloud) InstanceType(ctx context.Context, instance types.NodeName) (string, error)
- func (f *FakeCloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
- func (f *FakeCloud) Instances() (cloudprovider.Instances, bool)
- func (f *FakeCloud) List(filter string) ([]types.NodeName, error)
- func (f *FakeCloud) ListClusters(ctx context.Context) ([]string, error)
- func (f *FakeCloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error)
- func (f *FakeCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
- func (f *FakeCloud) Master(ctx context.Context, name string) (string, error)
- func (f *FakeCloud) NodeAddresses(ctx context.Context, instance types.NodeName) ([]v1.NodeAddress, error)
- func (f *FakeCloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
- func (f *FakeCloud) ProviderName() string
- func (f *FakeCloud) Routes() (cloudprovider.Routes, bool)
- func (f *FakeCloud) SetNodeAddresses(nodeAddresses []v1.NodeAddress)
- func (f *FakeCloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error
- func (f *FakeCloud) Zones() (cloudprovider.Zones, bool)
- type FakeRoute
- type FakeUpdateBalancerCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeBalancer ¶
type FakeBalancer struct { Name string Region string LoadBalancerIP string Ports []v1.ServicePort Hosts []*v1.Node }
FakeBalancer is a fake storage of balancer information
type FakeCloud ¶
type FakeCloud struct { Exists bool Err error ExistsByProviderID bool ErrByProviderID error NodeShutdown bool ErrShutdownByProviderID error Calls []string Addresses []v1.NodeAddress ExtID map[types.NodeName]string InstanceTypes map[types.NodeName]string Machines []types.NodeName NodeResources *v1.NodeResources ClusterList []string MasterName string ExternalIP net.IP Balancers map[string]FakeBalancer UpdateCalls []FakeUpdateBalancerCall RouteMap map[string]*FakeRoute Lock sync.Mutex Provider string cloudprovider.Zone VolumeLabelMap map[string]map[string]string RequestDelay time.Duration // contains filtered or unexported fields }
FakeCloud is a test-double implementation of Interface, LoadBalancer, Instances, and Routes. It is useful for testing.
func (*FakeCloud) AddSSHKeyToAllInstances ¶
func (*FakeCloud) ClearCalls ¶
func (f *FakeCloud) ClearCalls()
ClearCalls clears internal record of method calls to this FakeCloud.
func (*FakeCloud) CreateRoute ¶
func (*FakeCloud) CurrentNodeName ¶
Implementation of Instances.CurrentNodeName
func (*FakeCloud) DeleteRoute ¶
func (*FakeCloud) EnsureLoadBalancer ¶ added in v1.2.0
func (f *FakeCloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)
EnsureLoadBalancer is a test-spy implementation of LoadBalancer.EnsureLoadBalancer. It adds an entry "create" into the internal method call record.
func (*FakeCloud) EnsureLoadBalancerDeleted ¶ added in v1.2.0
func (f *FakeCloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error
EnsureLoadBalancerDeleted is a test-spy implementation of LoadBalancer.EnsureLoadBalancerDeleted. It adds an entry "delete" into the internal method call record.
func (*FakeCloud) GetLabelsForVolume ¶ added in v1.8.0
func (*FakeCloud) GetLoadBalancer ¶ added in v1.2.0
func (f *FakeCloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error)
GetLoadBalancer is a stub implementation of LoadBalancer.GetLoadBalancer.
func (*FakeCloud) GetLoadBalancerName ¶ added in v1.12.0
func (f *FakeCloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string
GetLoadBalancerName is a stub implementation of LoadBalancer.GetLoadBalancerName.
func (*FakeCloud) GetZoneByNodeName ¶ added in v1.8.0
func (f *FakeCloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error)
GetZoneByNodeName implements Zones.GetZoneByNodeName This is particularly useful in external cloud providers where the kubelet does not initialize node data.
func (*FakeCloud) GetZoneByProviderID ¶ added in v1.8.0
func (f *FakeCloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error)
GetZoneByProviderID implements Zones.GetZoneByProviderID This is particularly useful in external cloud providers where the kubelet does not initialize node data.
func (*FakeCloud) HasClusterID ¶ added in v1.8.0
HasClusterID returns true if the cluster has a clusterID
func (*FakeCloud) Initialize ¶ added in v1.7.0
func (f *FakeCloud) Initialize(clientBuilder controller.ControllerClientBuilder)
Initialize passes a Kubernetes clientBuilder interface to the cloud provider
func (*FakeCloud) InstanceExistsByProviderID ¶ added in v1.8.0
func (f *FakeCloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
InstanceExistsByProviderID returns true if the instance with the given provider id still exists and is running. If false is returned with no error, the instance will be immediately deleted by the cloud controller manager.
func (*FakeCloud) InstanceID ¶
InstanceID returns the cloud provider ID of the node with the specified Name.
func (*FakeCloud) InstanceShutdownByProviderID ¶ added in v1.11.0
func (f *FakeCloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
InstanceShutdownByProviderID returns true if the instances is in safe state to detach volumes
func (*FakeCloud) InstanceType ¶ added in v1.2.0
InstanceType returns the type of the specified instance.
func (*FakeCloud) InstanceTypeByProviderID ¶ added in v1.7.0
func (f *FakeCloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, error)
InstanceTypeByProviderID returns the type of the specified instance.
func (*FakeCloud) Instances ¶
func (f *FakeCloud) Instances() (cloudprovider.Instances, bool)
Instances returns a fake implementation of Instances.
Actually it just returns f itself.
func (*FakeCloud) List ¶
List is a test-spy implementation of Instances.List. It adds an entry "list" into the internal method call record.
func (*FakeCloud) ListClusters ¶
func (*FakeCloud) ListRoutes ¶
func (*FakeCloud) LoadBalancer ¶ added in v1.2.0
func (f *FakeCloud) LoadBalancer() (cloudprovider.LoadBalancer, bool)
LoadBalancer returns a fake implementation of LoadBalancer. Actually it just returns f itself.
func (*FakeCloud) NodeAddresses ¶
func (f *FakeCloud) NodeAddresses(ctx context.Context, instance types.NodeName) ([]v1.NodeAddress, error)
NodeAddresses is a test-spy implementation of Instances.NodeAddresses. It adds an entry "node-addresses" into the internal method call record.
func (*FakeCloud) NodeAddressesByProviderID ¶ added in v1.7.0
func (f *FakeCloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error)
NodeAddressesByProviderID is a test-spy implementation of Instances.NodeAddressesByProviderID. It adds an entry "node-addresses-by-provider-id" into the internal method call record.
func (*FakeCloud) ProviderName ¶
ProviderName returns the cloud provider ID.
func (*FakeCloud) SetNodeAddresses ¶ added in v1.12.0
func (f *FakeCloud) SetNodeAddresses(nodeAddresses []v1.NodeAddress)
func (*FakeCloud) UpdateLoadBalancer ¶ added in v1.2.0
func (f *FakeCloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error
UpdateLoadBalancer is a test-spy implementation of LoadBalancer.UpdateLoadBalancer. It adds an entry "update" into the internal method call record.
type FakeRoute ¶
type FakeRoute struct { ClusterName string Route cloudprovider.Route }