Documentation ¶
Overview ¶
Package cloudprovider supplies interfaces and implementations for cloud service providers.
Index ¶
- Variables
- func GetInstanceProviderID(cloud Interface, nodeName types.NodeName) (string, error)
- func GetLoadBalancerName(service *v1.Service) string
- func IsCloudProvider(name string) bool
- func IsExternal(name string) bool
- func RegisterCloudProvider(name string, cloud Factory)
- type Clusters
- type Factory
- type InformerUser
- type Instances
- type Interface
- type LoadBalancer
- type PVLabeler
- type Route
- type Routes
- type Zone
- type Zones
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetInstanceProviderID ¶ added in v0.18.0
GetInstanceProviderID builds a ProviderID for a node in a cloud.
func GetLoadBalancerName ¶ added in v0.15.0
TODO(#6812): Use a shorter name that's less likely to be longer than cloud providers' name length limits.
func IsCloudProvider ¶ added in v1.5.0
IsCloudProvider returns true if name corresponds to an already registered cloud provider.
func IsExternal ¶ added in v1.6.0
Detects if the string is an external cloud provider
func RegisterCloudProvider ¶
RegisterCloudProvider registers a cloudprovider.Factory by name. This is expected to happen during app startup.
Types ¶
type Clusters ¶ added in v0.5.1
type Clusters interface { // ListClusters lists the names of the available clusters. ListClusters() ([]string, error) // Master gets back the address (either DNS name or IP address) of the master node for the cluster. Master(clusterName string) (string, error) }
Clusters is an abstract, pluggable interface for clusters of containers.
type Factory ¶
Factory is a function that returns a cloudprovider.Interface. The config parameter provides an io.Reader handler to the factory in order to load specific configurations. If no configuration is provided the parameter is nil.
type InformerUser ¶ added in v1.8.5
type InformerUser interface { // SetInformers sets the informer on the cloud object. SetInformers(informerFactory informers.SharedInformerFactory) }
type Instances ¶
type Instances interface { // NodeAddresses returns the addresses of the specified instance. // TODO(roberthbailey): This currently is only used in such a way that it // returns the address of the calling instance. We should do a rename to // make this clearer. NodeAddresses(name types.NodeName) ([]v1.NodeAddress, error) // NodeAddressesByProviderID returns the addresses of the specified instance. // The instance is specified using the providerID of the node. The // ProviderID is a unique identifier of the node. This will not be called // from the node whose nodeaddresses are being queried. i.e. local metadata // services cannot be used in this method to obtain nodeaddresses NodeAddressesByProviderID(providerID string) ([]v1.NodeAddress, error) // ExternalID returns the cloud provider ID of the node with the specified NodeName. // Note that if the instance does not exist or is no longer running, we must return ("", cloudprovider.InstanceNotFound) ExternalID(nodeName types.NodeName) (string, error) // InstanceID returns the cloud provider ID of the node with the specified NodeName. InstanceID(nodeName types.NodeName) (string, error) // InstanceType returns the type of the specified instance. InstanceType(name types.NodeName) (string, error) // InstanceTypeByProviderID returns the type of the specified instance. InstanceTypeByProviderID(providerID string) (string, 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> AddSSHKeyToAllInstances(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 CurrentNodeName(hostname string) (types.NodeName, error) // InstanceExistsByProviderID returns true if the instance for the given provider id still is running. // If false is returned with no error, the instance will be immediately deleted by the cloud controller manager. InstanceExistsByProviderID(providerID string) (bool, error) }
Instances is an abstract, pluggable interface for sets of instances.
type Interface ¶
type Interface interface { // Initialize provides the cloud with a kubernetes client builder and may spawn goroutines // to perform housekeeping activities within the cloud provider. Initialize(clientBuilder controller.ControllerClientBuilder) // LoadBalancer returns a balancer interface. Also returns true if the interface is supported, false otherwise. LoadBalancer() (LoadBalancer, bool) // Instances returns an instances interface. Also returns true if the interface is supported, false otherwise. Instances() (Instances, bool) // Zones returns a zones interface. Also returns true if the interface is supported, false otherwise. Zones() (Zones, bool) // Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise. Clusters() (Clusters, bool) // Routes returns a routes interface along with whether the interface is supported. Routes() (Routes, bool) // ProviderName returns the cloud provider ID. ProviderName() string // HasClusterID returns true if a ClusterID is required and set HasClusterID() bool }
Interface is an abstract, pluggable interface for cloud providers.
func GetCloudProvider ¶
GetCloudProvider creates an instance of the named cloud provider, or nil if the name is unknown. The error return is only used if the named provider was known but failed to initialize. The config parameter specifies the io.Reader handler of the configuration file for the cloud provider, or nil for no configuration.
type LoadBalancer ¶ added in v1.2.0
type LoadBalancer interface { // TODO: Break this up into different interfaces (LB, etc) when we have more than one type of service // GetLoadBalancer returns whether the specified load balancer exists, and // if so, what its status is. // Implementations must treat the *v1.Service parameter as read-only and not modify it. // Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager GetLoadBalancer(clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error) // EnsureLoadBalancer creates a new load balancer 'name', or updates the existing one. Returns the status of the balancer // Implementations must treat the *v1.Service and *v1.Node // parameters as read-only and not modify them. // Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager EnsureLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error) // UpdateLoadBalancer updates hosts under the specified load balancer. // Implementations must treat the *v1.Service and *v1.Node // parameters as read-only and not modify them. // Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager UpdateLoadBalancer(clusterName string, service *v1.Service, nodes []*v1.Node) error // EnsureLoadBalancerDeleted deletes the specified load balancer if it // exists, returning nil if the load balancer specified either didn't exist or // was successfully deleted. // This construction is useful because many cloud providers' load balancers // have multiple underlying components, meaning a Get could say that the LB // doesn't exist even if some part of it is still laying around. // Implementations must treat the *v1.Service parameter as read-only and not modify it. // Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager EnsureLoadBalancerDeleted(clusterName string, service *v1.Service) error }
LoadBalancer is an abstract, pluggable interface for load balancers.
type PVLabeler ¶ added in v1.8.0
type PVLabeler interface {
GetLabelsForVolume(pv *v1.PersistentVolume) (map[string]string, error)
}
PVLabeler is an abstract, pluggable interface for fetching labels for volumes
type Route ¶ added in v0.18.0
type Route struct { // Name is the name of the routing rule in the cloud-provider. // It will be ignored in a Create (although nameHint may influence it) Name string // TargetNode is the NodeName of the target instance. TargetNode types.NodeName // DestinationCIDR is the CIDR format IP range that this routing rule // applies to. DestinationCIDR string // Blackhole is set to true if this is a blackhole route // The node controller will delete the route if it is in the managed range. Blackhole bool }
Route is a representation of an advanced routing rule.
type Routes ¶ added in v0.18.0
type Routes interface { // ListRoutes lists all managed routes that belong to the specified clusterName ListRoutes(clusterName string) ([]*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. CreateRoute(clusterName string, nameHint string, route *Route) error // DeleteRoute deletes the specified managed route // Route should be as returned by ListRoutes DeleteRoute(clusterName string, route *Route) error }
Routes is an abstract, pluggable interface for advanced routing rules.
type Zones ¶
type Zones interface { // 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 aquire its zone. // For the case of external cloud providers, use GetZoneByProviderID or GetZoneByNodeName since GetZone // can no longer be called from the kubelets. GetZone() (Zone, error) // GetZoneByProviderID returns the Zone containing the current zone and locality region of the node specified by providerId // This method is particularly used in the context of external cloud providers where node initialization must be down // outside the kubelets. GetZoneByProviderID(providerID string) (Zone, error) // GetZoneByNodeName returns the Zone containing the current zone and locality region of the node specified by node name // This method is particularly used in the context of external cloud providers where node initialization must be down // outside the kubelets. GetZoneByNodeName(nodeName types.NodeName) (Zone, error) }
Zones is an abstract, pluggable interface for zone enumeration.
Directories ¶
Path | Synopsis |
---|---|
fake
Package fake is a test-double implementation of cloudprovider Interface, LoadBalancer and Instances.
|
Package fake is a test-double implementation of cloudprovider Interface, LoadBalancer and Instances. |
gce
Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine.
|
Package gce is an implementation of Interface, LoadBalancer and Instances for Google Compute Engine. |
gce/cloud
Package cloud implements a more golang friendly interface to the GCE compute API.
|
Package cloud implements a more golang friendly interface to the GCE compute API. |
gce/cloud/filter
Package filter encapsulates the filter argument to compute API calls.
|
Package filter encapsulates the filter argument to compute API calls. |
gce/cloud/gen
Generator for GCE compute wrapper code.
|
Generator for GCE compute wrapper code. |
gce/cloud/meta
Package meta contains the meta description of the GCE cloud types to generate code for.
|
Package meta contains the meta description of the GCE cloud types to generate code for. |
photon
This version of Photon cloud provider supports the disk interface for Photon persistent disk volume plugin.
|
This version of Photon cloud provider supports the disk interface for Photon persistent disk volume plugin. |