const defaultProviderName … type Balancer … type UpdateBalancerCall … var _ … var _ … var _ … var _ … var _ … var _ … var _ … var _ … type Cloud … type Route … func (f *Cloud) addCall(desc string) { … } // ClearCalls clears internal record of method calls to this Cloud. func (f *Cloud) ClearCalls() { … } // Initialize passes a Kubernetes clientBuilder interface to the cloud provider func (f *Cloud) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, stop <-chan struct{ … } // ListClusters lists the names of the available clusters. func (f *Cloud) ListClusters(ctx context.Context) ([]string, error) { … } // Master gets back the address (either DNS name or IP address) of the master node for the cluster. func (f *Cloud) Master(ctx context.Context, name string) (string, error) { … } // Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise. func (f *Cloud) Clusters() (cloudprovider.Clusters, bool) { … } // ProviderName returns the cloud provider ID. func (f *Cloud) ProviderName() string { … } // HasClusterID returns true if the cluster has a clusterID func (f *Cloud) HasClusterID() bool { … } // LoadBalancer returns a fake implementation of LoadBalancer. // Actually it just returns f itself. func (f *Cloud) LoadBalancer() (cloudprovider.LoadBalancer, bool) { … } // Instances returns a fake implementation of Instances. // // Actually it just returns f itself. func (f *Cloud) Instances() (cloudprovider.Instances, bool) { … } // InstancesV2 returns a fake implementation of InstancesV2. // // Actually it just returns f itself. func (f *Cloud) InstancesV2() (cloudprovider.InstancesV2, bool) { … } // Zones returns a zones interface. Also returns true if the interface is supported, false otherwise. func (f *Cloud) Zones() (cloudprovider.Zones, bool) { … } // Routes returns a routes interface along with whether the interface is supported. func (f *Cloud) Routes() (cloudprovider.Routes, bool) { … } // GetLoadBalancer is a stub implementation of LoadBalancer.GetLoadBalancer. func (f *Cloud) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (*v1.LoadBalancerStatus, bool, error) { … } // GetLoadBalancerName is a stub implementation of LoadBalancer.GetLoadBalancerName. func (f *Cloud) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string { … } // EnsureLoadBalancer is a test-spy implementation of LoadBalancer.EnsureLoadBalancer. // It adds an entry "create" into the internal method call record. func (f *Cloud) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) { … } func (f *Cloud) markUpdateCall(service *v1.Service, nodes []*v1.Node) { … } func (f *Cloud) markEnsureCall(service *v1.Service, nodes []*v1.Node) { … } // UpdateLoadBalancer is a test-spy implementation of LoadBalancer.UpdateLoadBalancer. // It adds an entry "update" into the internal method call record. func (f *Cloud) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error { … } // EnsureLoadBalancerDeleted is a test-spy implementation of LoadBalancer.EnsureLoadBalancerDeleted. // It adds an entry "delete" into the internal method call record. func (f *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error { … } // AddSSHKeyToAllInstances adds an SSH public key as a legal identity for all instances // expected format for the key is standard ssh-keygen format: <protocol> <blob> func (f *Cloud) AddSSHKeyToAllInstances(ctx context.Context, user string, keyData []byte) error { … } // CurrentNodeName returns the name of the node we are currently running on // On most clouds (e.g. GCE) this is the hostname, so we provide the hostname func (f *Cloud) CurrentNodeName(ctx context.Context, hostname string) (types.NodeName, error) { … } // NodeAddresses is a test-spy implementation of Instances.NodeAddresses. // It adds an entry "node-addresses" into the internal method call record. func (f *Cloud) NodeAddresses(ctx context.Context, instance types.NodeName) ([]v1.NodeAddress, error) { … } // SetNodeAddresses sets the addresses for a node func (f *Cloud) SetNodeAddresses(nodeAddresses []v1.NodeAddress) { … } // 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 (f *Cloud) NodeAddressesByProviderID(ctx context.Context, providerID string) ([]v1.NodeAddress, error) { … } // InstanceID returns the cloud provider ID of the node with the specified Name, unless an entry // for the node exists in ExtIDError, in which case it returns the desired error (to facilitate // testing of error handling). func (f *Cloud) InstanceID(ctx context.Context, nodeName types.NodeName) (string, error) { … } // InstanceType returns the type of the specified instance. func (f *Cloud) InstanceType(ctx context.Context, instance types.NodeName) (string, error) { … } // InstanceTypeByProviderID returns the type of the specified instance. func (f *Cloud) InstanceTypeByProviderID(ctx context.Context, providerID string) (string, 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 (f *Cloud) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) { … } // InstanceShutdownByProviderID returns true if the instances is in safe state to detach volumes func (f *Cloud) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) { … } // InstanceExists returns true if the instance corresponding to a node still exists and is running. // If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. func (f *Cloud) InstanceExists(ctx context.Context, node *v1.Node) (bool, error) { … } // InstanceShutdown returns true if the instances is in safe state to detach volumes func (f *Cloud) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, error) { … } // InstanceMetadata returns metadata of the specified instance. func (f *Cloud) InstanceMetadata(ctx context.Context, node *v1.Node) (*cloudprovider.InstanceMetadata, error) { … } // List is a test-spy implementation of Instances.List. // It adds an entry "list" into the internal method call record. func (f *Cloud) List(filter string) ([]types.NodeName, error) { … } // GetZone returns the Zone containing the current failure zone and locality region that the program is running in // In most cases, this method is called from the kubelet querying a local metadata service to acquire its zone. // For the case of external cloud providers, use GetZoneByProviderID or GetZoneByNodeName since GetZone // can no longer be called from the kubelets. func (f *Cloud) GetZone(ctx context.Context) (cloudprovider.Zone, error) { … } // GetZoneByProviderID implements Zones.GetZoneByProviderID // This is particularly useful in external cloud providers where the kubelet // does not initialize node data. func (f *Cloud) GetZoneByProviderID(ctx context.Context, providerID string) (cloudprovider.Zone, error) { … } // GetZoneByNodeName implements Zones.GetZoneByNodeName // This is particularly useful in external cloud providers where the kubelet // does not initialize node data. func (f *Cloud) GetZoneByNodeName(ctx context.Context, nodeName types.NodeName) (cloudprovider.Zone, error) { … } // ListRoutes lists all managed routes that belong to the specified clusterName func (f *Cloud) ListRoutes(ctx context.Context, clusterName string) ([]*cloudprovider.Route, error) { … } // CreateRoute creates the described managed route // route.Name will be ignored, although the cloud-provider may use nameHint // to create a more user-meaningful name. func (f *Cloud) CreateRoute(ctx context.Context, clusterName string, nameHint string, route *cloudprovider.Route) error { … } // DeleteRoute deletes the specified managed route // Route should be as returned by ListRoutes func (f *Cloud) DeleteRoute(ctx context.Context, clusterName string, route *cloudprovider.Route) error { … } // GetLabelsForVolume returns the labels for a PersistentVolume func (f *Cloud) GetLabelsForVolume(ctx context.Context, pv *v1.PersistentVolume) (map[string]string, error) { … }